Example #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);
 }
Example #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);
 }
Example #3
0
 public void SetModel(ActionListModel model)
 {
     SetModelInternal(model,true);
 }
Example #4
0
 public void ImportFile(ActionListModel model)
 {
     ImportFileInternal(model);
 }
Example #5
0
 public void ExportFile(ActionListModel model)
 {
     try
     {
         ExportFileInternal(model);
     }
     finally
     {
         SetModelInternal(model,false);
     }
 }
Example #6
0
 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}};
 }
Example #7
0
 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);
 }