当前位置: 首页>>代码示例>>C#>>正文


C# PaginatedList.AddRange方法代码示例

本文整理汇总了C#中PaginatedList.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# PaginatedList.AddRange方法的具体用法?C# PaginatedList.AddRange怎么用?C# PaginatedList.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PaginatedList的用法示例。


在下文中一共展示了PaginatedList.AddRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PaginatedListTest1

        public void PaginatedListTest1()
        {
            PaginatedList<int> pds = new PaginatedList<int>();
            pds.StartIndex = 1;
            pds.PageNo = 1;
            pds.PageSize = 5;

            pds.AddRange(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 });

            Assert.AreEqual(new int[] { 1, 2, 3, 4, 5 }, pds.GetCurrentPage().ToArray());

            pds.StartIndex = 2;
            pds.PageNo = 1;
            pds.PageSize = 5;
            Assert.AreEqual(new int[] { 2, 3, 4, 5, 6 }, pds.GetCurrentPage().ToArray());

            pds.StartIndex = 5;
            pds.PageNo = 3;
            pds.PageSize = 4;
            Assert.AreEqual(new int[] { 13, 14, 15, 16 }, pds.GetCurrentPage().ToArray());
        }
开发者ID:Terradue,项目名称:DotNetOpenSearch,代码行数:21,代码来源:ParametersTest.cs

示例2: Query

        public static PaginatedList<Z01CustomerCategory> Query(Zippy.Data.IDalProvider db, Guid tenantID, int PageSize, int PageIndex, Hashtable paras, int? orderCol)
        {
            PaginatedList<Z01CustomerCategory> rtn = new PaginatedList<Z01CustomerCategory>();
            List<System.Data.Common.DbParameter> dbParams = new List<System.Data.Common.DbParameter>();

            string where = " [TenantID][email protected]";
            dbParams.Add(db.CreateParameter("TenantID", tenantID));

            #region 开始查询
            if (paras != null)
            {
                object qTitle = paras["qTitle"];
                if (qTitle.IsNotNullOrEmpty())
                {
                    where += " and [Title] like @Title";
                    dbParams.Add(db.CreateParameter("Title", "%" + qTitle + "%"));
                }
            }
            #endregion

            string orderBy = "[CreateDate] desc";
            if (orderCol == 0)
            {
                orderBy = "[CreateDate] desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[Title]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[Title] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[Code]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[Code] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[ParentID]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[ParentID] desc";
            }
            int RecordCount = db.Count<Z01CustomerCategory>(where, dbParams.ToArray());
            int PageCount = 0;
            if (RecordCount % PageSize == 0)
            {
                PageCount = RecordCount / PageSize;
            }
            else
            {
                PageCount = RecordCount / PageSize + 1;
            }
            if (PageIndex > PageCount)
                PageIndex = PageCount;
            if (PageIndex < 1)
                PageIndex = 1;

            List<Z01CustomerCategory> records = db.Take<Z01CustomerCategory>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            //递归重组
            List<Z01CustomerCategory> newRecords = new List<Z01CustomerCategory>();
            ReGroup(records, newRecords, 0, "├", 0);
            rtn.AddRange(newRecords);
            rtn.PageIndex = PageIndex;
            rtn.PageSize = PageSize;
            rtn.TotalCount = RecordCount;

            return rtn;
        }
开发者ID:honj51,项目名称:EAP,代码行数:75,代码来源:Z01CustomerCategoryHelper.cs

示例3: Query


//.........这里部分代码省略.........
            string orderBy = "[CreateDate] desc";
            if (orderCol == 0)
            {
                orderBy =  "[CreateDate] desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[CommunicationID]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[CommunicationID] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[CustomerID]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[CustomerID] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[VisitWay]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[VisitWay] desc";
            }
            else if (orderCol == 7)
            {
                orderBy = "[Wish]";
            }
            else if (orderCol == 8)
            {
                orderBy = "[Wish] desc";
            }
            else if (orderCol == 9)
            {
                orderBy = "[NextVisitDate]";
            }
            else if (orderCol == 10)
            {
                orderBy = "[NextVisitDate] desc";
            }
            else if (orderCol == 11)
            {
                orderBy = "[SuccessRatio]";
            }
            else if (orderCol == 12)
            {
                orderBy = "[SuccessRatio] desc";
            }
            else if (orderCol == 13)
            {
                orderBy = "[VisitDate]";
            }
            else if (orderCol == 14)
            {
                orderBy = "[VisitDate] desc";
            }
            else if (orderCol == 15)
            {
                orderBy = "[VisitDuration]";
            }
            else if (orderCol == 16)
            {
                orderBy = "[VisitDuration] desc";
            }
            else if (orderCol == 17)
            {
                orderBy = "[CreateDate]";
            }
            else if (orderCol == 18)
            {
                orderBy = "[CreateDate] desc";
            }
            int RecordCount = db.Count<Z30Communication>(where, dbParams.ToArray());
            int PageCount =0;
            if (RecordCount % PageSize == 0)
            {
                PageCount = RecordCount / PageSize;
            }
            else
            {
                PageCount = RecordCount / PageSize + 1;
            }
            if (PageIndex > PageCount)
                PageIndex = PageCount;
            if (PageIndex < 1)
                PageIndex = 1;

            List<Z30Communication> records = db.Take<Z30Communication>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex = PageIndex;
            rtn.PageSize = PageSize;
            rtn.TotalCount = RecordCount;

            return rtn;
        }
