예제 #1
0
        public ActionResult CustomerDetailList()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 0);
            string storageNum = this.DefaultStore;

            CustomerProvider provider = new CustomerProvider();
            CustomerEntity entity = new CustomerEntity();
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            List<CustomerEntity> listResult = provider.GetCustomerList(entity, ref pageInfo);
            listResult = listResult.IsNull() ? new List<CustomerEntity>() : listResult;
            OutStorageProvider outProvider = new OutStorageProvider();
            foreach (CustomerEntity item in listResult)
            {
                item.Num = outProvider.GetNumByCusNum(item.CusNum, queryTime, storageNum);
            }
            string json = ConvertJson.ListToJson<CustomerEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
예제 #2
0
        public ActionResult GetCustomerList()
        {
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 1);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 15);
            string CusNum = WebUtil.GetFormValue<string>("CusNum", string.Empty);
            int CusType = WebUtil.GetFormValue<int>("CusType", 0);

            CustomerProvider provider = new CustomerProvider();
            CustomerEntity entity = new CustomerEntity();
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            if (!CusNum.IsEmpty())
            {
                entity.Begin<CustomerEntity>()
                   .Where<CustomerEntity>("CusNum", ECondition.Like, "%" + CusNum + "%")
                   .Or<CustomerEntity>("CusName", ECondition.Like, "%" + CusNum + "%")
                   .End<CustomerEntity>();
            }
            if (CusType != 0)
            {
                entity.Where<CustomerEntity>(a => a.CusType == CusType);
            }

            List<CustomerEntity> listResult = provider.GetCustomerList(entity, ref pageInfo);
            string json = ConvertJson.ListToJson<CustomerEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }