Esempio n. 1
0
        public ActionResult WorkRequestAssignment(WorkRequestAssignmentModel objWorkRequestAssignmentModel)
        {
            eTracLoginModel            objeTracLoginModel             = (eTracLoginModel)(Session["eTrac"]);
            WorkRequestAssignmentModel _objWorkRequestAssignmentModel = new WorkRequestAssignmentModel();
            string msg = string.Empty;

            try
            {
                CommonHelper ObjCommonHelper = new CommonHelper();
                if (objWorkRequestAssignmentModel.WorkRequestAssignmentID == 0)
                {
                    objWorkRequestAssignmentModel.CreatedBy         = objeTracLoginModel.UserId;
                    objWorkRequestAssignmentModel.CreatedDate       = DateTime.UtcNow;
                    objWorkRequestAssignmentModel.RequestBy         = objeTracLoginModel.UserId;
                    objWorkRequestAssignmentModel.WorkRequestStatus = 14;
                }
                else
                {
                    objWorkRequestAssignmentModel.ModifiedBy   = objeTracLoginModel.UserId;
                    objWorkRequestAssignmentModel.ModifiedDate = DateTime.UtcNow;
                }

                _objWorkRequestAssignmentModel = _IGlobalAdmin.SaveWorkRequestAssignment(objWorkRequestAssignmentModel);
                if (objWorkRequestAssignmentModel.WorkRequestImg != null)
                {
                    WorkRequestImagepath = Server.MapPath(WorkRequestImagepath);
                    ObjCommonHelper.UploadImage(objWorkRequestAssignmentModel.WorkRequestImg, WorkRequestImagepath, objWorkRequestAssignmentModel.WorkRequestImg.FileName);
                }
                if (_objWorkRequestAssignmentModel.Result == Result.Completed)
                {
                    ViewBag.Message           = CommonMessage.SaveSuccessMessage();
                    ViewBag.AlertMessageClass = ObjAlertMessageClass.Success;
                }
                else if (_objWorkRequestAssignmentModel.Result == Result.DuplicateRecord)
                {
                    ViewBag.Message           = CommonMessage.DuplicateRecordMessage();
                    ViewBag.AlertMessageClass = ObjAlertMessageClass.Info; // store the message for successful in tempdata to display in view.
                }
                else if (_objWorkRequestAssignmentModel.Result == Result.UpdatedSuccessfully)
                {
                    ViewBag.Message           = CommonMessage.UpdateSuccessMessage();
                    ViewBag.AlertMessageClass = ObjAlertMessageClass.Success;// store the message for successful in tempdata to display in view.
                }
                else
                {
                    ViewBag.Message           = CommonMessage.FailureMessage();
                    ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger;// store the failure message in tempdata to display in view.
                }
                return(View("WorkRequestAssignment", _objWorkRequestAssignmentModel));
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                ViewBag.AssignToUser             = _IGlobalAdmin.GetLocationEmployee(objeTracLoginModel.LocationID);
                ViewBag.Asset                    = _ICommonMethod.GetAssetList(objeTracLoginModel.LocationID);
                ViewBag.Location                 = _ICommonMethod.GetAllLocation();
                ViewBag.PriorityLevel            = _ICommonMethod.GetGlobalCodeData("WORKPRIORITY");
                ViewBag.WorkRequestType          = _ICommonMethod.GetGlobalCodeData("WORKREQUESTTYPE");
                ViewBag.WorkRequestProjectTypeID = _ICommonMethod.GetGlobalCodeData("WORKREQUESTPROJECTTYPE");
            }
        }