Ejemplo n.º 1
0
        public List <BcUserRoleEntity> GetBcUserRoleList(int?userId = 0, int?roleId = 0)
        {
            string sql = @"SELECT a.*,b.UserName,c.RoleName FROM Bc_UserRole a
                            LEFT JOIN Bc_UserInfo b ON a.UserId = b.UserId
                            LEFT JOIN Bc_Role c ON a.RoleId = c.RoleId WHERE b.DeleteFlag = 0 ";

            if (userId != 0)
            {
                sql += " AND a.UserId = @UserId ";
            }
            if (roleId != 0)
            {
                sql += " AND a.RoleId = @RoleId ";
            }
            var dm = Db.GetSqlStringCommand(sql);

            if (userId != 0)
            {
                Db.AddInParameter(dm, "@UserId", DbType.Int32, userId);
            }
            if (roleId != 0)
            {
                Db.AddInParameter(dm, "@RoleId", DbType.Int32, roleId);
            }
            return(DataTableHepler.DataTableToList <BcUserRoleEntity>(Db.ExecuteDataTable(dm)));
        }
Ejemplo n.º 2
0
        private List <SysModuleEnumEntity> SetSysModuleEnumListCache()
        {
            var dt   = EnumHelper.ToDataTable <SysModuleEnum>(SysEnumNameExBiz.GetDescription);
            var list = DataTableHepler.DataTableToList <SysModuleEnumEntity>(dt);

            DataCache.SetCache(CacheKey, list);
            return(list);
        }
Ejemplo n.º 3
0
        public List <SysPageFuncPointEntity> GetSysPageFuncPointList(string funcPointId)
        {
            var       sql = @"select * FROM [Sys_PageFuncPoint] a
                        where a.FuncPointId = @FuncPointId
                        order by a.PageUrl";
            DbCommand dm  = Db.GetSqlStringCommand(sql);

            Db.AddInParameter(dm, "@FuncPointId", DbType.AnsiString, funcPointId);
            return(DataTableHepler.DataTableToList <SysPageFuncPointEntity>(Db.ExecuteDataTable(dm)));
        }
        private List <OrderListEntity> JsonToObjects(string strJson)
        {
            if (string.IsNullOrEmpty(strJson))
            {
                return(new List <OrderListEntity>());
            }

            DataTable dt = null;

            //去除表名
            strJson = strJson.Substring(strJson.IndexOf("[") + 1);
            strJson = strJson.Substring(0, strJson.LastIndexOf("]"));

            //获取数据
            Regex           rg = new Regex(@"(?<={)[^}]+(?=})");
            MatchCollection mc = rg.Matches(strJson);

            for (int i = 0; i < mc.Count; i++)
            {
                string   strRow  = mc[i].Value;
                string[] strRows = strRow.Split(',');

                //创建表
                if (dt == null)
                {
                    dt = new DataTable();
                    foreach (string str in strRows)
                    {
                        DataColumn dc      = new DataColumn();
                        string[]   strCell = str.Split(':');
                        dc.ColumnName = strCell[0].Replace("\"", "");
                        dt.Columns.Add(dc);
                    }
                    dt.AcceptChanges();
                }

                //增加内容
                DataRow dr = dt.NewRow();
                for (int r = 0; r < strRows.Length; r++)
                {
                    dr[r] = strRows[r].Split(':')[1].Trim().Replace(",", ",").Replace(":", ":").Replace("/", "").Replace("\"", "");
                }
                dt.Rows.Add(dr);
                dt.AcceptChanges();
            }

            if (dt != null)
            {
                return(DataTableHepler.DataTableToList <OrderListEntity>(dt));
            }

            return(new List <OrderListEntity>());
        }
Ejemplo n.º 5
0
        public List <SysMenuEntity> GetSysMenuList(int?menuId = null)
        {
            string sql = @"select * from Sys_Menu a
                            left join Sys_PageFuncPoint b on a.PageUrl = b.PageUrl
                            left join Sys_Relation c ON b.FuncPointId = c.FuncPointId
                            where a.DeleteFlag = 0 ";

            if (menuId != null)
            {
                sql += " and a.MenuId = @MenuId ";
            }
            sql += " Order by MenuLevel,Seq ";
            DbCommand dm = Db.GetSqlStringCommand(sql);

            if (menuId != null)
            {
                Db.AddInParameter(dm, "@MenuId", DbType.Int32, menuId);
            }
            return(DataTableHepler.DataTableToList <SysMenuEntity>(Db.ExecuteDataTable(dm)));
        }
Ejemplo n.º 6
0
        public List <BcUserInfoEntity> GetBcUserInfoList(int?groupId = 0, int?roleId = 0, string userName = "")
        {
            string sql = @"SELECT DISTINCT a.*,d.GroupName FROM Bc_UserInfo a
                            LEFT JOIN Bc_UserRole b ON a.UserId = b.UserId
                            LEFT JOIN Bc_Role c ON b.RoleId = c.RoleId 
                            LEFT JOIN Bc_Group d ON a.GroupId = d.GroupId
                            WHERE a.DeleteFlag = 0 ";

            if (roleId != 0)
            {
                sql += " AND c.RoleId = @RoleId ";
            }
            if (groupId != 0)
            {
                sql += " AND a.GroupId = @GroupId ";
            }
            if (!string.IsNullOrEmpty(userName))
            {
                sql += " AND a.UserName like @UserName ";
            }
            using (DbCommand dm = Db.GetSqlStringCommand(sql))
            {
                if (roleId != 0)
                {
                    Db.AddInParameter(dm, "@RoleId", DbType.Int32, roleId);
                }
                if (groupId != 0)
                {
                    Db.AddInParameter(dm, "@GroupId", DbType.Int32, groupId);
                }
                if (!string.IsNullOrEmpty(userName))
                {
                    Db.AddInParameter(dm, "@UserName", DbType.AnsiString, "%" + userName + "%");
                }
                return(DataTableHepler.DataTableToList <BcUserInfoEntity>(Db.ExecuteDataTable(dm)));
            }
        }