public ActionResult CloseJob(JobViewModel jobVM) { Logger.Info(_logMsg.Clear().SetPrefixMsg("Close Job").Add("JobId", jobVM.JobId).ToInputLogString()); try { int userId = this.UserInfo.UserId; _commPoolFacade = new CommPoolFacade(); bool success = _commPoolFacade.UpdateJob(jobVM.JobId, userId, jobVM.JobStatus, string.Empty); if (success) { return(RedirectToAction("Search", "Job")); } ViewBag.ErrorMessage = Resource.Error_UpdateFailedDuplicate; TempData["jobVM"] = jobVM; return(InitEdit()); } catch (Exception ex) { Logger.Error("Exception occur:\n", ex); Logger.Info(_logMsg.Clear().SetPrefixMsg("Close Job").Add("Error Message", ex.Message).ToFailLogString()); return(Error(new HandleErrorInfo(ex, this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString()))); } }
public JsonResult SaveRemarkCloseJob(JobViewModel jobVM) { try { Logger.Info(_logMsg.Clear().SetPrefixMsg("Save RemarkCloseJob").ToInputLogString()); // Validate MaxLength if (!string.IsNullOrWhiteSpace(jobVM.Remark) && jobVM.Remark.Count() > Constants.MaxLength.RemarkCloseJob) { ModelState.AddModelError("Remark", string.Format(CultureInfo.InvariantCulture, Resource.ValErr_StringLength, Resource.Lbl_Remark, Constants.MaxLength.RemarkCloseJob)); } if (ModelState.IsValid) { int userId = this.UserInfo.UserId; _commPoolFacade = new CommPoolFacade(); bool success = _commPoolFacade.UpdateJob(jobVM.JobId, userId, jobVM.JobStatus, jobVM.Remark); if (success) { return(Json(new { Valid = true })); } return(Json(new { Valid = false, Error = Resource.Error_UpdateFailedDuplicate })); } return(Json(new { Valid = false, Error = string.Empty, Errors = GetModelValidationErrors() })); } catch (Exception ex) { Logger.Error("Exception occur:\n", ex); Logger.Info(_logMsg.Clear().SetPrefixMsg("Save RemarkCloseJob").Add("Error Message", ex.Message).ToInputLogString()); return(Json(new { Valid = false, Error = Resource.Error_System, Errors = string.Empty })); } }