// // 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")); }
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")); }