Esempio n. 1
0
 protected bool ValidateModel(MissionReportsListModel model)
 {
     if (model.BeginDate.HasValue && model.EndDate.HasValue &&
         model.BeginDate.Value > model.EndDate.Value)
         ModelState.AddModelError("BeginDate", "Дата в поле <Период с> не может быть больше даты в поле <по>.");
     //if (model.IsApproveClick && (model.Documents == null || model.Documents.Count == 0
     //           || model.Documents.Where(x => x.IsChecked).Count() == 0))
     //    ModelState.AddModelError(string.Empty, "Не выбрано ни одного приказа для согласования.");
     return ModelState.IsValid;
 }
Esempio n. 2
0
 protected void SetMissionReportFilterToSession(MissionReportsListModel model)
 {
     MissionOrderFilterModel filterModel = new MissionOrderFilterModel
     {
         BeginDate = model.BeginDate,
         DepartmentId = model.DepartmentId,
         EndDate = model.EndDate,
         StatusId = model.StatusId,
         UserName = model.UserName,
         Number = model.Number,
     };
     System.Web.HttpContext.Current.Session[SessionMissionReportFilterName] = filterModel;
 }
Esempio n. 3
0
 protected void SetMissionReportListModelFromSession(MissionReportsListModel model)
 {
     MissionOrderFilterModel filterModel = (MissionOrderFilterModel)System.Web.HttpContext.Current.Session[SessionMissionReportFilterName];
     if (filterModel != null)
     {
         model.StatusId = filterModel.StatusId;
         model.BeginDate = filterModel.BeginDate;
         model.EndDate = filterModel.EndDate;
         model.UserName = filterModel.UserName;
         model.Number = filterModel.Number;
         if (AuthenticationService.CurrentUser.UserRole != UserRole.Employee && filterModel.DepartmentId != 0)
         {
             Department dep = DepartmentDao.Load(filterModel.DepartmentId);
             if (dep != null)
             {
                 model.DepartmentId = filterModel.DepartmentId;
                 model.DepartmentName = dep.Name;
             }
         }
     }
 }
Esempio n. 4
0
 public ActionResult MissionReportsList(MissionReportsListModel model)
 {
     //ModelState.Clear();
     bool hasError = !ValidateModel(model);
     if (!hasError)
         SetMissionReportFilterToSession(model);
     RequestBl.SetMissionReportsListModel(model, hasError);
     //if (model.HasErrors)
     //    ModelState.AddModelError(string.Empty, "При согласовании приказов произошла(и) ошибка(и).Не все приказы были согласованы.");
     return View(model);
 }