示例#1
0
        /// <summary>
        /// 模块导航
        /// </summary>
        /// <returns></returns>
        public List <sys_menu> GetTopMenuList()
        {
            var list = new List <sys_menu>();

            if (UserCookie.IsSuper)
            {
                list =
                    Sqldb.Queryable <sys_menu>()
                    .Where(s => s.parent_id == 0)
                    .OrderBy(s => s.menu_sort)
                    .ToList();
            }
            else
            {
                list =
                    Sqldb.Queryable <sys_menu, sys_role_authorize>(
                        (m, r) => new object[] { JoinType.Inner, m.id == r.menu_id })
                    .Where((m, r) => r.role_id == UserCookie.SysRoleId && m.parent_id == 0)
                    .OrderBy((m, r) => m.menu_sort)
                    .Select((m, r) => m)
                    .ToList();
            }

            return(list);
        }
示例#2
0
        /// <summary>
        /// 数据表格
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List <sys_menu> GetMenuList(BootstrapGridDto param)
        {
            //int total = 0;
            var query = Sqldb.Queryable <sys_menu>().OrderBy(s => s.menu_sort).ToList();

            return(query);
        }
示例#3
0
        public List <ZtreeDto> GetRoleMenuTree(string roleid)
        {
            var menu = _sysmenuRepository.Queryable <sys_menu>().OrderBy(s => s.menu_sort).Select(s => new ZtreeDto()
            {
                id = s.id.ToString(), name = s.menu_name, pId = s.parent_id.ToString()
            }).ToList();
            var func = Sqldb.Queryable <sys_menu_ref_operate, sys_operate, sys_menu>((f, o, m) => f.operate_id == o.id && f.menu_id == m.id).Select((f, o, m) => new ZtreeDto()
            {
                id = f.operate_id.ToString(), pId = f.menu_id.ToString(), name = o.func_cname
            }).ToList();

            menu.AddRange(func);
            var role = _sysroleauthorizeRepository.Queryable <sys_role_authorize>().Where(s => s.role_id == SqlFunc.ToInt64(roleid)).Select(s => new { s.menu_id, s.menu_pid }).ToList();

            if (role.Any())
            {
                foreach (var item in menu)
                {
                    var isok = role.Where(s => s.menu_id == item.id.ToInt64() && s.menu_pid == item.pId.ToInt64()).Count();
                    if (isok > 0)
                    {
                        item.checkstate = true;
                    }
                }
            }
            return(menu);
        }
示例#4
0
 public void AddMenu(sys_menu dto, string funcs)
 {
     dto.id            = IdWorkerHelper.NewId();
     dto.create_time   = DateTime.Now;
     dto.create_person = "admin";
     if (!string.IsNullOrEmpty(dto.menu_url))
     {
         dto.menu_type = 1;
     }
     if (dto.parent_id == 0)
     {
         dto.menu_level = 1;
     }
     else
     {
         dto.menu_level = Sqldb.Queryable <sys_menu>().Where(s => s.id == dto.parent_id).Select(s => s.menu_level).First() + 1;
     }
     Sqldb.Insertable(dto).ExecuteCommand();
     if (!string.IsNullOrEmpty(funcs))
     {
         var funcArray = funcs.Split(',');
         if (funcArray.Length > 0)
         {
             var list = new List <sys_menu_ref_operate>();
             foreach (var func in funcArray)
             {
                 var funcModel = new sys_menu_ref_operate();
                 funcModel.menu_id    = dto.id;
                 funcModel.operate_id = func.ToInt64();
                 list.Add(funcModel);
             }
             Sqldb.Insertable(list).ExecuteCommand();
         }
     }
 }
示例#5
0
 public void UpdateMenu(sys_menu dto, string funcs)
 {
     if (!string.IsNullOrEmpty(dto.menu_url))
     {
         dto.menu_type = 1;
     }
     if (dto.parent_id == 0)
     {
         dto.menu_level = 1;
     }
     else
     {
         dto.menu_level = Sqldb.Queryable <sys_menu>().Where(s => s.id == dto.parent_id).Select(s => s.menu_level).First() + 1;
     }
     Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_time, s.create_person }).ExecuteCommand();
     Sqldb.Deleteable <sys_menu_ref_operate>().Where(s => s.menu_id == dto.id).ExecuteCommand();
     if (!string.IsNullOrEmpty(funcs))
     {
         var funcArray = funcs.Split(',');
         if (funcArray.Length > 0)
         {
             var list = new List <sys_menu_ref_operate>();
             foreach (var func in funcArray)
             {
                 var funcModel = new sys_menu_ref_operate();
                 funcModel.menu_id    = dto.id;
                 funcModel.operate_id = func.ToInt64();
                 list.Add(funcModel);
             }
             Sqldb.Insertable(list).ExecuteCommand();
         }
     }
 }
示例#6
0
        public bool IsExist(int areaCode, long id)
        {
            bool codeCount = false;

            if (id == 0)
            {
                var count = Sqldb.Queryable <sys_citys>().Where(s => s.zipcode == areaCode).Count();

                if (count > 0)
                {
                    codeCount = true;
                }
            }
            else
            {
                var count = Sqldb.Queryable <sys_citys>().Where(s => s.zipcode == areaCode && s.id != id).Count();

                if (count > 0)
                {
                    codeCount = true;
                }
            }

            return(codeCount);
        }
示例#7
0
        /// <summary>
        /// 迭代获取区域下拉
        /// </summary>
        /// <returns></returns>
        public List <CitySelDto> GetCitySel()
        {
            var data = new List <CitySelDto>();
            var list = Sqldb.Queryable <sys_citys>().OrderBy(s => s.zipcode).Select(s => new CitySelDto()
            {
                Id = s.id, Name = s.name, ParentId = s.province_code
            }).ToList();

            var fdata = list.Where(s => s.ParentId == 0).ToList();

            foreach (var item in fdata)
            {
                data.Add(item);
                var city = list.Where(s => s.ParentId == item.Id).ToList();
                if (city.Any())
                {
                    item.Children = city;
                    foreach (var citem in city)
                    {
                        InitChildList(list, citem, citem.Id);
                        list.Add(citem);
                    }
                }
            }


            return(data);
        }
示例#8
0
        public sys_user GetUserById(string id)
        {
            var data = Sqldb.Queryable <sys_user>().Where(s => s.id == SqlFunc.ToInt64(id)).First();

            data.pass_word = Encrypt.DesDecrypt(data.pass_word.Trim());
            return(data);
        }
示例#9
0
 public List <sys_area> GetCountys(long pid)
 {
     if (pid == 0)
     {
         pid = 52;
     }
     return(Sqldb.Queryable <sys_area>().Where(s => s.province_code == pid && s.city_level == 3).ToList());
 }
示例#10
0
 public List <long> GetMenuRefOpt(string id)
 {
     return
         (Sqldb.Queryable <sys_menu_ref_operate>()
          .Where(s => s.menu_id == SqlFunc.ToInt64(id))
          .Select(s => s.operate_id)
          .ToList());
 }
示例#11
0
        /// <summary>
        /// 获取菜单表格
        /// </summary>
        /// <returns></returns>
        public List <sys_menu> GetMenuList()
        {
            var query = Sqldb.Queryable <sys_menu>()
                        .OrderBy(s => s.menu_sort)
                        .ToList();

            return(query);
        }
 public List <sys_dictionary> GetGridDataBypId(long pid)
 {
     //if (pid > 0)
     //{
     return(Sqldb.Queryable <sys_dictionary>().OrderBy(s => s.sort_num).Where(s => s.parent_id == pid).ToList());
     //}
     //return new List<sys_dictionary>();
 }
示例#13
0
        public List <ZtreeDto> GetProvince()
        {
            var query = Sqldb.Queryable <sys_citys>().Where(s => s.province_code == 0)
                        .Select(s => new ZtreeDto()
            {
                id = s.zipcode.ToString(), name = s.name, pId = "0"
            }).ToList();

            return(query);
        }
示例#14
0
        public BootstrapGridDto GetData(BootstrapGridDto param)
        {
            int total = 0;
            var query = Sqldb.Queryable <hangfire_jobs>().OrderBy(s => s.id)
                        .ToPageList(param.page, param.limit, ref total);

            param.rows  = query;
            param.total = total;
            return(param);
        }
示例#15
0
        public List <sys_menu> GetRoleAuthMenu(string roleid)
        {
            var data =
                Sqldb.Queryable <sys_menu, sys_role_authorize>((m, r) => m.id == r.menu_id)
                .Where((m, r) => r.role_id == SqlFunc.ToInt64(roleid))
                .Select((m, r) => m)
                .ToList();

            return(data);
        }
示例#16
0
        public BootstrapGridDto GetData(BootstrapGridDto param, string accountName)
        {
            var query = Sqldb.Queryable <sys_user, sys_role>((u, r) => new object[] { JoinType.Left, u.sys_role_id == r.id }).Where((u, r) => !u.is_super);
            int total = 0;
            var data  = query.OrderBy((u, r) => u.create_time, OrderByType.Desc).Select((u, r) => new { Id = u.id, AccountName = u.account_name, RealName = u.real_name, MobilePhone = u.mobile_phone, Email = u.email, CreateTime = u.create_time, RoleName = r.role_name }).ToPageList(param.page, param.limit, ref total);

            param.rows  = data;
            param.total = total;
            return(param);
        }
示例#17
0
 /// <summary>
 /// 获取菜单下按钮
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public List <SysFuncDto> GetMenuRefOpt(string id)
 {
     return
         (Sqldb.Queryable <sys_operate>()
          .Where(s => s.menu_id == SqlFunc.ToInt64(id))
          .Select(s => new SysFuncDto()
     {
         id = s.id, title = s.func_cname, funcname = s.func_name, icon = s.func_icon, url = s.func_url, intable = s.in_table
     })
          .ToList());
 }
示例#18
0
        public BootstrapGridDto GetData(BootstrapGridDto param)
        {
            int total = 0;
            var query = Sqldb.Queryable <sys_role>()
                        .OrderBy(s => s.sort)
                        .ToPageList(param.page, param.limit, ref total);

            param.total = total;
            param.rows  = query;
            return(param);
        }
        public List <ZtreeDto> GetDicZtree()
        {
            var data = Sqldb.Queryable <sys_dictionary>().OrderBy(s => s.sort_num).Where(s => s.parent_id == 0).Select(s => new ZtreeDto()
            {
                id   = s.id.ToString(),
                name = s.dic_name,
                pId  = s.parent_id.ToString()
            }).ToList();

            return(data);
        }
示例#20
0
        public DataGridEx GetFuncList(DataGridEx param)
        {
            int total = 0;
            var query = Sqldb.Queryable <sys_func>()
                        .OrderBy(s => s.func_sort)
                        .ToPageList(param.pageCurrent, param.pageSize, ref total);

            param.list  = query;
            param.total = total;
            return(param);
        }
示例#21
0
        public DataGridEx GetMenuList(DataGridEx param)
        {
            int total = 0;
            var query = Sqldb.Queryable <sys_menu>()
                        .OrderBy(s => s.create_time, OrderByType.Desc)
                        .ToPageList(param.pageCurrent, param.pageSize, ref total);

            param.list  = query;
            param.total = total;
            return(param);
        }
        /// <summary>
        /// 更新字典
        /// </summary>
        /// <param name="dto"></param>
        public void UpdateDicData(sys_dictionary dto)
        {
            if (dto.parent_id != 0)
            {
                var dicCode =
                    Sqldb.Queryable <sys_dictionary>().Where(s => s.id == dto.parent_id).Select(s => s.dic_code).First();

                dto.dic_code = dicCode;
            }
            Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_person, s.create_time }).ExecuteCommand();
        }
示例#23
0
        public BootstrapGridDto GetData(BootstrapGridDto param)
        {
            var query = Sqldb.Queryable <sys_log>();
            int total = 0;
            var data  = query.OrderBy(u => u.logtime, OrderByType.Desc)
                        .Select(u => new { Id = u.id, Operation = u.operation, LogTime = u.logtime, LogtType = u.logtype, LogMsg = u.logmsg, LogLevel = u.loglevel, LogIP = u.logip })
                        .ToPageList(param.page, param.limit, ref total);

            param.rows  = data;
            param.total = total;
            return(param);
        }
示例#24
0
        public BootstrapGridDto GetData(BootstrapGridDto param)
        {
            var query = Sqldb.Queryable <demo>();
            int total = 0;
            var data  = query.OrderBy(u => u.create_time, OrderByType.Desc)
                        .Select(u => new { Id = u.id, Name = u.name, Sex = u.sex, Age = u.age, Remark = u.remark, CreateTime = u.create_time, CreatePerson = u.create_person })
                        .ToPageList(param.page, param.limit, ref total);

            param.rows  = data;
            param.total = total;
            return(param);
        }
        public BootstrapGridDto GetData(BootstrapGridDto param)
        {
            int total = 0;
            var data  = Sqldb.Queryable <sys_operate>()
                        .OrderBy(s => s.func_sort)
                        .ToPageList(param.page, param.limit, ref total);

            param.rows  = data;
            param.total = total;

            return(param);
        }
示例#26
0
        public BootstrapGridDto GetData(BootstrapGridDto param)
        {
            int total = 0;
            var data  = Sqldb.Queryable <sys_operate>()
                        .OrderBy(s => s.create_time, OrderByType.Desc)
                        .Select(u => new { Id = u.id, FuncName = u.func_name, FuncCName = u.func_cname, FuncIcon = u.func_icon, FuncSort = u.func_sort, FuncClass = u.func_class, CreateTime = u.create_time, CreatePerson = u.create_person })
                        .ToPageList(param.page, param.limit, ref total);

            param.rows  = data;
            param.total = total;
            return(param);
        }
示例#27
0
        public List <RoleMenuDto> GetRoleMenu()
        {
            var list = Sqldb.Queryable <sys_menu>().OrderBy(s => s.menu_sort).Select(s => new RoleMenuDto()
            {
                id        = s.id,
                menu_name = s.menu_name,
                menu_sort = s.menu_sort,
                menu_url  = s.menu_url,
                parent_id = s.parent_id
            }).ToList();

            return(list);
        }
示例#28
0
        public void InsertDicData(sys_dictionary dto)
        {
            dto.id            = IdWorkerHelper.NewId();
            dto.create_person = UserCookie.AccountName;
            dto.create_time   = DateTime.Now;
            if (dto.parent_id != 0)
            {
                var dicCode =
                    Sqldb.Queryable <sys_dictionary>().Where(s => s.id == dto.parent_id).Select(s => s.dic_code).First();

                dto.dic_code = dicCode;
            }
            Sqldb.Insertable(dto).ExecuteCommand();
        }
示例#29
0
        public List <sys_operate> GetOperateByRole(string menuId)
        {
            var list = new List <sys_operate>();

            if (UserCookie.IsSuper)
            {
                list = Sqldb.Queryable <sys_operate, sys_menu_ref_operate>((f, m) => f.id == m.operate_id && m.menu_id == SqlFunc.ToInt64(menuId)).Select((f, m) => f).ToList();
            }
            else
            {
                list = Sqldb.Queryable <sys_operate, sys_role_authorize>((f, r) => f.id == r.menu_id).Where((f, r) => r.role_id == UserCookie.SysRoleId && r.menu_pid == SqlFunc.ToInt64(menuId)).Select((f, m) => f).ToList();
            }
            return(list);
        }
示例#30
0
        /// <summary>
        /// 数据列表
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List <CityTreeDto> GetData(long pid)
        {
            var list  = new List <CityTreeDto>();
            var query = Sqldb.Queryable <sys_citys>().Where(s => s.province_code == pid).ToList();

            list = query.Where(s => s.city_code == 0)
                   .Select(s => new CityTreeDto()
            {
                name = s.name, pid = s.city_code, zipcode = s.zipcode
            }).ToList();
            var cunty = query.Where(s => s.city_level == 3)
                        .Select(s => new CityTreeDto()
            {
                name = s.name, pid = s.city_code, zipcode = s.zipcode
            }).ToList();

            list.AddRange(cunty);
            return(list);
        }