Внедрение методов проверки данных сотрудников - PullRequest
0 голосов
/ 07 ноября 2018
 private bool CheckRules(List<Report> reportList, out string errorMsg)
    {
      errorMsg = "";
int maximumConsecutiveReports = int.Parse(ConfigurationManager.AppSettings["MaximumConsecutiveReports"]); 
}

Мне нужно, чтобы отчеты не могли быть представлены в течение последовательных X дней отсутствия (ReportType = "Отсутствие") - Например, если значение X равно 3, то невозможно сообщить о пропущенных отчетах в даты 1,2,3 в месяц. Но можно сообщить о датах 1,2,4 в месяц.

    public class Report
  {
    #region Persisted Properties

    public virtual Guid Id { get; set; }
    public virtual int EmployeeId { get; set; }
    public virtual DateTime Date { get; set; }
    public virtual ReportType? ReportTypeId { get; set; }
    public virtual DateTime? EntryTime { get; set; }
    public virtual DateTime? ExitTime { get; set; }
    public virtual decimal? ExpensesAmount { get; set; }
    public virtual string Comment { get; set; }
    public virtual bool IsReadOnly { get; set; }

    #endregion Persisted Properties

    #region Non-Persisted Properties

    public virtual bool IsNew
    {
      get
      {
        return Id == default(Guid); // default(Guid) = 00000000-0000-0000-0000-000000000000
      }
    }

    #endregion Non-Persisted Properties

    public Report(int employeeId, DateTime date, ReportType? reportTypeId, DateTime? entryTime, DateTime? exitTime, decimal? expensesAmount, string comment, bool isReadOnly)
    {
      Id = Guid.NewGuid();
      Date = date;
      EmployeeId = employeeId;
      ReportTypeId = reportTypeId;
      EntryTime = entryTime;
      ExitTime = exitTime;
      ExpensesAmount = expensesAmount;
      Comment = comment;
      IsReadOnly = isReadOnly;
    }

    public Report()
    {
      Id = Guid.Empty;
    }
  }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...