protected bool ValidateModel(AppointmentListModel model) { if (model.BeginDate.HasValue && model.EndDate.HasValue && model.BeginDate.Value > model.EndDate.Value) ModelState.AddModelError("BeginDate", StrInvalidListDates); return ModelState.IsValid; }
public ActionResult Index(AppointmentListModel model) { if(model.ForPrint>0) return RedirectToAction("GetPrintForm", "Graphics", new { param = model.ToParamsString(), controll = "Appointment", actionName = "Print", isLandscape = false }); bool hasError = !ValidateModel(model); AppointmentBl.SetAppointmentListModel(model, hasError); return View("Index",model); }
public ActionResult Print(AppointmentListModel model) { if (model.ForPrint == 1) { model.ForPrint = 0; return Index(model); } else { model.ForPrint = 0; return AppointmentReportList(model); } }
public void SetDictionariesToModel(AppointmentListModel model) { model.Statuses = GetAppRequestStatuses(); model.Reasons = AppointmentReasonDao.LoadAll().Select(x => new IdNameDto { Id = x.Id, Name = x.Name }).ToList(); model.Reasons.Add(new IdNameDto{Id=0,Name="Все"}); }
public void SetAppointmentReportsListModel(AppointmentListModel model, bool hasError) { SetDictionariesToReportsModel(model); User user = UserDao.Load(AuthenticationService.CurrentUser.Id); if (hasError) model.Documents = new List<AppointmentDto>(); else SetDocumentsReportsToModel(model, user); }
public AppointmentListModel GetAppointmentReportListModel() { //User user = UserDao.Load(AuthenticationService.CurrentUser.Id); //IdNameReadonlyDto dep = GetDepartmentDto(user); UserRole role = AuthenticationService.CurrentUser.UserRole; AppointmentListModel model = new AppointmentListModel { //UserId = AuthenticationService.CurrentUser.Id, DepartmentName = string.Empty, DepartmentId = 0, DepartmentReadOnly = false, }; SetInitialDates(model); SetDictionariesToReportsModel(model); model.IsAddAvailable = (role & UserRole.Manager) == UserRole.Manager; model.IsAddForStaffAvailable = role == UserRole.StaffManager; //SetInitialStatus(model); //SetIsAvailable(model); return model; }
public void SetDocumentsToModel(AppointmentListModel model, User user) { UserRole role = AuthenticationService.CurrentUser.UserRole; //model.Documents = new List<AppointmentDto>(); model.Documents = AppointmentDao.GetDocuments( user.Id, role, model.DepartmentId, model.ReasonId, model.StatusId, model.Number, model.BeginDate, model.EndDate, model.UserName, model.RecruteFio, model.SortBy, model.SortDescending); }
public void SetDictionariesToReportsModel(AppointmentListModel model) { model.Statuses = GetAppReportStatuses(); var employmentBl=Ioc.Resolve<IEmploymentBl>(); model.EmploymentStatuses = employmentBl.GetEmploymentStatuses(); }