コード例 #1
0
        /// <summary>
        /// Fetch xml data using both xsd dataset & LINQ techniques
        /// </summary>
        protected void LinqFetchXmlData()
        {
            category.ReadXml(xmlFile);
            var cates = (from c in category select c).ToList();

            var _pagedDataSource = new PagedDataSource
            {
                AllowCustomPaging = true,
                AllowPaging = true,
                PageSize = this.PageSize,
                DataSource = category.Skip((this.CurrentPageIndex - 1) * this.PageSize)
            };
            // Get the total pages
            decimal decimalPages = Decimal.Divide((decimal)category.Count, (decimal)_pagedDataSource.PageSize);
            this.PageCount = (int)(Math.Ceiling(decimalPages));
            // Get the pager info
            BaseSys.GetPaginationInfo(lbPaginationInfo, this.CurrentPageIndex, this.PageCount, Properties.Resources.CategoryCount, category.Count);

            //lbPaginationInfo.Text = string.Format("{0} {1} {2} {3}", Properties.Resources.Page, this.CurrentPageIndex, Properties.Resources.Of, this.PageCount);
            this.StylePageNagiation(category.Count);

            // Fill Repeater Data from PagedDataSource
            repeaterData.DataSource = _pagedDataSource;
            repeaterData.DataBind();

            this.NavigationFor = "LoadingData";
        }
コード例 #2
0
        /// <summary>
        /// Search for data in xml file using both xsd dataset & LINQ techniques
        /// </summary>
        protected void LinqSearchXmlData()
        {
            category.ReadXml(xmlFile);

            // Note: using [select new] below is most important for showing them in repeater, otherwise we cannot.
            // !Important: c.Element("id") -> <name>1</name> - c.Element("id").Value -> 1 - same for active
            var cates = (from c in category
                         where c.Name.Contains(this.Keywrod) || c.Description.Contains(this.Keywrod)
                         select c).ToList();
            //select new { Id = c.Element("id").Value, Name = c.Element("name"), Description = c.Element("description"), Active = c.Element("active").Value }).ToList();

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

            decimal decimalPages = Decimal.Divide((decimal)category.Count, (decimal)_pagedDataSource.PageSize);
            this.PageCount = (int)(Math.Ceiling(decimalPages));
            // Get the pager info
            BaseSys.GetPaginationInfo(lbPaginationInfo, this.CurrentPageIndex, this.PageCount, Properties.Resources.Search, category.Count);

            this.StylePageNagiation(category.Count);

            // Fill Repeater Data from PagedDataSource
            repeaterData.DataSource = _pagedDataSource;
            repeaterData.DataBind();

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

        }
コード例 #3
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";
        }
コード例 #4
0
        /// <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";
        }
コード例 #5
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";

        }