public async Task <ActionResult> SaveModify(CheckSettingViewModel model) { using (CheckSettingServiceClient client = new CheckSettingServiceClient()) { MethodReturnResult <CheckSetting> result = await client.GetAsync(model.Key); if (result.Code == 0) { result.Data.ActionName = model.ActionName; result.Data.EquipmentCode = model.EquipmentCode; result.Data.MaterialCode = model.MaterialCode; result.Data.MaterialType = model.MaterialType; result.Data.ProductionLineCode = model.ProductionLineCode; result.Data.RouteEnterpriseName = model.RouteEnterpriseName; result.Data.RouteName = model.RouteName; result.Data.RouteStepName = model.RouteStepName; result.Data.RouteOperationName = model.RouteOperationName; result.Data.Status = model.Status; result.Data.Description = model.Description; result.Data.Editor = User.Identity.Name; result.Data.EditTime = DateTime.Now; MethodReturnResult rst = await client.ModifyAsync(result.Data); if (rst.Code == 0) { rst.Message = string.Format(QAMResources.StringResource.CheckSetting_SaveModify_Success , model.GroupName); } return(Json(rst)); } return(Json(result)); } }
public async Task <ActionResult> Save(CheckSettingViewModel model) { using (CheckSettingServiceClient client = new CheckSettingServiceClient()) { CheckSetting obj = new CheckSetting() { Key = Convert.ToString(Guid.NewGuid()), GroupName = model.GroupName.ToUpper(), ActionName = model.ActionName, EquipmentCode = model.EquipmentCode, MaterialCode = model.MaterialCode, MaterialType = model.MaterialType, ProductionLineCode = model.ProductionLineCode, RouteEnterpriseName = model.RouteEnterpriseName, RouteName = model.RouteName, RouteOperationName = model.RouteOperationName, RouteStepName = model.RouteStepName, Status = model.Status, Description = model.Description, Editor = User.Identity.Name, EditTime = DateTime.Now, CreateTime = DateTime.Now, Creator = User.Identity.Name }; MethodReturnResult rst = await client.AddAsync(obj); if (rst.Code == 0) { rst.Message = string.Format(QAMResources.StringResource.CheckSetting_Save_Success , model.GroupName); } return(Json(rst)); } }
// // GET: /QAM/CheckSetting/Modify public async Task <ActionResult> Modify(string key) { CheckSettingViewModel viewModel = new CheckSettingViewModel(); using (CheckSettingServiceClient client = new CheckSettingServiceClient()) { MethodReturnResult <CheckSetting> result = await client.GetAsync(key); if (result.Code == 0) { viewModel = new CheckSettingViewModel() { Key = result.Data.Key, ActionName = result.Data.ActionName, GroupName = result.Data.GroupName, RouteStepName = result.Data.RouteStepName, RouteOperationName = result.Data.RouteOperationName, RouteName = result.Data.RouteName, RouteEnterpriseName = result.Data.RouteEnterpriseName, ProductionLineCode = result.Data.ProductionLineCode, MaterialType = result.Data.MaterialType, MaterialCode = result.Data.MaterialCode, EquipmentCode = result.Data.EquipmentCode, Status = result.Data.Status, CreateTime = result.Data.CreateTime, Creator = result.Data.Creator, Description = result.Data.Description, Editor = result.Data.Editor, EditTime = result.Data.EditTime }; return(PartialView("_ModifyPartial", viewModel)); } else { ModelState.AddModelError("", result.Message); } } return(PartialView("_ModifyPartial")); }