Exemple #1
0
        public ActionResult Create(ProcessStageViewModel model, bool IsPopup)
        {
            if (ModelState.IsValid)
            {
                var ProcessStage = new ProcessStage();
                AutoMapper.Mapper.Map(model, ProcessStage);
                ProcessStage.IsDeleted      = false;
                ProcessStage.CreatedUserId  = WebSecurity.CurrentUserId;
                ProcessStage.ModifiedUserId = WebSecurity.CurrentUserId;
                ProcessStage.AssignedUserId = WebSecurity.CurrentUserId;
                ProcessStage.CreatedDate    = DateTime.Now;
                ProcessStage.ModifiedDate   = DateTime.Now;
                ProcessStageRepository.InsertProcessStage(ProcessStage);

                if (IsPopup)
                {
                    return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" }));
                }
                else
                {
                    TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess;
                    return(RedirectToAction("Index"));
                }
            }
            return(View(model));
        }
Exemple #2
0
        public ActionResult Edit(ProcessStageViewModel model, bool IsPopup)
        {
            if (ModelState.IsValid)
            {
                if (Request["Submit"] == "Save")
                {
                    var ProcessStage = ProcessStageRepository.GetProcessStageById(model.Id);
                    AutoMapper.Mapper.Map(model, ProcessStage);
                    ProcessStage.ModifiedUserId = WebSecurity.CurrentUserId;
                    ProcessStage.ModifiedDate   = DateTime.Now;
                    ProcessStageRepository.UpdateProcessStage(ProcessStage);

                    if (IsPopup)
                    {
                        return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" }));
                    }
                    else
                    {
                        TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess;
                        return(RedirectToAction("Index"));
                    }
                }

                return(View(model));
            }

            return(View(model));

            //if (Request.UrlReferrer != null)
            //    return Redirect(Request.UrlReferrer.AbsoluteUri);
            //return RedirectToAction("Index");
        }
Exemple #3
0
        public ViewResult Create(int ProcessId)
        {
            var model = new ProcessStageViewModel();

            model.ProcessId = ProcessId;

            return(View(model));
        }
Exemple #4
0
        public ActionResult Detail(int?Id)
        {
            var ProcessStage = ProcessStageRepository.GetProcessStageById(Id.Value);

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

                if (model.CreatedUserId != Erp.BackOffice.Helpers.Common.CurrentUser.Id && Erp.BackOffice.Helpers.Common.CurrentUser.UserTypeId != 1)
                {
                    TempData["FailedMessage"] = "NotOwner";
                    return(RedirectToAction("Index"));
                }

                return(View(model));
            }
            if (Request.UrlReferrer != null)
            {
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
            return(RedirectToAction("Index"));
        }