开发者ID:honj51,项目名称:EAP,代码行数:101,代码来源:Z30CommunicationHelper.cs

示例4: Query

        public static PaginatedList<Z01Title> Query(Zippy.Data.IDalProvider db, Guid tenantID, int PageSize, int PageIndex, Hashtable paras, int? orderCol)
        {
            PaginatedList<Z01Title> rtn = new PaginatedList<Z01Title>();
            List<System.Data.Common.DbParameter> dbParams = new List<System.Data.Common.DbParameter>();

            string where = " [TenantID][email protected]";
            dbParams.Add(db.CreateParameter("TenantID", tenantID));

            #region 开始查询
            if (paras != null)
            {
                object qTitle = paras["qTitle"];
                if (qTitle.IsNotNullOrEmpty())
                {
                    where += " and [Title] like @Title";
                    dbParams.Add(db.CreateParameter("Title", "%" + qTitle + "%"));
                }
                object qContent = paras["qContent"];
                if (qContent.IsNotNullOrEmpty())
                {
                    where += " and [Content] like @Content";
                    dbParams.Add(db.CreateParameter("Content", "%" + qContent + "%"));
                }
                object qCreateDateStart = paras["qCreateDateStart"];
                if (qCreateDateStart != null && qCreateDateStart.ToString() != "")
                {
                    where += " and [CreateDate] >= @CreateDateStart";
                    dbParams.Add(db.CreateParameter("CreateDateStart", qCreateDateStart));
                }
                object qCreateDateEnd = paras["qCreateDateEnd"];
                if (qCreateDateEnd != null && qCreateDateEnd.ToString() != "")
                {
                    where += " and [CreateDate] < @CreateDateEnd";
                    dbParams.Add(db.CreateParameter("CreateDateEnd", ((DateTime)qCreateDateEnd).AddDays(1)));
                }
            }
            #endregion

            string orderBy = "[DisplayOrder]";
            if (orderCol == 0)
            {
                orderBy = "[DisplayOrder] desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[Title]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[Title] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[CreateDate]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[CreateDate] desc";
            }
            int RecordCount = db.Count<Z01Title>(where, dbParams.ToArray());
            int PageCount =0;
            if (RecordCount % PageSize == 0)
            {
                PageCount = RecordCount / PageSize;
            }
            else
            {
                PageCount = RecordCount / PageSize + 1;
            }
            if (PageIndex > PageCount)
                PageIndex = PageCount;
            if (PageIndex < 1)
                PageIndex = 1;

            List<Z01Title> records = db.Take<Z01Title>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex = PageIndex;
            rtn.PageSize = PageSize;
            rtn.TotalCount = RecordCount;

            return rtn;
        }
开发者ID:honj51,项目名称:EAP,代码行数:82,代码来源:Z01TitleHelper.cs

示例5: Query


