Beispiel #1
0
        public ViewResult Create()
        {
            var model = new KPICatalogViewModel();

            //model.DepartmentSelectList = Helpers.SelectListHelper.GetSelectList_BranchDepartment(null);
            return(View(model));
        }
Beispiel #2
0
        public ActionResult Edit(KPICatalogViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (Request["Submit"] == "Save")
                {
                    var KPICatalog = KPICatalogRepository.GetKPICatalogById(model.Id);
                    AutoMapper.Mapper.Map(model, KPICatalog);
                    KPICatalog.ModifiedUserId = WebSecurity.CurrentUserId;
                    KPICatalog.ModifiedDate   = DateTime.Now;
                    KPICatalogRepository.UpdateKPICatalog(KPICatalog);

                    TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.UpdateSuccess;
                    return(RedirectToAction("Index"));
                }

                return(View(model));
            }

            return(View(model));

            //if (Request.UrlReferrer != null)
            //    return Redirect(Request.UrlReferrer.AbsoluteUri);
            //return RedirectToAction("Index");
        }
Beispiel #3
0
        public ActionResult Create(KPICatalogViewModel model)
        {
            if (ModelState.IsValid)
            {
                var KPICatalog = new Domain.Staff.Entities.KPICatalog();
                AutoMapper.Mapper.Map(model, KPICatalog);
                KPICatalog.IsDeleted      = false;
                KPICatalog.CreatedUserId  = WebSecurity.CurrentUserId;
                KPICatalog.ModifiedUserId = WebSecurity.CurrentUserId;
                KPICatalog.CreatedDate    = DateTime.Now;
                KPICatalog.ModifiedDate   = DateTime.Now;
                KPICatalogRepository.InsertKPICatalog(KPICatalog);

                TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess;
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Beispiel #4
0
        public ActionResult Edit(int?Id)
        {
            var KPICatalog = KPICatalogRepository.GetKPICatalogById(Id.Value);

            if (KPICatalog != null && KPICatalog.IsDeleted != true)
            {
                var model = new KPICatalogViewModel();
                AutoMapper.Mapper.Map(KPICatalog, model);

                //if (model.CreatedUserId != Erp.BackOffice.Helpers.Common.CurrentUser.Id && Erp.BackOffice.Helpers.Common.CurrentUser.UserTypeId != 1)
                //{
                //    TempData["FailedMessage"] = "NotOwner";
                //    return RedirectToAction("Index");
                //}
                //model.DepartmentSelectList = Helpers.SelectListHelper.GetSelectList_Department(null);
                return(View(model));
            }
            if (Request.UrlReferrer != null)
            {
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
            return(RedirectToAction("Index"));
        }