示例#1
0
        /// <summary>
        /// 获取分页数据,默认返回不是推荐的数据
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageCount"></param>
        /// <param name="totalCount"></param>
        /// <param name="isRecommand">默认isRecommand = false</param>
        /// <returns></returns>
        public List <ArticleIndex> List(string key, int category, int pageIndex, int pageCount, out int totalCount, bool isRecommand = false)
        {
            totalCount = 0;

            var query = from art in dbContext.t_article
                        join cate in dbContext.t_article_category
                        on art.category equals cate.id into temp
                        from tt in temp.DefaultIfEmpty()
                        select new ArticleIndex()
            {
                Id           = art.id,
                Author       = art.author,
                CategoryId   = art.category,
                CategoryName = tt.name,
                Title        = art.title,
                Summary      = art.summary,
                ImgUrl       = art.img_url,
                ReadCount    = art.read_count,
                CreateTime   = art.create_time,
            };

            if (category > 0)
            {
                query = query.Where(q => q.CategoryId == category);
            }
            if (!string.IsNullOrEmpty(key))
            {
                query = query.Where(q => q.Title.Contains(key));
            }

            IPagedList <ArticleIndex> pageList = query.OrderByDescending(m => m.Id).ToPagedList((pageIndex <= 0 ? 1 : pageIndex), pageCount);

            totalCount = pageList.TotalItemCount;
            return(pageList.ToList());
        }
        public APIEndpointResponseModels.GetEndpointsList GetEndPointsWithWarnings(string searchFor, long?deviceID, long?thingID, long?locationID, long?viewID, bool loadDevice, bool loadThing, int pageNumber, int pageSize)
        {
            APIEndpointResponseModels.GetEndpointsList result = new APIEndpointResponseModels.GetEndpointsList();

            IPagedList <Endpoint> endpointsPL = uof_Repositories.repoEndpoints.GetEndpointsWithWarningsPagedList(searchFor, deviceID, thingID, locationID, viewID, pageNumber, pageSize);
            List <Endpoint>       endpoints   = endpointsPL.ToList();

            List <APIEndPoint> listAPIEndpoints = new List <APIEndPoint>();

            foreach (Endpoint end in endpoints)
            {
                APIEndPoint apiEnd = TypesMapper.APIEndPointAdapter.fromEndpoint(end, loadDevice, loadThing);
                listAPIEndpoints.Add(apiEnd);
            }
            result.Endpoints = listAPIEndpoints;


            PagingInfoResponseModel pagingInfo = new PagingInfoResponseModel();

            pagingInfo.CurrentPage  = endpointsPL.PageNumber;
            pagingInfo.ItemsPerPage = endpointsPL.PageSize;
            pagingInfo.ItemsCount   = endpointsPL.TotalItemCount;
            pagingInfo.PagesCount   = endpointsPL.PageCount;
            result.PagingInfo       = pagingInfo;
            return(result);
        }
示例#3
0
        private async void ForwardBtn_Click(object sender, EventArgs e)
        {
            if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage1"])
            {
                if (list1.HasNextPage)
                {
                    list1 = await GetPagedListActiveAsync(++pageNummber1);

                    BackBtn.Enabled                = list1.HasPreviousPage;
                    ForwardBtn.Enabled             = list1.HasNextPage;
                    actUcioniceGridView.DataSource = list1.ToList();
                    pageNumLabel.Text              = string.Format("Page {0}/{1}", pageNummber1, list1.PageCount);
                }
            }

            if (tabControl1.SelectedTab == tabControl1.TabPages["tabPage2"])
            {
                if (list1.HasNextPage)
                {
                    list2 = await GetPagedListStareAsync(++pageNummber1);

                    BackBtn.Enabled                = list2.HasPreviousPage;
                    ForwardBtn.Enabled             = list2.HasNextPage;
                    strUcioniceGridView.DataSource = list2.ToList();
                    pageNumLabel.Text              = string.Format("Page {0}/{1}", pageNummber2, list2.PageCount);
                }
            }
        }
示例#4
0
        //
        // GET: /Said/

        public ActionResult Index(string pageIndex = null)
        {
            //wap访问
            if (Request.Browser.IsMobileDevice)
            {
                IPagedList <Article> list = articleApplication.FindByDateDesc(new Page {
                    PageNumber = 1, PageSize = PageLimit
                });
                ViewData["total"]    = list.TotalItemCount;
                ViewData["articles"] = list.ToList();
                ViewData["maxPage"]  = list.TotalItemCount % PageLimit == 0 ? list.TotalItemCount / PageLimit : list.TotalItemCount / PageLimit + 1;
                ViewData["limit"]    = PageLimit;
            }
            else
            {
                ViewData["NavigatorIndex"] = 2;
                int index = 1;
                if (!string.IsNullOrEmpty(pageIndex))
                {
                    int.TryParse(pageIndex, out index);
                }
                var page = new Page
                {
                    //PageNumber = index / PageLimit + 1,
                    PageNumber = index,
                    PageSize   = PageLimit
                };
                IPagedList <Article> list = articleApplication.FindByDateDesc(page);
                ViewData["total"]     = list.TotalItemCount;
                ViewData["articles"]  = list.ToList();
                ViewData["pageIndex"] = index;
                ViewData["maxPage"]   = list.TotalItemCount % PageLimit == 0 ? list.TotalItemCount / PageLimit : list.TotalItemCount / PageLimit + 1;
            }
            return(View());
        }
示例#5
0
        /// <summary>
        /// Get list of Device's commands.
        /// </summary>
        /// <param name="pageNumber">Page Number.</param>
        /// <param name="pageSize">Items count per page.</param>
        /// <param name="loadParents">Enable or Disable loading the Parents objects.</param>
        /// <param name="loadChilds">Enable or Disable loading the Childs objects.</param>
        /// <param name="searchFor">Search text as per the 'Title' field.</param>
        /// <param name="locationID">Filter by Location ID. You can keep it null or empty to ignore this filter.</param>
        /// <param name="DeviceID">Filter by Device ID. You can keep it null or empty to ignore this filter.</param>
        /// <returns></returns>
        public APIDeviceCommandResponseModels.GetDeviceCommandsList GetDeviceCommandsList(string searchFor, long locationID, long DeviceID, bool loadDevice, int pageNumber, int pageSize)
        {
            APIDeviceCommandResponseModels.GetDeviceCommandsList result = new APIDeviceCommandResponseModels.GetDeviceCommandsList();

            IPagedList <DeviceCommand> cmdsPL = uow_Repositories.repoDeviceCommands.GetPagedList(searchFor, DeviceID, locationID, pageNumber, pageSize);
            List <DeviceCommand>       cmds   = cmdsPL.ToList();

            List <APIDeviceCommand> apiCmds = new List <APIDeviceCommand>();

            foreach (DeviceCommand cmd in cmds)
            {
                APIDeviceCommand apiCmd = TypesMapper.APIDeviceCommandAdapter.fromDeviceCommand(cmd, loadDevice);
                apiCmds.Add(apiCmd);
            }
            result.DeviceCommands = apiCmds;


            PagingInfoResponseModel pagingInfo = new PagingInfoResponseModel();

            pagingInfo.CurrentPage  = cmdsPL.PageNumber;
            pagingInfo.ItemsPerPage = cmdsPL.PageSize;
            pagingInfo.ItemsCount   = cmdsPL.TotalItemCount;
            pagingInfo.PagesCount   = cmdsPL.PageCount;
            result.PagingInfo       = pagingInfo;
            return(result);
        }