//.........这里部分代码省略.........
                if (qCustomerType.IsNotNullOrEmpty())
                {
                    where += " and ([CustomerType] & @CustomerType) = @CustomerType";
                    dbParams.Add(db.CreateParameter("CustomerType", qCustomerType));
                }
                object qCateID=paras["qCateID"];
                if (qCateID.IsNotNullOrEmpty())
                {
                    where += " and [CustomerID] in (select [CustomerID] from Z01CustomerInCategory where [CategoryID][email protected])";
                    dbParams.Add(db.CreateParameter("CategoryID", qCateID));
                }
                object qPrincipal = paras["qPrincipal"];
                if (qPrincipal.IsNotNullOrEmpty())
                {
                    where += " and [Principal][email protected]";
                    dbParams.Add(db.CreateParameter("Principal", qPrincipal));
                }
                object qSiteStatus = paras["qSiteStatus"];
                if (qSiteStatus.IsNotNullOrEmpty())
                {
                    where += " and [CustomerStatus][email protected]";
                    dbParams.Add(db.CreateParameter("CustomerStatus", qSiteStatus));
                }
                object qSuccessRatio = paras["qSuccessRatio"];
                if (qSuccessRatio.IsNotNullOrEmpty())
                {
                    where += " and [CustomerID] in (select CustomerID from Z30Communication where SuccessRatio>[email protected])";
                    dbParams.Add(db.CreateParameter("SuccessRatio", qSuccessRatio));
                }
            }
            #endregion

            string orderBy = "[ManageHot] desc, CustomerID desc";
            if (orderCol == 0)
            {
                orderBy = "[ManageHot] desc, CustomerID desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[Title]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[Title] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[Tel1]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[Tel1] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[Tel2]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[Tel2] desc";
            }
            else if (orderCol == 7)
            {
                orderBy = "[Email]";
            }
            else if (orderCol == 8)
            {
                orderBy = "[Email] desc";
            }
            else if (orderCol == 11)
            {
                orderBy = "[CreateDate]";
            }
            else if (orderCol == 12)
            {
                orderBy = "[CreateDate] desc";
            }
            int RecordCount = db.Count<Z01Customer>(where, dbParams.ToArray());
            int PageCount =0;
            if (RecordCount % PageSize == 0)
            {
                PageCount = RecordCount / PageSize;
            }
            else
            {
                PageCount = RecordCount / PageSize + 1;
            }
            if (PageIndex > PageCount)
                PageIndex = PageCount;
            if (PageIndex < 1)
                PageIndex = 1;

            List<Z01Customer> records = db.Take<Z01Customer>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex = PageIndex;
            rtn.PageSize = PageSize;
            rtn.TotalCount = RecordCount;

            return rtn;
        }
开发者ID:honj51,项目名称:EAP,代码行数:101,代码来源:Z01CustomerHelper.cs

示例6: Take

 /// <summary>
 /// 数据源 查询
 /// </summary>
 /// <param name="where">查询条件</param>
 /// <param name="orderby">排序方式</param>
 /// <param name="PageSize">每页数量</param>
 /// <param name="PageIndex">页码</param>
 /// <param name="cmdParameters">查询条件赋值</param>
 /// <returns></returns>
 public static PaginatedList<DataSource> Take(Zippy.Data.IDalProvider db, string @where, string orderby, int PageSize, int PageIndex, params System.Data.Common.DbParameter[] cmdParameters)
 {
     PaginatedList<DataSource> rtn = new PaginatedList<DataSource>();
     List<DataSource> records = db.Take<DataSource>(where + " order by " + orderby, PageSize, PageIndex, cmdParameters);
     rtn.AddRange(records);
     rtn.PageIndex = PageIndex;
     rtn.PageSize = PageSize;
     rtn.TotalCount = db.Count<DataSource>(where, cmdParameters);
     return rtn;
 }
开发者ID:honj51,项目名称:EAP,代码行数:19,代码来源:DataSourceHelper.cs

示例7: Query

        public static PaginatedList<Permission> Query(Zippy.Data.IDalProvider db, int PageSize, int PageIndex, Hashtable paras, int? orderCol)
        {
            PaginatedList<Permission> rtn = new PaginatedList<Permission>();
            List<System.Data.Common.DbParameter> dbParams = new List<System.Data.Common.DbParameter>();

            string where = " 1=1";

            #region 开始查询
            if (paras != null)
            {
                object qTitle = paras["qTitle"];
                if (qTitle.IsNotNullOrEmpty())
                {
                    where += " and [Title] like @Title";
                    dbParams.Add(db.CreateParameter("Title", "%" + qTitle + "%"));
                }
                object qUrl = paras["qUrl"];
                if (qUrl.IsNotNullOrEmpty())
                {
                    where += " and [Url] like @Url";
                    dbParams.Add(db.CreateParameter("Url", "%" + qUrl + "%"));
                }
                object qFlag = paras["qFlag"];
                if (qFlag.IsNotNullOrEmpty())
                {
                    where += " and [Flag] like @Flag";
                    dbParams.Add(db.CreateParameter("Flag", "%" + qFlag + "%"));
                }
                object qParentID = paras["qParentID"];
                if (qParentID.IsNotNullOrEmpty())
                {
                    where += " and [ParentID] = @ParentID";
                    dbParams.Add(db.CreateParameter("ParentID", qParentID));
                }
            }
            #endregion

            string orderBy = " [DisplayOrder] asc";

            int RecordCount = db.Count<Permission>(where, dbParams.ToArray());
            int PageCount = 0;
            if (RecordCount % PageSize == 0)
            {
                PageCount = RecordCount / PageSize;
            }
            else
            {
                PageCount = RecordCount / PageSize + 1;
            }
            if (PageIndex > PageCount)
                PageIndex = PageCount;
            if (PageIndex < 1)
                PageIndex = 1;

            List<Permission> records = db.Take<Permission>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            //重组 records
            List<Permission> newRecords = new List<Permission>();
            IEnumerable<Permission> rootRecords = records.Where(s => (s.ParentID ?? 0) == 0).OrderBy(s => s.DisplayOrder);
            foreach (Permission per in rootRecords)
            {
                newRecords.Add(per);
                newRecords.AddRange(records.Where(s => s.ParentID == per.PermissionID).OrderBy(s => s.DisplayOrder));
            }

            rtn.AddRange(newRecords);
            rtn.PageIndex = PageIndex;
            rtn.PageSize = PageSize;
            rtn.TotalCount = RecordCount;

            return rtn;
        }
开发者ID:honj51,项目名称:EAP,代码行数:71,代码来源:PermissionHelper.cs

示例8: Query


//.........这里部分代码省略.........
                {
                    where += " and [CreateDate] >= @CreateDateStart";
                    dbParams.Add(db.CreateParameter("CreateDateStart", qCreateDateStart));
                }
                object qCreateDateEnd = paras["qCreateDateEnd"];
                if (qCreateDateEnd.IsNotNullOrEmpty())
                {
                    where += " and [CreateDate] < @CreateDateEnd";
                    dbParams.Add(db.CreateParameter("CreateDateEnd", ((DateTime)qCreateDateEnd).AddDays(1)));
                }
                object qOrderType = paras["qOrderType"];
                if (qOrderType.IsNotNullOrEmpty())
                {
                    where += " and ([OrderType]&@OrderType)[email protected]";
                    dbParams.Add(db.CreateParameter("OrderType", qOrderType));
                }
                object qIsSnap = paras["qIsSnap"];
                if (qIsSnap.IsNotNullOrEmpty())
                {
                    where += " and [IsSnap] = @IsSnap";
                    dbParams.Add(db.CreateParameter("IsSnap",qIsSnap));
                }
                object qDeleteFlag = paras["qDeleteFlag"];
                if (qDeleteFlag.IsNotNullOrEmpty())
                {
                    where += " and [DeleteFlag] = @DeleteFlag";
                    dbParams.Add(db.CreateParameter("DeleteFlag", qDeleteFlag));
                }

            }
            #endregion

            string orderBy = "[CreateDate] desc";
            if (orderCol == 0)
            {
                orderBy =  "[CreateDate] desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[OrderID]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[OrderID] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[CustomerID]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[CustomerID] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[DateOrder]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[DateOrder] desc";
            }
            else if (orderCol == 7)
            {
                orderBy = "[DateShip]";
            }
            else if (orderCol == 8)
            {
                orderBy = "[DateShip] desc";
            }
            else if (orderCol == 9)
            {
                orderBy = "[CreateDate]";
            }
            else if (orderCol == 10)
            {
                orderBy = "[CreateDate] desc";
            }
            int RecordCount = db.Count<Z10Order>(where, dbParams.ToArray());
            int PageCount =0;
            if (RecordCount % PageSize == 0)
            {
                PageCount = RecordCount / PageSize;
            }
            else
            {
                PageCount = RecordCount / PageSize + 1;
            }
            if (PageIndex > PageCount)
                PageIndex = PageCount;
            if (PageIndex < 1)
                PageIndex = 1;

            List<Z10Order> records = db.Take<Z10Order>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex = PageIndex;
            rtn.PageSize = PageSize;
            rtn.TotalCount = RecordCount;

            return rtn;
        }
开发者ID:honj51,项目名称:EAP,代码行数:101,代码来源:Z10OrderHelper.cs

