Пример #1
0
        public Page <Sys_Permission> FindPage(PermissionVM form)
        {
            Expression <Func <Sys_Permission, bool> > predicate = Ext.True <Sys_Permission>();

            if (!string.IsNullOrEmpty(form.Name))
            {
                predicate = predicate.And(s => s.Name.Contains(form.Name));
            }
            if (!string.IsNullOrEmpty(form.EnabledStr))
            {
                if (form.EnabledStr.Equals("1"))
                {
                    predicate = predicate.And(s => s.Enabled == true);
                }
                else
                {
                    predicate = predicate.And(s => s.Enabled == false);
                }
            }
            if (!form.ModuleId.Equals(0))
            {
                predicate = predicate.And(s => s.ModuleId == form.ModuleId);
            }

            OrderModelField idOrder = new OrderModelField
            {
                PropertyName = "Id",
                IsDESC       = false
            };

            OrderModelField[] orderByExpression = new OrderModelField[] {
                idOrder
            };

            Page <Sys_Permission> page = this._permissionRepository.FindPage(ContextDB.managerDBContext, predicate, orderByExpression, form.page, form.rows);

            if (page != null & page.ResultList.Count > 0)
            {
                List <Sys_Module> list = this._moduleRepository.Entities(ContextDB.managerDBContext, t => 1 == 1);
                if (list != null && list.Count > 0)
                {
                    foreach (var item in page.ResultList)
                    {
                        Sys_Module model = list.Where(t => t.Id == item.ModuleId).SingleOrDefault();
                        if (model != null)
                        {
                            item.ModuleName = model.Name;
                        }
                    }
                }
            }

            return(page);
        }
Пример #2
0
        public Page <Sys_UserGroup> FindPage(UserGroupVM form)
        {
            Expression <Func <Sys_UserGroup, bool> > predicate = Ext.True <Sys_UserGroup>();
            OrderModelField idOrder = new OrderModelField
            {
                PropertyName = "Id",
                IsDESC       = false
            };

            OrderModelField[] orderByExpression = new OrderModelField[] {
                idOrder
            };

            Page <Sys_UserGroup> page = this._userGroupRepository.FindPage(ContextDB.managerDBContext, predicate, orderByExpression, form.page, form.rows);

            return(page);
        }
Пример #3
0
        public List <Sys_User> Entities(string username)
        {
            //List<Sys_User> list = this.userRepository.Entities(ContextDB.managerDBContext, t => t.UserName == username);
            OrderModelField idOrder = new OrderModelField
            {
                PropertyName = "id",
                IsDESC       = false
            };
            OrderModelField usernameOrder = new OrderModelField
            {
                PropertyName = "Password",
                IsDESC       = false
            };

            OrderModelField[] orderByExpression = new OrderModelField[] {
                idOrder,
                usernameOrder
            };
            List <Sys_User> list = this._userRepository.Entities(ContextDB.managerDBContext, t => t.UserName == username, orderByExpression);

            return(list);
        }
Пример #4
0
        public Page <Sys_User> FindPage(UserVM form)
        {
            Expression <Func <Sys_User, bool> > predicate = Ext.True <Sys_User>();

            if (!string.IsNullOrEmpty(form.UserName))
            {
                predicate = predicate.And(s => s.UserName.Contains(form.UserName));
            }
            if (!string.IsNullOrEmpty(form.BeginDate))
            {
                DateTime dt = DateTime.Parse(form.BeginDate);
                predicate = predicate.And(s => s.UpdateDate >= dt);
            }
            if (!string.IsNullOrEmpty(form.EndDate))
            {
                DateTime dt = Ext.ToDate(form.EndDate);
                predicate = predicate.And(s => s.UpdateDate <= dt);
            }
            if (!string.IsNullOrEmpty(form.SelectUserNameKey))
            {
                int id = Ext.ToInt(form.SelectUserNameKey);
                predicate = predicate.And(s => s.Id == id);
            }

            OrderModelField idOrder = new OrderModelField
            {
                PropertyName = "Id",
                IsDESC       = false
            };

            OrderModelField[] orderByExpression = new OrderModelField[] {
                idOrder
            };

            Page <Sys_User> page = this._userRepository.FindPage(ContextDB.managerDBContext, predicate, orderByExpression, form.page, form.rows);

            return(page);
        }