示例#1
0
        public void GetWXStores()
        {
            int available_state_pass = 3;
            int num  = 0;
            int num2 = 50;
            List <GetStoreList_Business> list    = new List <GetStoreList_Business>();
            GetStoreListResultJson       poiList = WXStoreHelper.GetPoiList(num, num2);

            while (poiList.business_list.Count > 0)
            {
                list.AddRange(poiList.business_list);
                num    += num2;
                poiList = WXStoreHelper.GetPoiList(num, num2);
            }
            list = (from c in list
                    where c.base_info.available_state == available_state_pass
                    select c).ToList();
            list.Insert(0, new GetStoreList_Business
            {
                base_info = new GetStoreList_BaseInfo
                {
                    business_name = "请选择",
                    poi_id        = decimal.Zero.ToString()
                }
            });
            this.ddlStores.DataTextField  = "DataTextField";
            this.ddlStores.DataValueField = "DataValueField";
            this.ddlStores.DataSource     = (from c in list
                                             select new
            {
                DataTextField = ((c.base_info.poi_id == decimal.Zero.ToString()) ? c.base_info.business_name : (string.IsNullOrEmpty(c.base_info.branch_name) ? c.base_info.business_name : $"{c.base_info.business_name}({c.base_info.branch_name})")),
                DataValueField = c.base_info.poi_id
            }).ToList();
            this.ddlStores.DataBind();
        }