示例9: Query

        public static PaginatedList<Z10Config> Query(Zippy.Data.IDalProvider db, Guid tenantID, int PageSize, int PageIndex, Hashtable paras, int? orderCol)
        {
            PaginatedList<Z10Config> rtn = new PaginatedList<Z10Config>();
            List<System.Data.Common.DbParameter> dbParams = new List<System.Data.Common.DbParameter>();

            string where = " [TenantID][email protected]";
            dbParams.Add(db.CreateParameter("TenantID", tenantID));

            #region 开始查询
            if (paras != null)
            {
                object qKey = paras["qKey"];
                if (qKey.IsNotNullOrEmpty())
                {
                    where += " and [Key] like @Key";
                    dbParams.Add(db.CreateParameter("Key", "%" + qKey + "%"));
                }
                object qValue = paras["qValue"];
                if (qValue.IsNotNullOrEmpty())
                {
                    where += " and [Value] like @Value";
                    dbParams.Add(db.CreateParameter("Value", "%" + qValue + "%"));
                }
            }
            #endregion

            string orderBy = "[CreateDate] desc";
            if (orderCol == 0)
            {
                orderBy =  "[CreateDate] desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[Key]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[Key] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[Value]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[Value] desc";
            }
            int RecordCount = db.Count<Z10Config>(where, dbParams.ToArray());
            int PageCount =0;
            if (RecordCount % PageSize == 0)
            {
                PageCount = RecordCount / PageSize;
            }
            else
            {
                PageCount = RecordCount / PageSize + 1;
            }
            if (PageIndex > PageCount)
                PageIndex = PageCount;
            if (PageIndex < 1)
                PageIndex = 1;

            List<Z10Config> records = db.Take<Z10Config>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex = PageIndex;
            rtn.PageSize = PageSize;
            rtn.TotalCount = RecordCount;

            return rtn;
        }
开发者ID:honj51,项目名称:EAP,代码行数:70,代码来源:Z10ConfigHelper.cs

示例10: Query


//.........这里部分代码省略.........
                }
                var qStatus = paras["qStatus"].ToInt32(0);
                if (qStatus > 0)
                {
                    where += " and [ProductStatus] = @ProductStatus";
                    dbParams.Add(db.CreateParameter("ProductStatus", qStatus));
                }
                var qCateID=paras["qCateID"].ToInt64(0);
                if (qCateID>0)
                {
                    where += " and [ProductID] in (select [ProductID] from Z01ProductInCategory where [CategoryID][email protected])";
                    dbParams.Add(db.CreateParameter("CategoryID", qCateID));
                }
            }
            #endregion

            string orderBy = "[ViewCount] desc, ProductID";
            if (orderCol == 0)
            {
                orderBy = "[ViewCount] desc, ProductID";
            }
            else if (orderCol == 1)
            {
                orderBy = "[Title]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[Title] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[UnitID]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[UnitID] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[PriceList]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[PriceList] desc";
            }
            else if (orderCol == 7)
            {
                orderBy = "[ProductStock]";
            }
            else if (orderCol == 8)
            {
                orderBy = "[ProductStock] desc";
            }
            else if (orderCol == 9)
            {
                orderBy = "[PriceSelling]";
            }
            else if (orderCol == 10)
            {
                orderBy = "[PriceSelling] desc";
            }
            else if (orderCol == 11)
            {
                orderBy = "[ImagePath]";
            }
            else if (orderCol == 12)
            {
                orderBy = "[ImagePath] desc";
            }
            else if (orderCol == 13)
            {
                orderBy = "[CreateDate]";
            }
            else if (orderCol == 14)
            {
                orderBy = "[CreateDate] desc";
            }
            int RecordCount = db.Count<Z01Product>(where, dbParams.ToArray());
            int PageCount =0;
            if (RecordCount % PageSize == 0)
            {
                PageCount = RecordCount / PageSize;
            }
            else
            {
                PageCount = RecordCount / PageSize + 1;
            }
            if (PageIndex > PageCount)
                PageIndex = PageCount;
            if (PageIndex < 1)
                PageIndex = 1;

            List<Z01Product> records = db.Take<Z01Product>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex = PageIndex;
            rtn.PageSize = PageSize;
            rtn.TotalCount = RecordCount;

            return rtn;
        }
开发者ID:honj51,项目名称:EAP,代码行数:101,代码来源:Z01ProductHelper.cs

示例11: List4Price

        public ActionResult List4Price(int? PageIndex, int? PageSize, string qTitle, long? qBrandID, long? qCateID)
        {
            System.Text.StringBuilder sbMenu = new System.Text.StringBuilder();
            if ((_crud & Zippy.SaaS.Entity.CRUD.Create) == Zippy.SaaS.Entity.CRUD.Create)
                sbMenu.AppendLine("<a href='/" + _ContollerName + "/Edit?ReturnUrl=" + System.Web.HttpUtility.UrlEncode("/" + _ContollerName + "/?PageSize=" + PageSize) + "' class='btn img'><i class='icon i_create'></i>添加<b></b></a>");

            sbMenu.AppendLine("<a href='javascript:;' class='btn img' id='bReload'><i class='icon i_refresh'></i>刷新<b></b></a>");
            ViewData["TopMenu"] = sbMenu.ToString();

            ViewData.Add("PageSize", PageSize ?? 20);
            int currentPageSize = PageSize ?? 20;
            int currentPageIndex = PageIndex ?? 1;

            Hashtable hs = new Hashtable();
            hs.Add("qTitle", qTitle);
            hs.Add("qCateID", qCateID);
            hs.Add("qBrandID", qBrandID);

            PaginatedList<Z01Product> rtn = new PaginatedList<Z01Product>();
            List<System.Data.Common.DbParameter> dbParams = new List<System.Data.Common.DbParameter>();

            string where = " [TenantID][email protected]";
            dbParams.Add(db.CreateParameter("TenantID", _tenant.TenantID.Value));

            if (qTitle.IsNotNullOrEmpty())
            {
                where += " and ([Title] like @Title or Code like @Title)";
                dbParams.Add(db.CreateParameter("Title", "%" + qTitle + "%"));
            }
            if (qBrandID > 0)
            {
                where += " and [BrandID] = @BrandID";
                dbParams.Add(db.CreateParameter("BrandID", qBrandID));
            }
            if (qCateID > 0)
            {
                where += " and [ProductID] in (select [ProductID] from Z01ProductInCategory where [CategoryID][email protected])";
                dbParams.Add(db.CreateParameter("CategoryID", qCateID));
            }

            int RecordCount = db.Count<Z01Product>(where, dbParams.ToArray());
            int PageCount = 0;
            if (RecordCount % PageSize == 0)
            {
                PageCount = RecordCount / currentPageSize;
            }
            else
            {
                PageCount = RecordCount / currentPageSize + 1;
            }
            if (PageIndex > PageCount)
                PageIndex = PageCount;
            if (PageIndex < 1)
                PageIndex = 1;

            List<Z01Product> records = db.Take<Z01Product>(where + " order by PriceStock", currentPageSize, currentPageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex = currentPageIndex;
            rtn.PageSize = currentPageSize;
            rtn.TotalCount = RecordCount;
            rtn.QueryParameters = hs;

            var brands = db.Take<Z01Brand>("1=1 order by Title");
            ViewBag.brands = brands;
            ViewBag.categories = EAP.Logic.Z01.Helper.GetProductCategories(_tenant.TenantID.Value);
            var currencies = db.Take<EAP.Bus.Entity.Currency>("1=1 order by DisplayOrder");
            ViewBag._currencies = currencies;
            var units = db.Take<Z01Unit>();
            ViewBag._units = units;

            return View(rtn);
        }
开发者ID:honj51,项目名称:EAP,代码行数:72,代码来源:Z01ProductController.cs

示例12: Query


//.........这里部分代码省略.........
                    }
                }

            }
            #endregion

            string orderBy = "[CreateDate] desc";
            if (orderCol == 0)
            {
                orderBy = "[CreateDate] desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[FlowID]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[FlowID] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[BankID]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[BankID] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[CategoryID]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[CategoryID] desc";
            }
            else if (orderCol == 7)
            {
                orderBy = "[OrderID]";
            }
            else if (orderCol == 8)
            {
                orderBy = "[OrderID] desc";
            }
            else if (orderCol == 9)
            {
                orderBy = "[FlowType]";
            }
            else if (orderCol == 10)
            {
                orderBy = "[FlowType] desc";
            }
            else if (orderCol == 11)
            {
                orderBy = "[FlowStatus]";
            }
            else if (orderCol == 12)
            {
                orderBy = "[FlowStatus] desc";
            }
            else if (orderCol == 13)
            {
                orderBy = "[CreateDate]";
            }
            else if (orderCol == 14)
            {
                orderBy = "[CreateDate] desc";
            }
            int RecordCount = db.Count<EAP.Logic.Z01.View.V_FinancialFlow>(where, dbParams.ToArray());
            int PageCount =0;
            if (RecordCount % PageSize == 0)
            {
                PageCount = RecordCount / PageSize;
            }
            else
            {
                PageCount = RecordCount / PageSize + 1;
            }
            if (PageIndex > PageCount)
                PageIndex = PageCount;
            if (PageIndex < 1)
                PageIndex = 1;

            List<EAP.Logic.Z01.View.V_FinancialFlow> records = db.Take<EAP.Logic.Z01.View.V_FinancialFlow>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex = PageIndex;
            rtn.PageSize = PageSize;
            rtn.TotalCount = RecordCount;
            if (qCurrency.IsNotNullOrEmpty())
            {
                string sqlSum = "select sum(Amount) as sAmount from V_FinancialFlow where " + where;
                object oSum = db.ExecuteScalar(sqlSum, dbParams.ToArray());
                sumAll = oSum.ToDecimal();
            }
            else
            {
                sumAll = 0;
            }

            return rtn;
        }
开发者ID:honj51,项目名称:EAP,代码行数:101,代码来源:Z01FinancialFlowHelper.cs

示例13: Query

        public static PaginatedList<Z01CustomerPerson> Query(Zippy.Data.IDalProvider db, Guid tenantID, int PageSize, int PageIndex, Hashtable paras, int? orderCol)
        {
            PaginatedList<Z01CustomerPerson> rtn = new PaginatedList<Z01CustomerPerson>();
            List<System.Data.Common.DbParameter> dbParams = new List<System.Data.Common.DbParameter>();

            string where = " [TenantID][email protected]";
            dbParams.Add(db.CreateParameter("TenantID", tenantID));

            #region 开始查询
            if (paras != null)
            {
                object qName = paras["qName"];
                if (qName.IsNotNullOrEmpty())
                {
                    where += " and [Name] like @Name";
                    dbParams.Add(db.CreateParameter("Name", "%" + qName + "%"));
                }
                object qNickname = paras["qNickname"];
                if (qNickname.IsNotNullOrEmpty())
                {
                    where += " and [Nickname] like @Nickname";
                    dbParams.Add(db.CreateParameter("Nickname", "%" + qNickname + "%"));
                }
                object qCustomerID = paras["qCustomerID"];
                if (qCustomerID.IsNotNullOrEmpty())
                {
                    where += " and [CustomerID] = @CustomerID";
                    dbParams.Add(db.CreateParameter("CustomerID", qCustomerID));
                }
            }
            #endregion

            string orderBy = "[CreateDate] desc";
            if (orderCol == 0)
            {
                orderBy = "[CreateDate] desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[Name]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[Name] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[Nickname]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[Nickname] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[Email]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[Email] desc";
            }
            else if (orderCol == 7)
            {
                orderBy = "[Tel1]";
            }
            else if (orderCol == 8)
            {
                orderBy = "[Tel1] desc";
            }
            else if (orderCol == 9)
            {
                orderBy = "[Tel2]";
            }
            else if (orderCol == 10)
            {
                orderBy = "[Tel2] desc";
            }
            int RecordCount = db.Count<Z01CustomerPerson>(where, dbParams.ToArray());
            int PageCount =0;
            if (RecordCount % PageSize == 0)
            {
                PageCount = RecordCount / PageSize;
            }
            else
            {
                PageCount = RecordCount / PageSize + 1;
            }
            if (PageIndex > PageCount)
                PageIndex = PageCount;
            if (PageIndex < 1)
                PageIndex = 1;

            List<Z01CustomerPerson> records = db.Take<Z01CustomerPerson>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex = PageIndex;
            rtn.PageSize = PageSize;
            rtn.TotalCount = RecordCount;

            return rtn;
        }
开发者ID:honj51,项目名称:EAP,代码行数:100,代码来源:Z01CustomerPersonHelper.cs

示例14: Query


//.........这里部分代码省略.........
                }
                object qMobileID2 = paras["qMobileID2"];
                if (qMobileID2.IsNotNullOrEmpty())
                {
                    where += " and [MobileID2] like @MobileID2";
                    dbParams.Add(db.CreateParameter("MobileID2", "%" + qMobileID2 + "%"));
                }
                object qUserType = paras["qUserType"];
                if (qUserType.IsNotNullOrEmpty())
                {
                    Int32 intqUserType = (Int32)qUserType;
                    if (intqUserType > 0)
                    {
                        where += " and ([UserType] & @UserType = @UserType)";
                        dbParams.Add(db.CreateParameter("UserType", qUserType));
                    }
                }
                object qUserStatus = paras["qUserStatus"];
                if (qUserStatus.IsNotNullOrEmpty())
                {
                    Int32 intqUserStatus = (Int32)qUserStatus;
                    if (intqUserStatus > 0)
                    {
                        where += " and [UserStatus] = @UserStatus";
                        dbParams.Add(db.CreateParameter("UserStatus", qUserStatus));
                    }
                }
                object qCreateDateStart = paras["qCreateDateStart"];
                if (qCreateDateStart.IsNotNullOrEmpty())
                {
                    where += " and [CreateDate] >= @CreateDateStart";
                    dbParams.Add(db.CreateParameter("CreateDateStart", qCreateDateStart));
                }
                object qCreateDateEnd = paras["qCreateDateEnd"];
                if (qCreateDateEnd.IsNotNullOrEmpty())
                {
                    where += " and [CreateDate] < @CreateDateEnd";
                    dbParams.Add(db.CreateParameter("CreateDateEnd", ((DateTime)qCreateDateEnd).AddDays(1)));
                }
                object qGroupID=paras["qGroupID"];
                if (qGroupID.IsNotNullOrEmpty())
                {
                    where += " and [UserID] in (select [UserID] from [UserGroup] where [GroupID][email protected])";
                    dbParams.Add(db.CreateParameter("GroupID", qGroupID));
                }
            }
            #endregion

            string orderBy = "[CreateDate] desc";
            if (orderCol == 0)
            {
                orderBy = "[CreateDate] desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[UserName]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[UserName] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[Email]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[Email] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[Nickname]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[Nickname] desc";
            }
            int RecordCount = db.Count<User>(where, dbParams.ToArray());
            int PageCount = 0;
            if (RecordCount % PageSize == 0)
            {
                PageCount = RecordCount / PageSize;
            }
            else
            {
                PageCount = RecordCount / PageSize + 1;
            }
            if (PageIndex > PageCount)
                PageIndex = PageCount;
            if (PageIndex < 1)
                PageIndex = 1;

            List<User> records = db.Take<User>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex = PageIndex;
            rtn.PageSize = PageSize;
            rtn.TotalCount = RecordCount;

            return rtn;
        }
开发者ID:honj51,项目名称:EAP,代码行数:101,代码来源:UserHelper.cs

示例15: Query

        public static PaginatedList<EAP.Logic.Z10.View.V_DepotProduct> Query(Zippy.Data.IDalProvider db, Guid tenantID, int PageSize, int PageIndex, Hashtable paras, int? orderCol)
        {
            PaginatedList<EAP.Logic.Z10.View.V_DepotProduct> rtn = new PaginatedList<EAP.Logic.Z10.View.V_DepotProduct>();
            List<System.Data.Common.DbParameter> dbParams = new List<System.Data.Common.DbParameter>();

            string where = " [TenantID][email protected]";
            dbParams.Add(db.CreateParameter("TenantID", tenantID));

            #region 开始查询
            if (paras != null)
            {
                object qProductID = paras["qProductID"];
                if (qProductID.IsNotNullOrEmpty())
                {
                    where += " and [ProductID] = @ProductID";
                    dbParams.Add(db.CreateParameter("ProductID", qProductID));
                }
                object qDepotID = paras["qDepotID"];
                if (qDepotID.IsNotNullOrEmpty())
                {
                    where += " and [DepotID] = @DepotID";
                    dbParams.Add(db.CreateParameter("DepotID", qDepotID));
                }
                object qProductTitle = paras["qProductTitle"];
                if (qDepotID.IsNotNullOrEmpty())
                {
                    where += " and [ProductTitle] like @ProductTitle";
                    dbParams.Add(db.CreateParameter("ProductTitle", "%" + qProductTitle + "%"));
                }
            }
            #endregion

            string orderBy = "[DepotID]";
            if (orderCol == 0)
            {
                orderBy = "[DepotID] desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[ProductID]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[ProductID] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[DepotID]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[DepotID] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[CountAlarm]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[CountAlarm] desc";
            }
            else if (orderCol == 7)
            {
                orderBy = "[StockSum]";
            }
            else if (orderCol == 8)
            {
                orderBy = "[StockSum] desc";
            }
            int RecordCount = db.Count<EAP.Logic.Z10.View.V_DepotProduct>(where, dbParams.ToArray());
            int PageCount =0;
            if (RecordCount % PageSize == 0)
            {
                PageCount = RecordCount / PageSize;
            }
            else
            {
                PageCount = RecordCount / PageSize + 1;
            }
            if (PageIndex > PageCount)
                PageIndex = PageCount;
            if (PageIndex < 1)
                PageIndex = 1;

            List<EAP.Logic.Z10.View.V_DepotProduct> records = db.Take<EAP.Logic.Z10.View.V_DepotProduct>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex = PageIndex;
            rtn.PageSize = PageSize;
            rtn.TotalCount = RecordCount;

            return rtn;
        }
开发者ID:honj51,项目名称:EAP,代码行数:92,代码来源:Z10DepotProductHelper.cs


注:本文中的PaginatedList.AddRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。