예제 #1
0
 public ActionResult ActionsList(int type)
 {
     CheckUserRole(false);
     ActionListModel model = new ActionListModel {Type = (ExportImportType)type};
     AdminBl.SetModel(model);
     ViewBag.Title = "Список " + (model.Type == ExportImportType.Import ? "загрузок" : "выгрузок");
     return View(model);
 }
예제 #2
0
 public ActionResult ActionsList(ActionListModel model)
 {
     CheckUserRole(false);
     if (model.Type == ExportImportType.Import)
     {
         AdminBl.ImportFile(model);
         AdminBl.SetModel(model);
     }
     else
         AdminBl.ExportFile(model);
     if(!string.IsNullOrEmpty(model.Error))
         ModelState.AddModelError(string.Empty,model.Error);
     //AdminBl.SetModel(model);
     ViewBag.Title = "Список " + (model.Type == ExportImportType.Import ? "загрузок" : "выгрузок");
     return View(model);
 }
예제 #3
0
파일: AdminBl.cs 프로젝트: andreyu/Reports
 public void SetModel(ActionListModel model)
 {
     SetModelInternal(model,true);
 }
예제 #4
0
파일: AdminBl.cs 프로젝트: andreyu/Reports
 public void ImportFile(ActionListModel model)
 {
     ImportFileInternal(model);
 }
예제 #5
0
파일: AdminBl.cs 프로젝트: andreyu/Reports
 public void ExportFile(ActionListModel model)
 {
     try
     {
         ExportFileInternal(model);
     }
     finally
     {
         SetModelInternal(model,false);
     }
 }
예제 #6
0
파일: AdminBl.cs 프로젝트: andreyu/Reports
 protected void SetMonths(ActionListModel model,bool setSelection)
 {
     if (model.Type == ExportImportType.Export)
     {
         model.Monthes = TimesheetDao.GetTimesheetDates().ToList().
             ConvertAll(x => new DateDto
             {
                 Date = x,
                 Name =
                     x.ToString("MMMM") + " " +
                     x.Year.ToString(),
             });
         if(setSelection)
             model.Month = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
     }
     else
         model.Monthes = new List<DateDto> { new DateDto {Date = DateTime.Today,Name = string.Empty}};
 }
예제 #7
0
파일: AdminBl.cs 프로젝트: andreyu/Reports
 protected void SetModelInternal(ActionListModel model,bool setSelection)
 {
     model.Actions = ExportImportActionDao.
         LoadForTypeSorted(model.Type).ToList().
         ConvertAll(x => new
             IdNameDto
             (
              x.Id,
              x.Date.ToString()+
              (x.Month.HasValue?" "+GetMonth(x.Month.Value):string.Empty)
             ));
     SetMonths(model, true);
 }