예제 #1
0
        public ActionResult Create()
        {
            SuctionModeDetailView suctionModeDetailView = new SuctionModeDetailView();

            suctionModeDetailView.EmployeeView = GetEmployee();

            #region Access Check
            bool hasPermission = GetEmployee().IsGuaranteed("SuctionMode_Insert");
            if (!hasPermission)
            {
                ModelState.AddModelError("", "AccessDenied");
                return(View(suctionModeDetailView));
            }
            #endregion

            return(View(suctionModeDetailView));
        }
예제 #2
0
        public ActionResult Edit(string id, SuctionModeDetailView suctionModeDetailView)
        {
            #region Access Check
            bool hasPermission = GetEmployee().IsGuaranteed("SuctionMode_Update");
            if (!hasPermission)
            {
                ModelState.AddModelError("", "AccessDenied");
                return(View(suctionModeDetailView));
            }
            #endregion

            if (ModelState.IsValid)
            {
                try
                {
                    EditSuctionModeRequestOld request = new EditSuctionModeRequestOld();

                    request.ID = Guid.Parse(id);
                    request.ModifiedEmployeeID = GetEmployee().ID;
                    request.SuctionModeName    = suctionModeDetailView.SuctionModeView.SuctionModeName;
                    request.RowVersion         = suctionModeDetailView.SuctionModeView.RowVersion;

                    GeneralResponse response = this._suctionModeService.EditSuctionMode(request);

                    if (response.success)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        foreach (string error in response.ErrorMessages)
                        {
                            ModelState.AddModelError("", error);
                        }
                        return(View(suctionModeDetailView));
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                    return(View(suctionModeDetailView));
                }
            }

            return(View(suctionModeDetailView));
        }
예제 #3
0
        public ActionResult Create(SuctionModeDetailView suctionModeDetailView)
        {
            suctionModeDetailView.EmployeeView = GetEmployee();

            #region Access Check
            bool hasPermission = GetEmployee().IsGuaranteed("SuctionMode_Insert");
            if (!hasPermission)
            {
                ModelState.AddModelError("", "AccessDenied");
                return(View(suctionModeDetailView));
            }
            #endregion

            if (ModelState.IsValid)
            {
                try
                {
                    AddSuctionModeRequestOld request = new AddSuctionModeRequestOld();
                    request.CreateEmployeeID = GetEmployee().ID;
                    request.SuctionModeName  = suctionModeDetailView.SuctionModeView.SuctionModeName;

                    GeneralResponse response = this._suctionModeService.AddSuctionMode(request);

                    if (response.success)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        foreach (string error in response.ErrorMessages)
                        {
                            ModelState.AddModelError("", error);
                        }
                        return(View(suctionModeDetailView));
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                    return(View(suctionModeDetailView));
                }
            }

            return(View(suctionModeDetailView));
        }
예제 #4
0
        public ActionResult Delete(string id)
        {
            SuctionModeDetailView suctionModeDetailView = new SuctionModeDetailView();

            suctionModeDetailView.EmployeeView = GetEmployee();

            #region Access Check
            bool hasPermission = GetEmployee().IsGuaranteed("SuctionMode_Delete");
            if (!hasPermission)
            {
                ModelState.AddModelError("", "AccessDenied");
                return(View(suctionModeDetailView));
            }
            #endregion

            suctionModeDetailView.SuctionModeView = this.GetSuctionModeView(id);

            return(View(suctionModeDetailView));
        }
예제 #5
0
        public ActionResult Delete(string id, FormCollection collection)
        {
            SuctionModeDetailView suctionModeDetailView = new SuctionModeDetailView();


            #region Access Check
            bool hasPermission = GetEmployee().IsGuaranteed("SuctionMode_Delete");
            if (!hasPermission)
            {
                ModelState.AddModelError("", "AccessDenied");
                return(View(suctionModeDetailView));
            }
            #endregion


            suctionModeDetailView.SuctionModeView = this.GetSuctionModeView(id);
            //suctionModeDetailView.EmployeeView = GetEmployee();

            DeleteRequest request = new DeleteRequest()
            {
                ID = Guid.Parse(id)
            };

            GeneralResponse response = this._suctionModeService.DeleteSuctionMode(request);

            if (response.success)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (string error in response.ErrorMessages)
                {
                    ModelState.AddModelError("", error);
                }
                return(View(suctionModeDetailView));
            }
        }