示例#1
0
        /// <summary>
        /// 复杂查询
        /// </summary>
        /// <param name="model">查询对象</param>
        /// <param name="Orders">排序字典key:排序的字段,value:asc升序/desc降序</param>
        /// <param name="PageSize">每页行数,默认15</param>
        /// <param name="PageIndex">当前页码,默认100</param>
        /// <returns></returns>
        public DataGrid <T_SupplierModel> Search(T_SupplierModel model, Dictionary <string, string> Orders = null, int PageSize = 15, int PageIndex = 100)
        {
            Expression <Func <T_Supplier, bool> > where = null;                   //最终查询条件
            var lambdaList = new List <Expression <Func <T_Supplier, bool> > >(); //lambda查询条件集合
            int total      = 0;                                                   //总行数

            if (model.COGS != null)
            {
                lambdaList.Add(c => c.COGS.Contains(model.COGS) || c.COGS2.Contains(model.COGS));
            }
            if (model.Company != null)
            {
                lambdaList.Add(c => c.Company.Contains(model.Company));
            }
            if (model.CategoryId != null && model.CategoryId > 0)
            {
                lambdaList.Add(c => c.CategoryId == model.CategoryId || (c.Category != null && c.Category.ParentId == model.CategoryId));
            }
            //将集合表达式树转换成Expression表达式树
            MyVisitor <T_Supplier, T_Supplier> visitor = new MyVisitor <T_Supplier, T_Supplier>();

            where = visitor.Modify(lambdaList);
            var list   = dal.Search(out total, where, Orders, PageSize, PageIndex).DTOList().ToList();
            var result = new DataGrid <T_SupplierModel>()
            {
                rows  = list,
                total = total
            };

            return(result);
        }
示例#2
0
        /// <summary>
        /// 复杂查询
        /// </summary>
        /// <param name="model">查询对象</param>
        /// <param name="Orders">排序字典key:排序的字段,value:asc升序/desc降序</param>
        /// <param name="PageSize">每页行数,默认15</param>
        /// <param name="PageIndex">当前页码,默认100</param>
        /// <returns></returns>
        public DataGrid <T_LogModel> Search(T_LogModel model, Dictionary <string, string> Orders = null, int PageSize = 15, int PageIndex = 100)
        {
            Expression <Func <T_Log, bool> > where = null;                   //最终查询条件
            var lambdaList = new List <Expression <Func <T_Log, bool> > >(); //lambda查询条件集合
            int total      = 0;                                              //总行数

            if (model.BeginTime.HasValue)
            {
                lambdaList.Add(c => c.CreateTime >= (DateTime)model.BeginTime);
            }
            if (model.EndTime.HasValue)
            {
                lambdaList.Add(c => c.CreateTime <= (DateTime)model.EndTime);
            }
            //将集合表达式树转换成Expression表达式树
            MyVisitor <T_Log, T_Log> visitor = new MyVisitor <T_Log, T_Log>();

            where = visitor.Modify(lambdaList);
            var list   = dal.Search(out total, where, Orders, PageSize, PageIndex).DTOList().ToList();
            var result = new DataGrid <T_LogModel>()
            {
                rows  = list,
                total = total
            };

            return(result);
        }
示例#3
0
        /// <summary>
        /// 复杂查询
        /// </summary>
        /// <param name="model">查询对象</param>
        /// <param name="Orders">排序字典key:排序的字段,value:asc升序/desc降序</param>
        /// <param name="PageSize">每页行数,默认15</param>
        /// <param name="PageIndex">当前页码,默认100</param>
        /// <returns></returns>
        public DataGrid <T_AgreeListModel> Search(T_AgreeListModel model, Dictionary <string, string> Orders = null, int PageSize = 15, int PageIndex = 100)
        {
            Expression <Func <T_AgreeList, bool> > where = null;                   //最终查询条件
            var lambdaList = new List <Expression <Func <T_AgreeList, bool> > >(); //lambda查询条件集合
            int total      = 0;                                                    //总行数

            if (model.ProjectId != null && model.ProjectId > 0)
            {
                lambdaList.Add(c => c.ProjectId == model.ProjectId);
            }
            if (model.AgreeId != null && model.AgreeId > 0)
            {
                lambdaList.Add(c => c.AgreeId == model.AgreeId);
            }
            if (model.CategoryId != null && model.CategoryId > 0)
            {
                T_SysListBLL syslist = new T_SysListBLL();
                List <int>   childer = syslist.GetChildren(1, (int)model.CategoryId);
                lambdaList.Add(c => childer.Contains((int)c.CategoryId));
            }
            //将集合表达式树转换成Expression表达式树
            MyVisitor <T_AgreeList, T_AgreeList> visitor = new MyVisitor <T_AgreeList, T_AgreeList>();

            where = visitor.Modify(lambdaList);
            var list   = dal.Search(out total, where, Orders, PageSize, PageIndex).DTOList().ToList();
            var result = new DataGrid <T_AgreeListModel>()
            {
                rows  = list,
                total = total
            };

            return(result);
        }
示例#4
0
        /// <summary>
        /// 复杂查询
        /// </summary>
        /// <param name="model">查询对象</param>
        /// <param name="Orders">排序字典key:排序的字段,value:asc升序/desc降序</param>
        /// <param name="PageSize">每页行数,默认15</param>
        /// <param name="PageIndex">当前页码,默认100</param>
        /// <returns></returns>
        public DataGrid <T_AgreeModel> Search(T_AgreeModel model, Dictionary <string, string> Orders = null, int PageSize = 15, int PageIndex = 100)
        {
            Expression <Func <T_Agree, bool> > where = null;                   //最终查询条件
            var lambdaList = new List <Expression <Func <T_Agree, bool> > >(); //lambda查询条件集合
            int total      = 0;                                                //总行数

            if (model.StatusList != null && model.StatusList.Count() > 0)
            {
                lambdaList.Add(c => model.StatusList.Any(a => c.Status == a));
            }
            if (model.ProjectId != null && model.ProjectId > 0)
            {
                lambdaList.Add(c => c.ProjectId == model.ProjectId);
            }
            //将集合表达式树转换成Expression表达式树
            MyVisitor <T_Agree, T_Agree> visitor = new MyVisitor <T_Agree, T_Agree>();

            where = visitor.Modify(lambdaList);
            var list   = dal.Search(out total, where, Orders, PageSize, PageIndex).DTOList().ToList();
            var result = new DataGrid <T_AgreeModel>()
            {
                rows  = list,
                total = total
            };

            return(result);
        }
示例#5
0
        /// <summary>
        /// Lambda查询
        /// </summary>
        /// <param name="LambdaWhere">查询条件,Lambda表达式</param>
        /// <param name="Orders">排序字典key:排序的字段,value:asc升序/desc降序</param>
        /// <returns></returns>
        public List <T_ProjectModel> Filter(Expression <Func <T_ProjectModel, bool> > LambdaWhere = null, Dictionary <string, string> Orders = null)
        {
            List <T_ProjectModel> result = new List <T_ProjectModel>();
            MyVisitor <T_ProjectModel, T_Project> visitor = new MyVisitor <T_ProjectModel, T_Project>();

            var where = visitor.Modify(LambdaWhere);
            result    = dal.Filter(where, Orders).DTOList().ToList();
            return(result);
        }
示例#6
0
        /// <summary>
        /// Lambda查询
        /// </summary>
        /// <param name="LambdaWhere">查询条件,Lambda表达式</param>
        /// <param name="Orders">排序字典key:排序的字段,value:asc升序/desc降序</param>
        /// <returns></returns>
        public List <T_SysModel> Filter(Expression <Func <T_SysModel, bool> > LambdaWhere = null, Dictionary <string, string> Orders = null)
        {
            List <T_SysModel>             result  = new List <T_SysModel>();
            MyVisitor <T_SysModel, T_Sys> visitor = new MyVisitor <T_SysModel, T_Sys>();

            var where = visitor.Modify(LambdaWhere);
            result    = dal.Filter(where, Orders).Select(s => new T_SysModel
            {
                Id        = s.Id,
                Name      = s.Name,
                Remark    = s.Remark,
                Listorder = s.Listorder,
            }).ToList();
            return(result);
        }
示例#7
0
        /// <summary>
        /// 复杂查询
        /// </summary>
        /// <param name="model">查询对象</param>
        /// <param name="Orders">排序字典key:排序的字段,value:asc升序/desc降序</param>
        /// <param name="PageSize">每页行数,默认15</param>
        /// <param name="PageIndex">当前页码,默认100</param>
        /// <returns></returns>
        public DataGrid <T_FixedAssetsModel> Search(T_FixedAssetsModel model, Dictionary <string, string> Orders = null, int PageSize = 15, int PageIndex = 100)
        {
            Expression <Func <T_FixedAssets, bool> > where = null;                   //最终查询条件
            var lambdaList = new List <Expression <Func <T_FixedAssets, bool> > >(); //lambda查询条件集合
            int total      = 0;                                                      //总行数

            if (model.AssetsNo != null)
            {
                lambdaList.Add(c => c.AssetsNo.Contains(model.AssetsNo));
            }
            if (model.Name != null)
            {
                lambdaList.Add(c => c.Name.Contains(model.Name));
            }
            if (model.CompanyId.HasValue)
            {
                lambdaList.Add(c => c.CompanyId == (int)model.CompanyId);
            }
            if (model.Category != null && model.Category != " ")
            {
                lambdaList.Add(c => c.Category == model.Category);
            }
            if (model.BeginTime.HasValue)
            {
                lambdaList.Add(c => c.DatePurchase >= (DateTime)model.BeginTime);
            }
            if (model.EndTime.HasValue)
            {
                lambdaList.Add(c => c.DatePurchase <= (DateTime)model.EndTime);
            }
            if (model.StatusList.Count() > 0)
            {
                lambdaList.Add(c => model.StatusList.Any(a => c.Status == a));
            }
            //将集合表达式树转换成Expression表达式树
            MyVisitor <T_FixedAssets, T_FixedAssets> visitor = new MyVisitor <T_FixedAssets, T_FixedAssets>();

            where = visitor.Modify(lambdaList);
            var list   = dal.Search(out total, where, Orders, PageSize, PageIndex).DTOList().ToList();
            var result = new DataGrid <T_FixedAssetsModel>()
            {
                rows  = list,
                total = total
            };

            return(result);
        }
示例#8
0
        /// <summary>
        /// 复杂查询
        /// </summary>
        /// <param name="model">查询对象</param>
        /// <param name="Orders">排序字典key:排序的字段,value:asc升序/desc降序</param>
        /// <param name="PageSize">每页行数,默认15</param>
        /// <param name="PageIndex">当前页码,默认100</param>
        /// <returns></returns>
        public DataGrid <T_LeaveSettingModel> Search(T_LeaveSettingModel model, Dictionary <string, string> Orders = null, int PageSize = 15, int PageIndex = 100)
        {
            Expression <Func <T_LeaveSetting, bool> > where = null;                   //最终查询条件
            var lambdaList = new List <Expression <Func <T_LeaveSetting, bool> > >(); //lambda查询条件集合
            int total      = 0;                                                       //总行数

            #region 查询条件
            #endregion
            //将集合表达式树转换成Expression表达式树
            MyVisitor <T_LeaveSetting, T_LeaveSetting> visitor = new MyVisitor <T_LeaveSetting, T_LeaveSetting>();
            where = visitor.Modify(lambdaList);
            var list   = dal.Search(out total, where, Orders, PageSize, PageIndex).DTOList().ToList();
            var result = new DataGrid <T_LeaveSettingModel>()
            {
                rows  = list,
                total = total
            };
            return(result);
        }
示例#9
0
        /// <summary>
        /// 复杂查询
        /// </summary>
        /// <param name="model">查询对象</param>
        /// <param name="Orders">排序字典key:排序的字段,value:asc升序/desc降序</param>
        /// <param name="PageSize">每页行数,默认15</param>
        /// <param name="PageIndex">当前页码,默认100</param>
        /// <returns></returns>
        public DataGrid <T_LeaveApplyModel> Search(T_LeaveApplyModel model, Dictionary <string, string> Orders = null, int PageSize = 15, int PageIndex = 100)
        {
            Expression <Func <T_LeaveApply, bool> > where = null;                   //最终查询条件
            var lambdaList = new List <Expression <Func <T_LeaveApply, bool> > >(); //lambda查询条件集合
            int total      = 0;                                                     //总行数

            if (model.UserId != 0)                                                  //这里要注意尽量用!= 0表示全部,-1表示有问题不让他查
            {
                lambdaList.Add(c => c.UserId == model.UserId);
            }
            if (model.UserName != null)
            {
                lambdaList.Add(c => c.UserName.Contains(model.UserName));
            }
            if (model.SetingId != null && model.SetingId > 0)
            {
                lambdaList.Add(c => c.SetingId == model.SetingId);
            }
            if (model.StatusList != null && model.StatusList.Count() > 0)
            {
                lambdaList.Add(c => model.StatusList.Any(a => c.Status == a));
            }
            if (model.FromDate != null && model.FromDate.Year > 1900)
            {
                lambdaList.Add(c => c.FromDate >= model.FromDate);
            }
            if (model.EndDate != null && model.EndDate.Year > 1900)
            {
                lambdaList.Add(c => c.FromDate <= model.EndDate);
            }
            //将集合表达式树转换成Expression表达式树
            MyVisitor <T_LeaveApply, T_LeaveApply> visitor = new MyVisitor <T_LeaveApply, T_LeaveApply>();

            where = visitor.Modify(lambdaList);
            var list   = dal.Search(out total, where, Orders, PageSize, PageIndex).DTOList().ToList();
            var result = new DataGrid <T_LeaveApplyModel>()
            {
                rows  = list,
                total = total
            };

            return(result);
        }
示例#10
0
        /// <summary>
        /// 复杂查询
        /// </summary>
        /// <param name="model">查询对象</param>
        /// <param name="Orders">排序字典key:排序的字段,value:asc升序/desc降序</param>
        /// <param name="PageSize">每页行数,默认15</param>
        /// <param name="PageIndex">当前页码,默认100</param>
        /// <returns></returns>
        public DataGrid <T_ClientModel> Search(T_ClientModel model, Dictionary <string, string> Orders = null, int PageSize = 15, int PageIndex = 100)
        {
            Expression <Func <T_Client, bool> > where = null;                   //最终查询条件
            var lambdaList = new List <Expression <Func <T_Client, bool> > >(); //lambda查询条件集合
            int total      = 0;                                                 //总行数

            if (model.Name != null)
            {
                lambdaList.Add(c => c.Company.Contains(model.Name) || c.Name.Contains(model.Name) || c.Phone.Contains(model.Name) || c.Mobile.Contains(model.Name) || c.Email.Contains(model.Name) || c.Fax.Contains(model.Name) || c.StreetName.Contains(model.Name) || c.BuildingName.Contains(model.Name) || c.Blk.Contains(model.Name) || c.Unit.Contains(model.Name));
            }

            //将集合表达式树转换成Expression表达式树
            MyVisitor <T_Client, T_Client> visitor = new MyVisitor <T_Client, T_Client>();

            where = visitor.Modify(lambdaList);
            var list   = dal.Search(out total, where, Orders, PageSize, PageIndex).DTOList().ToList();
            var result = new DataGrid <T_ClientModel>()
            {
                rows  = list,
                total = total
            };

            return(result);
        }