Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["Next"] != null)
                {
                }
                if (Request.QueryString["PageNo"] != null)
                {
                    int page = Convert.ToInt32(Request.QueryString["PageNo"]);
                    PageNo = Math.Max(page, 1);
                }
                else
                {
                    PageNo = 1;
                }
                if (Request.QueryString["Next"] != null)
                {
                    bool?next = Convert.ToBoolean(Request.QueryString["Next"]);
                    PageNo = next.Value ? PageNo + 1 : Math.Max(1, PageNo - 1);
                }
                Page1 = (Math.Max(PageNo, 1) - 1) / PageListNumber * PageListNumber + 1;
            }
            else
            {
                Page1 = 1;
            }
            string json = _serviceClient.GetPrimarySchoolCount();

            if (json.JObjCodeTrue() && json.JobjMessageConvert <int>() > 0)
            {
                TotalCount = json.JobjMessageConvert <int>();
                TotalPage  = TotalCount / PageSize + (TotalCount % PageSize == 0 ? 0 : 1);
                json       = _serviceClient.GetPrimarySchool(PageNo, PageSize);
                if (json.JObjCodeTrue())
                {
                    var source = from it in json.JObjMessageToken()
                                 select new
                    {
                        Name         = it["Name"].ValueOrDefault <string>(),
                        Address      = it["Address"].ValueOrDefault <string>(),
                        Type         = it["Type"].ValueOrDefault <string>(),
                        WorkTime     = it["WorkTime"].ValueOrDefault <string>(),
                        TelContacts  = it["TelContacts"].ValueOrDefault <string>(),
                        ComplaintTel = it["ComplaintTel"].ValueOrDefault <string>(),
                        Seat         = it["Seat"].ValueOrDefault <string>(),
                        WebSite      = it["WebSite"].ValueOrDefault <string>(),
                        Introduction = it["Introduction"].ValueOrDefault <string>(),
                    };

                    RepeaterPrimary.DataSource = source;
                    RepeaterPrimary.DataBind();
                }
            }
            Page.ClientScript.RegisterStartupScript(GetType(), "pageNoSelector",
                                                    "<script language='javascript'>pageNoSelector(" + PageNo + "," + TotalPage +
                                                    ");</script>");
        }
Exemplo n.º 2
0
        private void SchoolBinding()
        {
            string json = _openDataServiceClient.GetPrimarySchoolCount();

            if (json.JObjCodeTrue() && json.JobjMessageConvert <int>() > 0)
            {
                json = _openDataServiceClient.GetPrimarySchool(1, 5);
                RepeaterScholl.DataSource = from item in json.JObjMessageToken()
                                            select new
                {
                    Name    = item["Name"].ValueOrDefault <string>(),
                    Address = item["Address"].ValueOrDefault <string>(),
                    Type    = item["Type"].ValueOrDefault <string>(),
                };
                RepeaterScholl.DataBind();
            }
        }