Exemplo n.º 1
0
        public ActionResult UpdateAssignWorkShift(DataSourceLoadOptions loadOptions, string value)
        {
            try
            {
                var updateAssignWorkShift = new AssignWorkShiftViewModel();
                JsonConvert.PopulateObject(value, updateAssignWorkShift);

                ValidateModel(updateAssignWorkShift);
                if (!ModelState.IsValid)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, ModelState.ToString()));
                }

                updateAssignWorkShift.UpdateBy = UserDetail.UserID;
                UpdateWorkShiftByEmpResult result = MasterService.UpdateAssignWorkShiftByEmp(updateAssignWorkShift.ToEntity());

                return(Content(JsonConvert.SerializeObject(GetMsgFromUpdateActionResult(result)), ConstantValues.JSON_CONTENT_TYPE));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public UpdateWorkShiftByEmpResult GetMsgFromUpdateActionResult(UpdateWorkShiftByEmpResult result)
        {
            try
            {
                if (result.ErrorCode == "0")
                {
                    result.ErrorMessage = MessageListResource.I0001;
                }
                else if (result.ErrorCode == "1")
                {
                    result.ErrorMessage = String.Format(MessageListResource.E0005, "Assign Work Shift");
                }
                else if (result.ErrorCode == "9")
                {
                    result.ErrorMessage = String.Format(MessageListResource.E0003, "update", result.ErrorMessage);
                }

                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }