Example #1
0
        private void PostBinding()
        {
            string json = _smartHsServiceClient.GetPostCount();

            if (json.JObjCodeTrue() && json.JobjMessageConvert <int>() > 0)
            {
                json = _smartHsServiceClient.GetPostTitlesByPage(1, 5);
                RepeaterPost.DataSource = from item in json.JObjMessageToken()
                                          select new
                {
                    Title =
                        new string(
                            item["Title"].ValueOrDefault <string>().ToCharArray().Take(24)
                            .ToArray()),
                    Keyword     = item["Keyword"].ValueOrDefault <string>(),
                    Id          = item["Id"].ValueOrDefault <string>(),
                    ReleaseTime = item["ReleaseTime"].ValueOrDefault <string>(),
                    DateSpan    = item["DateSpan"].ValueOrDefault <string>(),
                };
            }
            RepeaterPost.DataBind();
            FoodPriceBinding();
            SchoolBinding();
            KindergartenBinding();
            BankBinding();
            MarketBinding();
            TripInfoBinding();
            FoodInfoBinding();
            FavorableBinding();
            EducationBinding();
            HealthBinding();
        }
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.GetPostCount();

                if (json.JObjCodeTrue())
                {
                    TotalCount = json.JobjMessageConvert <int>();
                    if (TotalCount > 0)
                    {
                        json = _serviceClient.GetPostsByPage(PageNo, PageSize);
                        if (json.JObjCodeTrue())
                        {
                            RepeaterInteract.DataSource = from item in json.JObjMessageToken()
                                                          select new
                            {
                                Title       = item["Title"].ValueOrDefault <string>(),
                                Keyword     = new string(item["Keyword"].ValueOrDefault <string>().ToCharArray().Take(10).ToArray()),
                                Contact     = item["Contact"].ValueOrDefault <string>(),
                                Id          = item["Id"].ValueOrDefault <string>(),
                                ReleaseTime = item["ReleaseTime"].ValueOrDefault <string>(),
                                Content     = item["Content"].ValueOrDefault <string>(),
                                Member      = item["Member"].ValueOrDefault <string>(),
                                DateSpan    = item["DateSpan"].ValueOrDefault <string>(),
                            };
                        }
                    }
                }
            }
            TotalPage = TotalCount / PageSize + (TotalCount % PageSize == 0 ? 0 : 1);
            Page1     = (Math.Max(PageNo, 1) - 1) / PageListNumber * PageListNumber + 1;
            RepeaterInteract.DataBind();

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