예제 #1
0
 public ActionResult Edit(StatInfoModel model)
 {
     this.FillModel(model);
     if (this.ViewData.ModelState.IsValid)
     {
         this.Factory.UpdateStatisticInfo(model.StatInfo);
         return RedirectToAction("Index", "Main");
     }
     return View(model);
 }
예제 #2
0
 public ActionResult Edit(int id)
 {
     StatisticInfo info = null;
     if (id > 0)
         info = this.Factory.AllStatistics.FirstOrDefault(item => item.Id.Equals(id));
     if (info == null)
         info = new StatisticInfo();
     StatInfoModel model = new StatInfoModel(info);
     this.FillModel(model);
     return View(model);
 }
예제 #3
0
        private void FillModel(StatInfoModel model)
        {
            StatisticsDBHelper helper = new StatisticsDBHelper();
            helper.AddConnection("2011", ConfigurationManager.ConnectionStrings["KontaktDB2011"].ConnectionString, 2011, true);
            model.FiltersForData = helper.GetFilters(55);
            model.FiltersForData.Insert(0, new Kontakt.DataModel.IdValue() { Id = -1, Value = " --- Vyber hodnotu --- " });
            model.FiltersForOrdered = helper.GetFilters(12);
            model.FiltersForOrdered.Insert(0, new Kontakt.DataModel.IdValue() { Id = -1, Value = " --- Vyber hodnotu --- " });
            model.FiltersForOnStock = helper.GetFilters(20);
            model.FiltersForOnStock.Insert(0, new Kontakt.DataModel.IdValue() { Id = -1, Value = " --- Vyber hodnotu --- " });
            model.AllTemplates = this.GetFileNames(ConfigurationManager.AppSettings["TemplatesDirectory"], "*.xls");
            model.AllUsages = this.GetFileNames(ConfigurationManager.AppSettings["UsagesDirectory"], "*.xml");
            model.AllUsages.Insert(0, "");

            model.StatInfo.FilterForData = this.FillValue(model.FiltersForData, model.StatInfo.FilterForDataId);
            model.StatInfo.FilterForOnStock = this.FillValue(model.FiltersForOnStock, model.StatInfo.FilterForOnStockId);
            model.StatInfo.FilterForOrdered = this.FillValue(model.FiltersForOrdered, model.StatInfo.FilterForOrderedId);
        }