Example #1
0
        private void BankBinding()
        {
            string json = _openDataServiceClient.GetBankLocationCount();

            if (json.JObjCodeTrue() && json.JobjMessageConvert <int>() > 0)
            {
                json = _openDataServiceClient.GetBankLocation(1, 5);
                RepeaterBank.DataSource = from item in json.JObjMessageToken()
                                          select new
                {
                    Name    = new string(item["Name"].ValueOrDefault <string>().ToCharArray().Take(34).ToArray()),
                    Address = item["Address"].ValueOrDefault <string>(),
                    //Type = item["Type"].ValueOrDefault<string>(),
                };
                RepeaterBank.DataBind();
            }
        }
Example #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.GetBankLocationCount();

                if (json.JObjCodeTrue())
                {
                    TotalCount = json.JobjMessageConvert <int>();
                    if (TotalCount > 0)
                    {
                        json = _serviceClient.GetBankLocation(PageNo, PageSize);
                        if (json.JObjCodeTrue())
                        {
                            Repeater1.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"],
                                Type    = item["Type"].ValueOrDefault <string>(),
                            };
                        }
                    }
                }
            }
            TotalPage = TotalCount / PageSize + (TotalCount % PageSize == 0 ? 0 : 1);
            Page1     = (Math.Max(PageNo, 1) - 1) / PageListNumber * PageListNumber + 1;
            Repeater1.DataBind();

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