示例#1
0
        private void RefreshRepeater(DataTable list)
        {
            var dt = list;

            _pgsource.DataSource  = dt.DefaultView;
            _pgsource.AllowPaging = true;
            // Number of items to be displayed in the Repeater
            _pgsource.PageSize         = _pageSize;
            _pgsource.CurrentPageIndex = CurrentPage;
            // Keep the Total pages in View State
            ViewState["TotalPages"] = _pgsource.PageCount;
            // Example: "Page 1 of 10"
            lblpage.Text = "Page " + (CurrentPage + 1) + " of " + _pgsource.PageCount;
            // Enable First, Last, Previous, Next buttons
            lbPrevious.Enabled = !_pgsource.IsFirstPage;
            lbNext.Enabled     = !_pgsource.IsLastPage;
            lbFirst.Enabled    = !_pgsource.IsFirstPage;
            lbLast.Enabled     = !_pgsource.IsLastPage;

            PostRepeater.DataSource = _pgsource;
            PostRepeater.DataBind();
            HandlePaging();
            int count = 0;

            foreach (var item in dt.DefaultView)
            {
                count++;
            }
            LblCategory.Text = "Results : " + count;
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string userId = Request.UserHostAddress;

            using (UoW.Create())
            {
                IList <PostProjection> posts = GetPosts(userId);
                PostRepeater.DataSource = posts;
                PostRepeater.DataBind();
            }
        }
示例#3
0
        protected void Publicate_Click(object sender, EventArgs e)
        {
            Repository repository   = (Repository)Application["repository"];
            Guid       id           = repository.GetAccountId(User.Identity.Name);
            Account    usersAccount = repository.GetAccount(id);

            usersAccount.AddPost(InputPost.Text);
            Application["repository"] = repository;
            InputPost.Text            = "";

            usersAccount.Posts.Reverse();

            PostRepeater.DataSource = usersAccount.Posts
                                      .OrderByDescending(po => po.PublicationTime);
            PostRepeater.DataBind();
        }
示例#4
0
 private void RefreshRepeater(List <PostComment> list)
 {
     PostRepeater.DataSource = list;
     PostRepeater.DataBind();
 }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Request.IsAuthenticated)
            {
                FormsAuthentication.RedirectToLoginPage();
                return;
            }

            if (IsPostBack)
            {
                return;
            }

            var requestedPageId = Request.QueryString["id"];

            Repository repository = (Repository)Application["repository"];

            this.accountId.Value = requestedPageId;
            string userNickName = User.Identity.Name;
            var    userId       = repository.GetAccountId(userNickName);

            Guid accountId;

            Guid.TryParse(requestedPageId, out accountId);
            Account currentAccount = null;

            if (!repository.IsAccountExists(accountId))
            {
                Response.Redirect("PageNotFound.html", true);
            }
            else
            {
                currentAccount = repository.GetAccount(accountId);
            }

            LblFName.Text = currentAccount.FirstName;
            LblLName.Text = currentAccount.LastName;
            LblInfo.Text  = currentAccount.Information;
            //LblBirthDate.Text = currentAccount.BirthDate.Value.ToShortDateString();

            //Check if this is an actual user's page
            if (AuthorizationManager.IsUsersAccount(userId.ToString(), requestedPageId))
            {
                LblIsUser.Text    = "(this is you)";
                InputPost.Visible = true;
                Publicate.Visible = true;
            }
            //If the user is not a page's owner
            else
            {
                var actualAccount = repository.GetAccount(Guid.Parse(userId.ToString()));
                LblIsUser.Text     = "";
                LblActualUser.Text = string.Format("You entered as {0} {1}",
                                                   actualAccount.FirstName, actualAccount.LastName);
            }

            currentAccount.Posts.Reverse();

            PostRepeater.DataSource = currentAccount.Posts
                                      .OrderByDescending(po => po.PublicationTime);
            PostRepeater.DataBind();

            Image.ImageUrl = GetUsersPhoto(requestedPageId);

            Friends.PostBackUrl = "Friends.aspx?id=" + requestedPageId;
        }