Пример #1
0
        public async Task <ActionResult> Query(CheckDataQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (LotQueryServiceClient client = new LotQueryServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            OrderBy = "CreateTime DESC",
                            Where   = GetQueryCondition(model)
                        };
                        MethodReturnResult <IList <LotTransaction> > result = client.GetTransaction(ref cfg);

                        string where = GetQueryCountCondition(model);
                        MethodReturnResult <DataSet> count = client.GetLotCount(where);

                        if (count.Code == 0 && count.Data.Tables[0].Rows.Count > 0)
                        {
                            string qty    = count.Data.Tables[0].Rows[0][0].ToString();
                            ViewBag.count = qty;
                            ViewBag.stime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", model.StartCheckTime);
                            ViewBag.etime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", model.EndCheckTime);
                        }

                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ListPartial", new CheckDataViewModel()));
            }
            else
            {
                return(View("Index", model));
            }
        }