Пример #1
0
        public ActionResult Add()
        {
            Session[CacheKey.JOOSHOW_CUSADDRESS_CACHE] = null;
            string CusNum = WebUtil.GetQueryStringValue<string>("CusNum", string.Empty);
            if (CusNum.IsEmpty())
            {
                ViewBag.Customer = new CustomerEntity();
                ViewBag.DdlCusType = EnumHelper.GetOptions<ECusType>("","请选择客户类别");
                return View();
            }
            else
            {
                CustomerProvider provider = new CustomerProvider();
                CustomerEntity entity = provider.GetSingleCustomer(CusNum);
                entity = entity == null ? new CustomerEntity() : entity;
                ViewBag.DdlCusType = EnumHelper.GetOptions<ECusType>(entity.CusType, "请选择客户类别");
                ViewBag.Customer = entity;

                List<CusAddressEntity> listResult = provider.GetAddressList(entity.CusNum);
                if (!listResult.IsNullOrEmpty())
                {
                    Session[CacheKey.JOOSHOW_CUSADDRESS_CACHE] = listResult;
                }
                return View();
            }
        }
Пример #2
0
        public ActionResult CustomerReportTOP10()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            int pageIndex = 1;
            int pageSize = 10;
            string storageNum = this.DefaultStore;

            OutStorageProvider provider = new OutStorageProvider();
            OutStorageEntity entity = new OutStorageEntity();
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };

            List<OutStorageEntity> listResult = provider.GetListTOP10(queryTime, storageNum);
            listResult = listResult.IsNull() ? new List<OutStorageEntity>() : listResult;
            CustomerProvider cusProvider = new CustomerProvider();
            foreach (OutStorageEntity item in listResult)
            {
                CustomerEntity tempItem = cusProvider.GetSingleCustomer(item.CusNum);
                item.CusName = tempItem.CusName;
                item.CusType = tempItem.CusType;
            }
            /*******************************************订单数量排名前十的客户饼图数据****************************************************/
            StringBuilder sb = new StringBuilder();
            sb.Append("<pie>");
            listResult.ForEach(a =>
            {
                if (a.Num > 0)
                {
                    sb.AppendFormat("<slice title=\"{0}\">{1}</slice>", a.CusName, a.Num.ToString());
                }
            });
            sb.Append("</pie>");
            this.ReturnJson.AddProperty("InStorageData", sb.ToString());
            string json = ConvertJson.ListToJson<OutStorageEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }