Beispiel #1
0
 public static List <Z01PaperTemplate> Take(Zippy.Data.IDalProvider db, string sqlEntry, params System.Data.Common.DbParameter[] cmdParameters)
 {
     return(db.Take <Z01PaperTemplate>(sqlEntry, cmdParameters));
 }
Beispiel #2
0
 /// <summary>
 /// 表示 [模板] 被选实体集合
 /// </summary>
 public static List <PropertyTemplate> GetTemplateIDEntities(Zippy.Data.IDalProvider db)
 {
     return(db.Take <PropertyTemplate>());
 }
Beispiel #3
0
 public static List <ExtProperty> Take(Zippy.Data.IDalProvider db, int count)
 {
     return(db.Take <ExtProperty>(count, true));
 }
Beispiel #4
0
        public static PaginatedList <Z01Bank> Query(Zippy.Data.IDalProvider db, Guid tenantID, int PageSize, int PageIndex, Hashtable paras, int?orderCol)
        {
            PaginatedList <Z01Bank> rtn = new PaginatedList <Z01Bank>();
            List <System.Data.Common.DbParameter> dbParams = new List <System.Data.Common.DbParameter>();

            string where = " [TenantID]=@TenantID";
            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 qAccount = paras["qAccount"];
                if (qAccount.IsNotNullOrEmpty())
                {
                    where += " and [Account] like @Account";
                    dbParams.Add(db.CreateParameter("Account", "%" + qAccount + "%"));
                }
            }
            #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 = "[Brief]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[Brief] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[Account]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[Account] desc";
            }
            else if (orderCol == 7)
            {
                orderBy = "[Contact]";
            }
            else if (orderCol == 8)
            {
                orderBy = "[Contact] desc";
            }
            else if (orderCol == 9)
            {
                orderBy = "[Tel]";
            }
            else if (orderCol == 10)
            {
                orderBy = "[Tel] desc";
            }
            else if (orderCol == 11)
            {
                orderBy = "[Fax]";
            }
            else if (orderCol == 12)
            {
                orderBy = "[Fax] desc";
            }
            else if (orderCol == 13)
            {
                orderBy = "[CreateDate]";
            }
            else if (orderCol == 14)
            {
                orderBy = "[CreateDate] desc";
            }
            int RecordCount = db.Count <Z01Bank>(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 <Z01Bank> records = db.Take <Z01Bank>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex  = PageIndex;
            rtn.PageSize   = PageSize;
            rtn.TotalCount = RecordCount;

            return(rtn);
        }
Beispiel #5
0
 public static List <Tenant> Take(Zippy.Data.IDalProvider db, int count)
 {
     return(db.Take <Tenant>(count, true));
 }
Beispiel #6
0
 public static List <Z30Communication> Take(Zippy.Data.IDalProvider db, string sqlEntry, params System.Data.Common.DbParameter[] cmdParameters)
 {
     return(db.Take <Z30Communication>(sqlEntry, cmdParameters));
 }
Beispiel #7
0
 public static List <Z01Bank> Take(Zippy.Data.IDalProvider db)
 {
     return(db.Take <Z01Bank>(true));
 }
Beispiel #8
0
 public static List <Z01UserInfo> Take(Zippy.Data.IDalProvider db)
 {
     return(db.Take <Z01UserInfo>(true));
 }
Beispiel #9
0
 public static List <RolePermission> Take(Zippy.Data.IDalProvider db, int count)
 {
     return(db.Take <RolePermission>(count, true));
 }
Beispiel #10
0
        public static PaginatedList <Z01UserInfo> Query(Zippy.Data.IDalProvider db, Guid tenantID, int PageSize, int PageIndex, Hashtable paras, int?orderCol)
        {
            PaginatedList <Z01UserInfo>           rtn      = new PaginatedList <Z01UserInfo>();
            List <System.Data.Common.DbParameter> dbParams = new List <System.Data.Common.DbParameter>();

            string where = " [TenantID]=@TenantID";
            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 qEmail = paras["qEmail"];
                if (qEmail.IsNotNullOrEmpty())
                {
                    where += " and [Email] like @Email";
                    dbParams.Add(db.CreateParameter("Email", "%" + qEmail + "%"));
                }
                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 != 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 = "[CreateDate] desc";
            if (orderCol == 0)
            {
                orderBy = "[CreateDate] desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[UserID]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[UserID] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[Name]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[Name] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[Nickname]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[Nickname] desc";
            }
            else if (orderCol == 7)
            {
                orderBy = "[Email]";
            }
            else if (orderCol == 8)
            {
                orderBy = "[Email] desc";
            }
            else if (orderCol == 9)
            {
                orderBy = "[Tel1]";
            }
            else if (orderCol == 10)
            {
                orderBy = "[Tel1] desc";
            }
            else if (orderCol == 11)
            {
                orderBy = "[Tel2]";
            }
            else if (orderCol == 12)
            {
                orderBy = "[Tel2] desc";
            }
            else if (orderCol == 13)
            {
                orderBy = "[Avatar]";
            }
            else if (orderCol == 14)
            {
                orderBy = "[Avatar] desc";
            }
            else if (orderCol == 15)
            {
                orderBy = "[TitleID]";
            }
            else if (orderCol == 16)
            {
                orderBy = "[TitleID] desc";
            }
            else if (orderCol == 17)
            {
                orderBy = "[TenantID]";
            }
            else if (orderCol == 18)
            {
                orderBy = "[TenantID] desc";
            }
            else if (orderCol == 19)
            {
                orderBy = "[UserStatus]";
            }
            else if (orderCol == 20)
            {
                orderBy = "[UserStatus] desc";
            }
            else if (orderCol == 21)
            {
                orderBy = "[CreateDate]";
            }
            else if (orderCol == 22)
            {
                orderBy = "[CreateDate] desc";
            }
            int RecordCount = db.Count <Z01UserInfo>(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 <Z01UserInfo> records = db.Take <Z01UserInfo>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex  = PageIndex;
            rtn.PageSize   = PageSize;
            rtn.TotalCount = RecordCount;

            return(rtn);
        }
Beispiel #11
0
 /// <summary>
 /// 表示 [头衔/职务] 被选实体集合
 /// </summary>
 public static List <Z01Title> GetTitleIDEntities(Zippy.Data.IDalProvider db)
 {
     return(db.Take <Z01Title>());
 }
Beispiel #12
0
 public static List <Currency> Take(Zippy.Data.IDalProvider db, int count)
 {
     return(db.Take <Currency>(count, true));
 }
Beispiel #13
0
 public static List <Currency> Take(Zippy.Data.IDalProvider db)
 {
     return(db.Take <Currency>(true));
 }
Beispiel #14
0
 public static List <PropertyTemplate> Take(Zippy.Data.IDalProvider db, int count)
 {
     return(db.Take <PropertyTemplate>(count, true));
 }
 /// <summary>
 /// 表示 [分类] 被选实体集合
 /// </summary>
 public static List <Z01CustomerCategory> GetCategoryIDEntities(Zippy.Data.IDalProvider db)
 {
     return(db.Take <Z01CustomerCategory>());
 }
Beispiel #16
0
        public static PaginatedList <RolePermission> Query(Zippy.Data.IDalProvider db, Guid tenantID, int PageSize, int PageIndex, Hashtable paras, int?orderCol)
        {
            PaginatedList <RolePermission>        rtn      = new PaginatedList <RolePermission>();
            List <System.Data.Common.DbParameter> dbParams = new List <System.Data.Common.DbParameter>();

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

            #region 开始查询
            if (paras != null)
            {
                object qRoleIDStart = paras["qRoleIDStart"];
                if (qRoleIDStart != null && qRoleIDStart.ToString() != "")
                {
                    where += " and [RoleID] >= @RoleIDStart";
                    dbParams.Add(db.CreateParameter("RoleIDStart", qRoleIDStart));
                }
                object qRoleIDEnd = paras["qRoleIDEnd"];
                if (qRoleIDEnd != null && qRoleIDEnd.ToString() != "")
                {
                    where += " and [RoleID] <= @RoleID";
                    dbParams.Add(db.CreateParameter("RoleIDEnd", qRoleIDEnd));
                }
                object qPermissionIDStart = paras["qPermissionIDStart"];
                if (qPermissionIDStart != null && qPermissionIDStart.ToString() != "")
                {
                    where += " and [PermissionID] >= @PermissionIDStart";
                    dbParams.Add(db.CreateParameter("PermissionIDStart", qPermissionIDStart));
                }
                object qPermissionIDEnd = paras["qPermissionIDEnd"];
                if (qPermissionIDEnd != null && qPermissionIDEnd.ToString() != "")
                {
                    where += " and [PermissionID] <= @PermissionID";
                    dbParams.Add(db.CreateParameter("PermissionIDEnd", qPermissionIDEnd));
                }
                object qPermissionType = paras["qPermissionType"];
                if (qPermissionType != null && qPermissionType.ToString() != "")
                {
                    Int32 intqPermissionType = (Int32)qPermissionType;
                    if (intqPermissionType > 0)
                    {
                        where += " and ([PermissionType] & @PermissionType = @PermissionType)";
                        dbParams.Add(db.CreateParameter("PermissionType", qPermissionType));
                    }
                }
                object qPermissionStatus = paras["qPermissionStatus"];
                if (qPermissionStatus != null && qPermissionStatus.ToString() != "")
                {
                    Int32 intqPermissionStatus = (Int32)qPermissionStatus;
                    if (intqPermissionStatus > 0)
                    {
                        where += " and [PermissionStatus] = @PermissionStatus";
                        dbParams.Add(db.CreateParameter("PermissionStatus", qPermissionStatus));
                    }
                }
                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 = "[CreateDate] desc";
            if (orderCol == 0)
            {
                orderBy = "[CreateDate] desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[RolePermissionID]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[RolePermissionID] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[RoleID]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[RoleID] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[PermissionID]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[PermissionID] desc";
            }
            else if (orderCol == 7)
            {
                orderBy = "[PermissionType]";
            }
            else if (orderCol == 8)
            {
                orderBy = "[PermissionType] desc";
            }
            else if (orderCol == 9)
            {
                orderBy = "[PermissionStatus]";
            }
            else if (orderCol == 10)
            {
                orderBy = "[PermissionStatus] desc";
            }
            else if (orderCol == 11)
            {
                orderBy = "[CreateDate]";
            }
            else if (orderCol == 12)
            {
                orderBy = "[CreateDate] desc";
            }
            int RecordCount = db.Count <RolePermission>(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 <RolePermission> records = db.Take <RolePermission>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex  = PageIndex;
            rtn.PageSize   = PageSize;
            rtn.TotalCount = RecordCount;

            return(rtn);
        }
Beispiel #17
0
 public static List <Z30Communication> Take(Zippy.Data.IDalProvider db, int count)
 {
     return(db.Take <Z30Communication>(count, true));
 }
Beispiel #18
0
 public static List <Z10Config> Take(Zippy.Data.IDalProvider db)
 {
     return(db.Take <Z10Config>(true));
 }
Beispiel #19
0
        public static PaginatedList <Z30Communication> Query(Zippy.Data.IDalProvider db, Guid tenantID, int PageSize, int PageIndex, Hashtable paras, int?orderCol)
        {
            PaginatedList <Z30Communication>      rtn      = new PaginatedList <Z30Communication>();
            List <System.Data.Common.DbParameter> dbParams = new List <System.Data.Common.DbParameter>();

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

            #region 开始查询
            if (paras != null)
            {
                object qCreator = paras["qCreator"];
                if (qCreator.IsNotNullOrEmpty())
                {
                    where += " and [Creator] = @Creator";
                    dbParams.Add(db.CreateParameter("Creator", qCreator));
                }
                object qCustomerID = paras["qCustomerID"];
                if (qCustomerID.IsNotNullOrEmpty())
                {
                    where += " and [CustomerID] = @CustomerID";
                    dbParams.Add(db.CreateParameter("CustomerID", qCustomerID));
                }
                object qContent = paras["qContent"];
                if (qContent.IsNotNullOrEmpty())
                {
                    where += " and [Content] like @Content";
                    dbParams.Add(db.CreateParameter("Content", "%" + qContent + "%"));
                }
                object qWish = paras["qWish"];
                if (qWish.IsNotNullOrEmpty())
                {
                    where += " and [Wish] >= @Wish";
                    dbParams.Add(db.CreateParameter("Wish", qWish));
                }
                object qSuccessRatio = paras["qSuccessRatio"];
                if (qSuccessRatio.IsNotNullOrEmpty())
                {
                    where += " and [SuccessRatio] >= @SuccessRatio";
                    dbParams.Add(db.CreateParameter("SuccessRatio", qSuccessRatio));
                }
                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] < @CreateDate";
                    dbParams.Add(db.CreateParameter("CreateDateEnd", ((DateTime)qCreateDateEnd).AddDays(1)));
                }
            }
            #endregion

            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);
        }
Beispiel #20
0
        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]=@TenantID";
            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);
        }
Beispiel #21
0
 public static List <Z01Bank> Take(Zippy.Data.IDalProvider db, int count)
 {
     return(db.Take <Z01Bank>(count, true));
 }
 public static List <Z01CustomerInCategory> Take(Zippy.Data.IDalProvider db, int count)
 {
     return(db.Take <Z01CustomerInCategory>(count, true));
 }
Beispiel #23
0
 public static List <Tenant> Take(Zippy.Data.IDalProvider db)
 {
     return(db.Take <Tenant>(true));
 }
 public static List <Z01CustomerInCategory> Take(Zippy.Data.IDalProvider db, string sqlEntry, params System.Data.Common.DbParameter[] cmdParameters)
 {
     return(db.Take <Z01CustomerInCategory>(sqlEntry, cmdParameters));
 }
Beispiel #25
0
        public static PaginatedList <ExtProperty> Query(Zippy.Data.IDalProvider db, Guid tenantID, int PageSize, int PageIndex, Hashtable paras, int?orderCol)
        {
            PaginatedList <ExtProperty>           rtn      = new PaginatedList <ExtProperty>();
            List <System.Data.Common.DbParameter> dbParams = new List <System.Data.Common.DbParameter>();

            string where = " [TenantID]=@TenantID";
            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 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 = "[CreateDate] desc";
            if (orderCol == 0)
            {
                orderBy = "[CreateDate] desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[PropertyID]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[PropertyID] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[Title]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[Title] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[TemplateID]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[TemplateID] desc";
            }
            else if (orderCol == 7)
            {
                orderBy = "[DisplayOrder]";
            }
            else if (orderCol == 8)
            {
                orderBy = "[DisplayOrder] desc";
            }
            else if (orderCol == 9)
            {
                orderBy = "[CreateDate]";
            }
            else if (orderCol == 10)
            {
                orderBy = "[CreateDate] desc";
            }
            int RecordCount = db.Count <ExtProperty>(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 <ExtProperty> records = db.Take <ExtProperty>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex  = PageIndex;
            rtn.PageSize   = PageSize;
            rtn.TotalCount = RecordCount;

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

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

            #region 开始查询
            if (paras != null)
            {
                object qProductIDStart = paras["qProductIDStart"];
                if (qProductIDStart != null && qProductIDStart.ToString() != "")
                {
                    where += " and [ProductID] >= @ProductIDStart";
                    dbParams.Add(db.CreateParameter("ProductIDStart", qProductIDStart));
                }
                object qProductIDEnd = paras["qProductIDEnd"];
                if (qProductIDEnd != null && qProductIDEnd.ToString() != "")
                {
                    where += " and [ProductID] <= @ProductID";
                    dbParams.Add(db.CreateParameter("ProductIDEnd", qProductIDEnd));
                }
                object qCategoryIDStart = paras["qCategoryIDStart"];
                if (qCategoryIDStart != null && qCategoryIDStart.ToString() != "")
                {
                    where += " and [CategoryID] >= @CategoryIDStart";
                    dbParams.Add(db.CreateParameter("CategoryIDStart", qCategoryIDStart));
                }
                object qCategoryIDEnd = paras["qCategoryIDEnd"];
                if (qCategoryIDEnd != null && qCategoryIDEnd.ToString() != "")
                {
                    where += " and [CategoryID] <= @CategoryID";
                    dbParams.Add(db.CreateParameter("CategoryIDEnd", qCategoryIDEnd));
                }
                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 = "[CreateDate] desc";
            if (orderCol == 0)
            {
                orderBy = "[CreateDate] desc";
            }
            else if (orderCol == 1)
            {
                orderBy = "[CICID]";
            }
            else if (orderCol == 2)
            {
                orderBy = "[CICID] desc";
            }
            else if (orderCol == 3)
            {
                orderBy = "[ProductID]";
            }
            else if (orderCol == 4)
            {
                orderBy = "[ProductID] desc";
            }
            else if (orderCol == 5)
            {
                orderBy = "[CategoryID]";
            }
            else if (orderCol == 6)
            {
                orderBy = "[CategoryID] desc";
            }
            else if (orderCol == 7)
            {
                orderBy = "[CreateDate]";
            }
            else if (orderCol == 8)
            {
                orderBy = "[CreateDate] desc";
            }
            int RecordCount = db.Count <Z01CustomerInCategory>(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 <Z01CustomerInCategory> records = db.Take <Z01CustomerInCategory>(where + " order by " + orderBy, PageSize, PageIndex, dbParams.ToArray());
            rtn.AddRange(records);
            rtn.PageIndex  = PageIndex;
            rtn.PageSize   = PageSize;
            rtn.TotalCount = RecordCount;

            return(rtn);
        }
Beispiel #27
0
 public static List <ExtProperty> Take(Zippy.Data.IDalProvider db)
 {
     return(db.Take <ExtProperty>(true));
 }
 /// <summary>
 /// 表示 [产品] 被选实体集合
 /// </summary>
 public static List <Z01Product> GetProductIDEntities(Zippy.Data.IDalProvider db)
 {
     return(db.Take <Z01Product>());
 }
Beispiel #29
0
 public static List <ExtProperty> Take(Zippy.Data.IDalProvider db, string sqlEntry, params System.Data.Common.DbParameter[] cmdParameters)
 {
     return(db.Take <ExtProperty>(sqlEntry, cmdParameters));
 }
Beispiel #30
0
 public static List <Z01PaperTemplate> Take(Zippy.Data.IDalProvider db)
 {
     return(db.Take <Z01PaperTemplate>(true));
 }