Esempio n. 1
0
        /// <summary>
        /// Fetch data using LINQ techniques
        /// </summary>
        public void LinqFetchData()
        {
            var contact = (from c in smartDb.ContactUs select new { c.Id, c.Name, c.Email, c.Message, c.SentDate}).ToList();

            var _pagedDataSource = new PagedDataSource
            {
                AllowCustomPaging = true,
                AllowPaging = true,
                PageSize = this.PageSize,
                DataSource = contact.Skip((this.CurrentPageIndex - 1) * this.PageSize)
            };
            // Get the total pages
            this.PageCount = BaseSys.CalculateTotalPages(contact.Count, this.PageSize);
            // Get the pager info
            BaseSys.GetPaginationInfo(lbPaginationInfo, this.CurrentPageIndex, this.PageCount, Properties.Resources.NewsCount, contact.Count);
            this.StylePageNagiation(contact.Count);
            // Fill Repeater Data from PagedDataSource
            repeaterData.DataSource = _pagedDataSource;
            repeaterData.DataBind();

            this.NavigationFor = "LoadingData";
        }
        /// <summary>
        /// Fetch data using LINQ techniques
        /// </summary>
        public void LinqFetchData()
        {
            var user = smartDb.SelectUser().ToList();

            var _pagedDataSource = new PagedDataSource
            {
                AllowCustomPaging = true,
                AllowPaging = true,
                PageSize = this.PageSize,
                DataSource = user.Skip((this.CurrentPageIndex - 1) * this.PageSize)
            };
            // Get the total pages
            this.PageCount = BaseSys.CalculateTotalPages(user.Count, this.PageSize);
            // Get the pager info
            BaseSys.GetPaginationInfo(lbPaginationInfo, this.CurrentPageIndex, this.PageCount, Properties.Resources.NewsCount, user.Count);
            this.StylePageNagiation(user.Count);
            // Fill Repeater Data from PagedDataSource
            repeaterData.DataSource = _pagedDataSource;
            repeaterData.DataBind();

            this.NavigationFor = "LoadingData";
        }
Esempio n. 3
0
        /// <summary>
        /// Search for data in xml file using both xsd dataset & LINQ techniques
        /// </summary>
        protected void LinqSearchData()
        {
            var contact = smartDb.SearchContacts(this.Keywrod).ToList();

            var _pagedDataSource = new PagedDataSource
            {
                AllowCustomPaging = true,
                AllowPaging = true,
                PageSize = this.PageSize,
                DataSource = contact.Skip((this.CurrentPageIndex - 1) * this.PageSize)
            };

            this.PageCount = BaseSys.CalculateTotalPages(contact.Count, this.PageSize);
            BaseSys.GetPaginationInfo(lbPaginationInfo, this.CurrentPageIndex, this.PageCount, Properties.Resources.Search, contact.Count);

            this.StylePageNagiation(contact.Count);
            // Fill Repeater Data from PagedDataSource
            repeaterData.DataSource = _pagedDataSource;
            repeaterData.DataBind();

            // navibation pager will work for the following
            this.NavigationFor = "Search";

        }