public ActionResult DeleteProcessingHistory(long id) { var gVal = new GenericValidator(); try { if (id < 1) { gVal.Code = -1; gVal.Error = "Invalid selection"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var delStatus = new ProcessingHistoryServices().DeleteProcessingHistory(id); if (delStatus < 1) { gVal.Code = -1; gVal.Error = "ProcessingHistory could not be deleted. Please try again later."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = 5; gVal.Error = "ProcessingHistory Information was successfully deleted"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetPreviousApplicationJobs(JQueryDataTableParamModel param) { try { IEnumerable <ProcessingHistoryObject> filteredParentMenuObjects; var countG = 0; //get the id of logged in user var userId = User.Identity.GetUserId(); var pagedParentMenuObjects = GetPreviousJobsProfiles(param.iDisplayLength, param.iDisplayStart, out countG, userId); if (!string.IsNullOrEmpty(param.sSearch)) { filteredParentMenuObjects = new ProcessingHistoryServices().Search(param.sSearch); } else { filteredParentMenuObjects = pagedParentMenuObjects; } if (!filteredParentMenuObjects.Any()) { return(Json(new List <ProcessingHistoryObject>(), JsonRequestBehavior.AllowGet)); } var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]); Func <ProcessingHistoryObject, string> orderingFunction = (c => sortColumnIndex == 1 ? c.ReferenceCode : c.ActualDeliveryDateTimeStr); var sortDirection = Request["sSortDir_0"]; // asc or desc filteredParentMenuObjects = sortDirection == "desc" ? filteredParentMenuObjects.OrderBy(orderingFunction) : filteredParentMenuObjects.OrderByDescending(orderingFunction); var displayedPersonnels = filteredParentMenuObjects; var result = from c in displayedPersonnels select new[] { Convert.ToString(c.Id), c.ReferenceCode, c.CompanyName, c.AssignedTimeStr, c.ActualDeliveryDateTimeStr, c.Remarks }; return(Json(new { param.sEcho, iTotalRecords = countG, iTotalDisplayRecords = countG, aaData = result }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(Json(new List <ProcessingHistoryObject>(), JsonRequestBehavior.AllowGet)); } }
public ActionResult EditProcessingHistory(ProcessingHistoryObject processingHistory) { var gVal = new GenericValidator(); try { if (string.IsNullOrEmpty(processingHistory.ReferenceCode.Trim())) { gVal.Code = -1; gVal.Error = "Please provide ProcessingHistory."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } if (Session["_ProcessingHistory"] == null) { gVal.Code = -1; gVal.Error = "Session has timed out."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var oldProcessingHistory = Session["_ProcessingHistory"] as ProcessingHistoryObject; if (oldProcessingHistory == null) { gVal.Code = -1; gVal.Error = "Session has timed out."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } oldProcessingHistory.ReferenceCode = processingHistory.ReferenceCode.Trim(); var docStatus = new ProcessingHistoryServices().UpdateProcessingHistory(oldProcessingHistory); if (docStatus < 1) { gVal.Code = -1; gVal.Error = "ProcessingHistory information could not be updated. Please try again later"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = oldProcessingHistory.Id; gVal.Error = "ProcessingHistory information was successfully updated"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch (Exception) { gVal.Code = -1; gVal.Error = "ProcessingHistory information could not be updated. Please try again later"; return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetProcessingHistory(long id) { try { var processingHistory = new ProcessingHistoryServices().GetProcessingHistory(id); if (processingHistory == null || processingHistory.Id < 1) { return(Json(new ProcessingHistoryObject(), JsonRequestBehavior.AllowGet)); } Session["_ProcessingHistory"] = processingHistory; return(Json(processingHistory, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new ProcessingHistoryObject(), JsonRequestBehavior.AllowGet)); } }
public ActionResult AddProcessingHistory(ProcessingHistoryObject processingHistory) { var gVal = new GenericValidator(); try { var importerInfo = GetLoggedOnUserInfo(); if (importerInfo.Id < 1) { gVal.Error = "Your session has timed out"; gVal.Code = -1; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var validationResult = ValidateProcessingHistory(processingHistory); if (validationResult.Code == 1) { return(Json(validationResult, JsonRequestBehavior.AllowGet)); } var appStatus = new ProcessingHistoryServices().AddProcessingHistory(processingHistory); if (appStatus < 1) { validationResult.Code = -1; validationResult.Error = appStatus == -2 ? "ProcessingHistory upload failed. Please try again." : "The ProcessingHistory Information already exists"; return(Json(validationResult, JsonRequestBehavior.AllowGet)); } gVal.Code = appStatus; gVal.Error = "ProcessingHistory was successfully added."; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch (Exception) { gVal.Error = "ProcessingHistory processingHistorying failed. Please try again later"; gVal.Code = -1; return(Json(gVal, JsonRequestBehavior.AllowGet)); } }