コード例 #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();
        }
コード例 #2
0
        public List <GetStoreList_BaseInfo> GetPoiList()
        {
            GetStoreListResultJson poiList = Senparc.Weixin.MP.AdvancedAPIs.PoiApi.GetPoiList(_accessToken, 0, 50, 10000);

            if (poiList.errcode != ReturnCode.请求成功)
            {
                throw new Exception(poiList.errmsg);
            }
            return((
                       from l in poiList.business_list
                       select l.base_info).ToList());
        }
コード例 #3
0
ファイル: PoiController.cs プロジェクト: Shikyoh/HSWB2B2C
        public ActionResult List(int page, int rows)
        {
            GetStoreListResultJson       poiList = _poiService.GetPoiList(page, rows);
            List <GetStoreList_BaseInfo> list    = (
                from l in poiList.business_list
                select l.base_info).ToList();
            DataGridModel <GetStoreList_BaseInfo> dataGridModel = new DataGridModel <GetStoreList_BaseInfo>()
            {
                rows  = list,
                total = int.Parse(poiList.total_count)
            };

            return(Json(dataGridModel));
        }
コード例 #4
0
        public GetStoreListResultJson GetPoiList(int page, int rows)
        {
            int num = 0;

            if (page > 1)
            {
                num = (page - 1) * rows;
            }
            GetStoreListResultJson poiList = Senparc.Weixin.MP.AdvancedAPIs.PoiApi.GetPoiList(_accessToken, num, rows, 10000);

            if (poiList.errcode != ReturnCode.请求成功 && poiList.errcode != ReturnCode.api功能未授权)
            {
                throw new Exception(poiList.errmsg);
            }
            return(poiList);
        }
コード例 #5
0
        public static List <Store> GetAllPoiList()
        {
            int                    num           = 0;
            int                    num2          = 20;
            List <Store>           business_list = new List <Store>();
            GetStoreListResultJson poiList       = PoiApi.GetPoiList(WXStoreHelper.siteSettings.WeixinAppId, num, num2, 10000);

            while (poiList.business_list.Count > 0)
            {
                poiList.business_list.ForEach(delegate(GetStoreList_Business c)
                {
                    business_list.Add(c);
                });
                num    += num2;
                poiList = PoiApi.GetPoiList(WXStoreHelper.siteSettings.WeixinAppId, num, num2, 10000);
            }
            return(business_list);
        }