示例#1
0
 public ActionResult Create()
 {
     var viewModel = new CreateKpiViewModel();
     viewModel = CreateViewModel(viewModel);
     viewModel.Icons = Directory.EnumerateFiles(Server.MapPath(PathConstant.KpiPath)).ToList();
     return View(viewModel);
 }
示例#2
0
 public CreateKpiViewModel CreateViewModel(CreateKpiViewModel viewModel)
 {
     viewModel.LevelList = _dropdownService.GetLevels().MapTo<SelectListItem>();
     viewModel.PillarList = _dropdownService.GetPillars().MapTo<SelectListItem>();
     viewModel.RoleGroupList = _dropdownService.GetRoleGroups().MapTo<SelectListItem>();
     viewModel.TypeList = _dropdownService.GetTypes().MapTo<SelectListItem>();
     viewModel.GroupList = _dropdownService.GetGroups().MapTo<SelectListItem>();
     viewModel.YtdFormulaList = _dropdownService.GetYtdFormulas().MapTo<SelectListItem>();
     viewModel.PeriodeList = _dropdownService.GetPeriodeTypes().MapTo<SelectListItem>();
     viewModel.MethodList = _dropdownService.GetMethods().MapTo<SelectListItem>();
     viewModel.MeasurementList = _dropdownService.GetMeasurement().MapTo<SelectListItem>();
     viewModel.KpiList = _dropdownService.GetKpis().MapTo<SelectListItem>();
     var ytd = Enum.GetValues(typeof(DSLNG.PEAR.Data.Enums.YtdFormula)).Cast<DSLNG.PEAR.Data.Enums.YtdFormula>();
     var periode = Enum.GetValues(typeof(DSLNG.PEAR.Data.Enums.PeriodeType)).Cast<DSLNG.PEAR.Data.Enums.PeriodeType>();
     viewModel.YtdFormulaList = ytd.Select(x => new SelectListItem { Text = x.ToString(), Value = x.ToString() }).ToList();
     viewModel.PeriodeList = periode.Select(x => new SelectListItem { Text = x.ToString(), Value = x.ToString() }).ToList();
     return viewModel;
 }
示例#3
0
 public ActionResult Create(CreateKpiViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         viewModel.Code = string.Format("{0}{1}{2}{3}", viewModel.CodeFromPillar, viewModel.CodeFromLevel, viewModel.Code, viewModel.CodeFromRoleGroup);
         viewModel.YtdFormula = (DSLNG.PEAR.Web.ViewModels.Kpi.YtdFormula)Enum.Parse(typeof(DSLNG.PEAR.Data.Enums.YtdFormula), viewModel.YtdFormulaValue);
         viewModel.Periode = (DSLNG.PEAR.Web.ViewModels.Kpi.PeriodeType)Enum.Parse(typeof(DSLNG.PEAR.Data.Enums.PeriodeType), viewModel.PeriodeValue);
         var request = viewModel.MapTo<CreateKpiRequest>();
         var response = _kpiService.Create(request);
         TempData["IsSuccess"] = response.IsSuccess;
         TempData["Message"] = response.Message;
         if (response.IsSuccess)
         {
             return RedirectToAction("Index");
         }
     }
     viewModel = CreateViewModel(viewModel);
     return View("Create", viewModel);
 }
示例#4
0
 public ActionResult Create()
 {
     var viewModel = new CreateKpiViewModel();
     viewModel = CreateViewModel(viewModel);
     return View(viewModel);
 }