public async Task <ActionResult> Query(RulePrintSetQueryViewModel model) { if (ModelState.IsValid) { using (RulePrintSetServiceClient client = new RulePrintSetServiceClient()) { await Task.Run(() => { StringBuilder where = new StringBuilder(); if (model != null) { where.AppendFormat(" {0} Key.Code = '{1}'" , where.Length > 0 ? "AND" : string.Empty , model.Code); } PagingConfig cfg = new PagingConfig() { OrderBy = "Key", Where = where.ToString() }; MethodReturnResult <IList <RulePrintSet> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_ListPartial")); }
// // GET: /ZPVM/RulePrintSet/ public async Task <ActionResult> Index(string code) { if (string.IsNullOrEmpty(code)) { return(RedirectToAction("Index", "Rule")); } using (RuleServiceClient client = new RuleServiceClient()) { MethodReturnResult <Rule> result = await client.GetAsync(code); if (result.Code > 0 || result.Data == null) { return(RedirectToAction("Index", "Rule")); } ViewBag.Rule = result.Data; } using (RulePrintSetServiceClient client = new RulePrintSetServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { Where = string.Format(" Key.Code = '{0}'" , code), OrderBy = "Key" }; MethodReturnResult <IList <RulePrintSet> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } return(View(new RulePrintSetQueryViewModel() { Code = code })); }
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 (RulePrintSetServiceClient client = new RulePrintSetServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { PageNo = pageNo, PageSize = pageSize, Where = where ?? string.Empty, OrderBy = orderBy ?? string.Empty }; MethodReturnResult <IList <RulePrintSet> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } } return(PartialView("_ListPartial")); }