Esempio n. 1
0
        private void MarketBinding()
        {
            string json = _openDataServiceClient.GetMarketCount();

            if (json.JObjCodeTrue() && json.JobjMessageConvert <int>() > 0)
            {
                json = _openDataServiceClient.GetMarket(1, 5);
                RepeaterMarket.DataSource = from item in json.JObjMessageToken()
                                            select new
                {
                    Name    = item["Name"].ValueOrDefault <string>(),
                    Address = item["Address"].ValueOrDefault <string>(),
                    //Type = item["Type"].ValueOrDefault<string>(),
                };
                RepeaterMarket.DataBind();
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PageNo = Convert.ToInt32(Request.QueryString["PageNo"]);
                PageNo = Math.Max(PageNo, 1);
                var json = _serviceClient.GetMarketCount();

                if (json.JObjCodeTrue())
                {
                    TotalCount = json.JobjMessageConvert <int>();
                    if (TotalCount > 0)
                    {
                        json = _serviceClient.GetMarket(PageNo, PageSize);
                        if (json.JObjCodeTrue())
                        {
                            RepeaterMarket.DataSource = from item in json.JObjMessageToken()
                                                        select new
                            {
                                Name    = item["Name"].ValueOrDefault <string>(),
                                Range   = item["Range"].ValueOrDefault <string>(),
                                Address = item["Address"].ValueOrDefault <string>(),
                                Id      = item["Id"].ValueOrDefault <string>(),
                                Type    = item["Type"].ValueOrDefault <string>(),
                            };
                        }
                    }
                }
            }
            TotalPage = TotalCount / PageSize + (TotalCount % PageSize == 0 ? 0 : 1);
            Page1     = (Math.Max(PageNo, 1) - 1) / PageListNumber * PageListNumber + 1;
            RepeaterMarket.DataBind();

            Page.ClientScript.RegisterStartupScript(GetType(), "pageNoSelector",
                                                    "<script language='javascript'>pageNoSelector(" + PageNo + "," + TotalPage + ");</script>");
        }