/// <summary> /// Prepare fiscalSchedule model /// </summary> /// <param name="model">FiscalSchedule model</param> /// <param name="fiscalSchedule">FiscalSchedule</param> /// <param name="excludeProperties">Whether to exclude populating of some properties of model</param> /// <returns>FiscalSchedule model</returns> public virtual FiscalScheduleModel PrepareFiscalScheduleModel(FiscalScheduleModel model, FiscalSchedule fiscalSchedule, bool excludeProperties = false) { if (fiscalSchedule != null) { //fill in model values from the entity model = model ?? fiscalSchedule.ToModel <FiscalScheduleModel>(); model.Id = fiscalSchedule.Id; model.FiscalYear = fiscalSchedule.FiscalYear; model.ClosingDate = fiscalSchedule.ClosingDate.AddYears(543); model.FiscalCode = fiscalSchedule.FiscalCode; model.FiscalTimes = fiscalSchedule.FiscalTimes; model.OpeningDate = fiscalSchedule.OpeningDate.AddYears(543); } else { model.FiscalCode = _fiscalScheduleService.GetNextNumber(); model.FiscalYear = DateTime.Today.Year + 543; model.OpeningDate = DateTime.Today.AddYears(543); model.ClosingDate = DateTime.Today.AddYears(544); model.FiscalTimes = 1; } _baseAdminModelFactory.PrepareFiscalYears(model.AvailableFiscalYears, true, "--ระบุปี--"); return(model); }
public ProjectSearchModel PrepareProjectSearchModel(ProjectSearchModel searchModel) { _baseAdminModelFactory.PrepareAgencies(searchModel.AvailableAgencies, true, "--หน่วยงาน--"); _baseAdminModelFactory.PrepareFiscalYears(searchModel.AvailableFiscalYears, true, "--ปีงบประมาณ--"); _baseAdminModelFactory.PrepareProjectStatuses(searchModel.AvailableProjectStatuses, true, "--สถานะผลการพิจารณา--"); _baseAdminModelFactory.PrepareProgressStatuses(searchModel.AvailableProgressStatuses, true, "--สถานะโครงการวิจัย--"); //prepare page parameters searchModel.SetGridPageSize(); return(searchModel); }
/// <summary> /// Prepare researchIssue model /// </summary> /// <param name="model">ResearchIssue model</param> /// <param name="researchIssue">ResearchIssue</param> /// <param name="excludeProperties">Whether to exclude populating of some properties of model</param> /// <returns>ResearchIssue model</returns> public virtual ResearchIssueModel PrepareResearchIssueModel(ResearchIssueModel model, ResearchIssue researchIssue, bool excludeProperties = false) { if (researchIssue != null) { //fill in model values from the entity model = model ?? researchIssue.ToModel <ResearchIssueModel>(); model.Id = researchIssue.Id; model.FiscalYear = researchIssue.FiscalYear; model.IssueCode = researchIssue.IssueCode; model.Name = researchIssue.Name; } else { model.IssueCode = _researchIssueService.GetNextNumber(); model.FiscalYear = DateTime.Today.Year + 543; } _baseAdminModelFactory.PrepareFiscalYears(model.AvailableFiscalYears, true, "--ระบุปี--"); return(model); }