public ActionResult WO_Update([DataSourceRequest] DataSourceRequest request, WOViewModel WOVM, FormCollection formCol) { if (WOVM != null && ModelState.IsValid) { var wo = _woTasks.One(WOVM.WOID); if (wo != null) { ConvertToWO(WOVM, wo, formCol); wo.ModifiedDate = DateTime.Now; wo.ModifiedBy = User.Identity.Name; wo.DataStatus = "Updated"; _woTasks.Update(wo); } } return(Json(ModelState.ToDataSourceResult())); }
public ActionResult WO_Update([DataSourceRequest] DataSourceRequest request, WOViewModel WOVM, FormCollection formCol) { if (WOVM != null && ModelState.IsValid) { var wo = _woTasks.One(WOVM.WOID); if (wo != null) { //get customer id from form collection, customerVM not catch the customer id :( ConvertToWO(WOVM, wo, formCol["HiddenCustomerId"]); wo.ModifiedDate = DateTime.Now; wo.ModifiedBy = User.Identity.Name; wo.DataStatus = "Updated"; _woTasks.Update(wo); } } return(Json(ModelState.ToDataSourceResult())); }
public ActionResult ChangeStatus([DataSourceRequest] DataSourceRequest request, RequestWOSPartViewModel WOVM, FormCollection formCol) { if (WOVM != null && ModelState.IsValid) { TWOSPart woSPart = _woSPartTasks.One(WOVM.WOSPartId); if (woSPart != null) { woSPart.WOSPartStatus = WOVM.WOSPartStatus; if (WOVM.WOSPartStatus == EnumWOSPartStatus.Serah_Terima_dan_Gunakan.ToString()) { woSPart.WOSPartDateReceived = WOVM.WOSPartDateReceived; woSPart.WOSPartReceivedBy = string.IsNullOrEmpty(WOVM.WOSPartReceivedBy) ? null : _empTasks.One(WOVM.WOSPartReceivedBy); } else if (WOVM.WOSPartStatus == EnumWOSPartStatus.Retur.ToString()) { woSPart.WOSPartDateReturn = WOVM.WOSPartDateReceived; woSPart.WOSPartReturnBy = string.IsNullOrEmpty(WOVM.WOSPartReceivedBy) ? null : _empTasks.One(WOVM.WOSPartReceivedBy); } woSPart.ModifiedDate = DateTime.Now; woSPart.ModifiedBy = User.Identity.Name; woSPart.DataStatus = "Updated"; _woSPartTasks.Update(woSPart); //update wo spare part total TWO wo = woSPart.WOId; if (wo != null) { wo.WOSPartTotal = wo.WOSPartTotal + woSPart.WOSPartTotal; wo.WOTotal = wo.WOServiceFee + wo.WOSPartTotal; wo.ModifiedDate = DateTime.Now; wo.ModifiedBy = User.Identity.Name; wo.DataStatus = "Updated"; _woTasks.Update(wo); } } } return(Json(new[] { WOVM }.ToDataSourceResult(request, ModelState))); }