示例#6
0
        public DataTable FileDataTable(IPagedList <IncomingFileModel> allFiles)
        {
            DataTable table = new DataTable();

            table.Columns.Add("Id", typeof(int));
            table.Columns.Add("Registry Number", typeof(string));
            table.Columns.Add("Received Date", typeof(string));
            table.Columns.Add("Person Sent", typeof(string));
            table.Columns.Add("Date of Letter", typeof(string));
            table.Columns.Add("Reference No", typeof(string));
            table.Columns.Add("Subject", typeof(string));
            table.Columns.Add("From", typeof(string));
            table.Columns.Add("File", typeof(string));
            table.Columns.Add("Remarks", typeof(string));
            table.Columns.Add("Department To", typeof(string));

            foreach (var file in allFiles.ToList())
            {
                table.Rows.Add(file.Id, "TMA-REG-" + file.RegistryNumber.ToString("D3"), file.DateReceived.ToString("dd/MM/yyy"),
                               CultureInfo.CurrentCulture.TextInfo.ToTitleCase(file.PersonSent), file.DateOfLetter.ToString("dd/MM/yyyy"), CultureInfo.CurrentCulture.TextInfo.ToTitleCase(file?.ReferenceNumber ?? ""),
                               CultureInfo.CurrentCulture.TextInfo.ToTitleCase(file.Subject), CultureInfo.CurrentCulture.TextInfo.ToTitleCase(file?.DepartmentSent ?? ""), file?.FileName ?? "",
                               CultureInfo.CurrentCulture.TextInfo.ToTitleCase(file?.Remarks ?? ""), CultureInfo.CurrentCulture.TextInfo.ToTitleCase(file.Department.DepartmentName));
            }

            return(table);
        }
示例#7
0
        public List <Article> List(int pageIndex, int pageCount, out int totalCount)
        {
            totalCount = 0;

            var query = from art in dbContext.t_article
                        join cate in dbContext.t_article_category
                        on art.category equals cate.id into temp
                        from tt in temp.DefaultIfEmpty()
                        select new Article()
            {
                Id           = art.id,
                Author       = art.author,
                CategoryId   = art.category,
                CategoryName = tt.name,
                Title        = art.title,
                Keys         = art.keys,
                Summary      = art.summary,
                ImgUrl       = art.img_url,
                Contents     = art.contents,
                ReadCount    = art.read_count,
                CommentCount = art.comment_count,
                CreateTime   = art.create_time,
                UpdateTime   = art.update_time,
                Recommend    = art.recommend == 1 ? true : false,
            };

            IPagedList <Article> pageList = query.OrderByDescending(m => m.Id).ToPagedList((pageIndex <= 0 ? 1 : pageIndex), pageCount);

            totalCount = pageList.TotalItemCount;
            return(pageList.ToList());
        }
 private void HistorialComprasForm_Load(object sender, EventArgs e)
 {
     Historial = GetHistorial();
     botonSiguiente.Enabled = Historial.HasNextPage;
     botonAnterior.Enabled  = Historial.HasPreviousPage;
     dataGrid.DataSource    = Historial.ToList();
     labelPagina.Text       = string.Format("Pagina {0} de {1}", Pagina, Cant);
 }
示例#9
0
 private void ComprarForm_Load(object sender, EventArgs e)
 {
     Publicaciones          = GetPublicaciones();
     botonSiguiente.Enabled = Publicaciones.HasNextPage;
     botonAnterior.Enabled  = Publicaciones.HasPreviousPage;
     dataGrid.DataSource    = Publicaciones.ToList();
     labelPagina.Text       = string.Format("Pagina {0} de {1}", Pagina, Cantidad);
 }
        private List <Customer> GetCustomersWhoAreMembers()
        {
            int[] roleIds = ValidMemberRoleIds(_customerService).ToArray();
            IPagedList <Customer> members =
                _customerService.GetAllCustomers(customerRoleIds: roleIds, pageIndex: 0, pageSize: 500);

            return(members.ToList());
        }
示例#11
0
 private void botonBuscar_Click(object sender, EventArgs e)
 {
     usarFiltros            = true;
     Publicaciones          = GetPublicaciones();
     botonSiguiente.Enabled = Publicaciones.HasNextPage;
     botonAnterior.Enabled  = Publicaciones.HasPreviousPage;
     dataGrid.DataSource    = Publicaciones.ToList();
     labelPagina.Text       = string.Format("Pagina {0} de {1}", Pagina, Cantidad);
 }