public async Task <ActionResult> SaveModify(PointViewModel model) { using (PointServiceClient client = new PointServiceClient()) { MethodReturnResult <Point> result = await client.GetAsync(model.Key); if (result.Code == 0) { result.Data.ActionName = model.ActionName; result.Data.CategoryName = model.CategoryName; 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.SamplingPlanName = model.SamplingPlanName; 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(EDCResources.StringResource.Point_SaveModify_Success , model.GroupName); } return(Json(rst)); } return(Json(result)); } }
public async Task <ActionResult> Delete(string key) { MethodReturnResult result = new MethodReturnResult(); using (PointServiceClient client = new PointServiceClient()) { result = await client.DeleteAsync(key); if (result.Code == 0) { result.Message = string.Format(EDCResources.StringResource.Point_Delete_Success, key); } return(Json(result)); } }
// // GET: /EDC/Point/Modify public async Task <ActionResult> Modify(string key) { PointViewModel viewModel = new PointViewModel(); using (PointServiceClient client = new PointServiceClient()) { MethodReturnResult <Point> result = await client.GetAsync(key); if (result.Code == 0) { viewModel = new PointViewModel() { Key = result.Data.Key, ActionName = result.Data.ActionName, CategoryName = result.Data.CategoryName, GroupName = result.Data.GroupName, SamplingPlanName = result.Data.SamplingPlanName, 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")); }
// // GET: /EDC/Point/ public async Task <ActionResult> Index() { using (PointServiceClient client = new PointServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { OrderBy = "GroupName" }; MethodReturnResult <IList <Point> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } return(View(new PointQueryViewModel())); }
public ActionResult GetPoint(string groupName) { using (PointServiceClient client = new PointServiceClient()) { PagingConfig cfg = new PagingConfig() { PageNo = 0, PageSize = 1, Where = string.Format("GroupName='{0}'", groupName) }; MethodReturnResult <IList <Point> > result = client.Get(ref cfg); if (result.Code <= 0 && result.Data != null && result.Data.Count > 0) { return(Json(new { ActionName = result.Data[0].ActionName.ToString(), CategoryName = result.Data[0].CategoryName, SamplingPlanName = result.Data[0].SamplingPlanName }, JsonRequestBehavior.AllowGet)); } } return(Json(null, JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> PagingQuery(string where, string orderBy, int?currentPageNo, int?currentPageSize) { if (ModelState.IsValid) { int pageNo = currentPageNo ?? 0; int pageSize = currentPageSize ?? 20; if (Request["PageNo"] != null) { pageNo = Convert.ToInt32(Request["PageNo"]); } if (Request["PageSize"] != null) { pageSize = Convert.ToInt32(Request["PageSize"]); } using (PointServiceClient client = new PointServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { PageNo = pageNo, PageSize = pageSize, Where = where ?? string.Empty, OrderBy = orderBy ?? string.Empty }; MethodReturnResult <IList <Point> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_ListPartial")); }
// // GET: /EDC/PointDetail/ public async Task <ActionResult> Index(string groupName, string pointKey) { using (PointServiceClient client = new PointServiceClient()) { MethodReturnResult <Point> result = await client.GetAsync(pointKey ?? string.Empty); if (result.Code > 0 || result.Data == null) { return(RedirectToAction("Index", "Point")); } ViewBag.Point = result.Data; } using (PointDetailServiceClient client = new PointDetailServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { OrderBy = "ItemNo", Where = string.Format(" Key.PointKey = '{0}'" , pointKey) }; MethodReturnResult <IList <PointDetail> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } return(View(new PointDetailQueryViewModel() { PointKey = pointKey, GroupName = groupName })); }
public async Task <ActionResult> Save(PointViewModel model) { using (PointServiceClient client = new PointServiceClient()) { Point obj = new Point() { Key = Convert.ToString(Guid.NewGuid()), GroupName = model.GroupName.ToUpper(), ActionName = model.ActionName, CategoryName = model.CategoryName, EquipmentCode = model.EquipmentCode, MaterialCode = model.MaterialCode, MaterialType = model.MaterialType, ProductionLineCode = model.ProductionLineCode, RouteEnterpriseName = model.RouteEnterpriseName, RouteName = model.RouteName, RouteOperationName = model.RouteOperationName, RouteStepName = model.RouteStepName, SamplingPlanName = model.SamplingPlanName, 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(EDCResources.StringResource.Point_Save_Success , model.GroupName); } return(Json(rst)); } }
public async Task <ActionResult> Query(PointQueryViewModel model) { if (ModelState.IsValid) { using (PointServiceClient client = new PointServiceClient()) { await Task.Run(() => { StringBuilder where = new StringBuilder(); if (model != null) { if (!string.IsNullOrEmpty(model.GroupName)) { where.AppendFormat(" {0} GroupName LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.GroupName); } if (!string.IsNullOrEmpty(model.MaterialType)) { where.AppendFormat(" {0} MaterialType LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.MaterialType); } if (!string.IsNullOrEmpty(model.MaterialCode)) { where.AppendFormat(" {0} MaterialCode LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.MaterialCode); } if (!string.IsNullOrEmpty(model.RouteEnterpriseName)) { where.AppendFormat(" {0} RouteEnterpriseName LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.RouteEnterpriseName); } if (!string.IsNullOrEmpty(model.RouteName)) { where.AppendFormat(" {0} RouteName LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.RouteName); } if (!string.IsNullOrEmpty(model.RouteStepName)) { where.AppendFormat(" {0} RouteStepName LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.RouteStepName); } if (!string.IsNullOrEmpty(model.RouteOperationName)) { where.AppendFormat(" {0} RouteOperationName LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.RouteOperationName); } if (!string.IsNullOrEmpty(model.ProductionLineCode)) { where.AppendFormat(" {0} ProductionLineCode LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.ProductionLineCode); } if (!string.IsNullOrEmpty(model.EquipmentCode)) { where.AppendFormat(" {0} EquipmentCode LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.EquipmentCode); } if (!string.IsNullOrEmpty(model.CategoryName)) { where.AppendFormat(" {0} CategoryName LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.CategoryName); } if (!string.IsNullOrEmpty(model.SamplingPlanName)) { where.AppendFormat(" {0} SamplingPlanName LIKE '{1}%'" , where.Length > 0 ? "AND" : string.Empty , model.SamplingPlanName); } } PagingConfig cfg = new PagingConfig() { OrderBy = "GroupName", Where = where.ToString() }; MethodReturnResult <IList <Point> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_ListPartial")); }