示例#1
0
        /// <summary>
        /// 根据黑名单ID获取对应的用户ID列表
        /// </summary>
        /// <param name="id">黑名单ID</param>
        /// <returns></returns>
        public string GetUserIdList(Int32 Id, IsForbid isForbid = IsForbid.否)
        {
            string sql = string.Format(@"SELECT UserId FROM {0}BlackIP_User m INNER JOIN {0}BlackIP t
            ON m.BlackId=t.Id WHERE t.Id = '{1}' and (t.IsForbid = {2} or 0 = {2}) and t.StartTime <= GETDATE() and t.EndTime >= GETDATE()", SQLServerPortal.gc._securityTablePre, Id, (short)isForbid);

            return(SqlValueList(sql));
        }
示例#2
0
文件: OU.cs 项目: 15831944/winform-1
        /// <summary>
        /// 获取树形结构的机构列表
        /// </summary>
        public List <OUNodeInfo> GetTree(IsDelete isDelete = IsDelete.否, IsForbid isForbid = IsForbid.否)
        {
            List <OUNodeInfo> arrReturn = new List <OUNodeInfo>();
            string            sql       = string.Format("Select * From {0} Order By Pid, Name ", tableName);

            DataTable dt   = base.SqlTable(sql);
            string    sort = string.Format("{0} {1}", GetSafeFileName(sortField), isDescending ? "DESC" : "ASC");

            DataRow[] dataRows = dt.Select(string.Format(" Pid = {0} and (IsDelete = {1} or 0 = {1}) and (IsForbid = {2} or 0 = {2})", -1, (short)isDelete, (short)isForbid), sort);
            for (int i = 0; i < dataRows.Length; i++)
            {
                Int32      id           = dataRows[i]["Id"].ToString().ToInt32();
                OUNodeInfo menuNodeInfo = GetNode(id, dt);
                arrReturn.Add(menuNodeInfo);
            }

            return(arrReturn);
        }
示例#3
0
        public List <RoleInfo> GetRolesByUserId(Int32 userId, IsDelete isDelete = IsDelete.否, IsForbid isForbid = IsForbid.否)
        {
            string sql = string.Format(@"SELECT a.Id, a.RoleCode, a.Name, a.Remark, a.Seq, 
                                                a.CompanyId, a.CompanyName, a.CreatorId, a.CreatorTime, a.EditorId, 
                                                a.LastUpdateTime, a.IsDelete, a.IsForbid 
                                          FROM {0}Role a INNER JOIN {0}User_Role b On a.Id=b.RoleId 
                                         WHERE b.UserId = {1} and (a.IsDelete = {2} or 0 = {2}) and (a.IsForbid = {3} or 0 = {3})", SQLServerPortal.gc._securityTablePre, userId, (short)isDelete, (short)isForbid);

            return(this.GetList(sql, null));
        }
示例#4
0
        /// <summary>
        /// 根据用户ID和授权类型获取列表
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="type">授权类型</param>
        /// <returns></returns>
        public List <BlackIPInfo> FindByUser(Int32 userId, AuthorizeType authorizeType, IsForbid isForbid = IsForbid.否)
        {
            string sql = string.Format(@"SELECT t.* FROM {0}BlackIP t INNER JOIN {0}BlackIP_User m ON t.Id=m.BlackId WHERE m.UserId = {1} and t.AuthorizeType={2} and (t.IsForbid = {3} or 0 = {3}) ", SQLServerPortal.gc._securityTablePre, userId, (short)authorizeType, (short)isForbid);

            return(GetList(sql, null));
        }
示例#5
0
文件: OU.cs 项目: 15831944/winform-1
        private List <OUNodeInfo> GetRecursionOu(DataTable dt, Int32 mainOUId, IsDelete isDelete = IsDelete.否, IsForbid isForbid = IsForbid.否)
        {
            List <OUNodeInfo> arrReturn = new List <OUNodeInfo>();
            string            sort      = string.Format("{0} {1}", GetSafeFileName(sortField), isDescending ? "DESC" : "ASC");

            DataRow[] dataRows = dt.Select(string.Format(" Pid = {0} and (IsDelete = {1} or 0 = {1}) and (IsForbid = {2} or 0 = {2})", mainOUId, (short)isDelete, (short)isForbid), sort);
            for (int i = 0; i < dataRows.Length; i++)
            {
                Int32      Id           = dataRows[i]["Id"].ToString().ToInt32();
                OUNodeInfo menuNodeInfo = GetNode(Id, dt);
                arrReturn.Add(menuNodeInfo);

                // 判断是否存在子节点,如果存在递归
                DataRow[] dataRowsChildNodes = dt.Select(string.Format(" Pid = {0} and (IsDelete = {1} or 0 = {1}) and (IsForbid = {2} or 0 = {2})", Id, (short)isDelete, (short)isForbid), sort);
                if (dataRowsChildNodes.Length > 0)
                {
                    menuNodeInfo.Children = GetRecursionOu(dt, Id);
                }
            }

            return(arrReturn);
        }
示例#6
0
文件: OU.cs 项目: 15831944/winform-1
        /// <summary>
        /// 获取指定机构下面的树形列表
        /// </summary>
        /// <param name="mainOUId">指定机构Id</param>
        public List <OUNodeInfo> GetTreeById(int mainOUId, IsDelete isDelete = IsDelete.否, IsForbid isForbid = IsForbid.否)
        {
            string sql = string.Format("Select * From {0} WHERE (IsDelete = {1} or 0 = {1}) and (IsForbid = {2} or 0 = {2}) Order By Pid, Name ", tableName, (short)isDelete, (short)isForbid);

            DataTable dt = SqlTable(sql);

            return(GetRecursionOu(dt, mainOUId));
        }
示例#7
0
文件: OU.cs 项目: 15831944/winform-1
        private OUNodeInfo GetNode(Int32 Id, DataTable dt, IsDelete isDelete = IsDelete.否, IsForbid isForbid = IsForbid.否)
        {
            OUInfo     ouInfo     = this.FindById(Id);
            OUNodeInfo ouNodeInfo = new OUNodeInfo(ouInfo);

            string sort = string.Format("{0} {1}", GetSafeFileName(sortField), isDescending ? "DESC" : "ASC");

            DataRow[] dChildRows = dt.Select(string.Format(" Pid={0} and (IsDelete = {1} or 0 = {1}) and (IsForbid = {2} or 0 = {2})", Id, (short)isDelete, (short)isForbid), sort);

            for (int i = 0; i < dChildRows.Length; i++)
            {
                Int32      childId       = dChildRows[i]["Id"].ToString().ToInt32();
                OUNodeInfo childNodeInfo = GetNode(childId, dt);
                ouNodeInfo.Children.Add(childNodeInfo);
            }
            return(ouNodeInfo);
        }
示例#8
0
文件: OU.cs 项目: 15831944/winform-1
        private List <OUInfo> GetOU(Int32 Id, DataTable dt, IsDelete isDelete = IsDelete.否, IsForbid isForbid = IsForbid.否)
        {
            List <OUInfo> list = new List <OUInfo>();

            OUInfo ouInfo = this.FindById(Id);

            list.Add(ouInfo);

            string sort = string.Format("{0} {1}", GetSafeFileName(sortField), isDescending ? "DESC" : "ASC");

            DataRow[] dChildRows = dt.Select(string.Format(" Pid={0} and (IsDelete = {1} or 0 = {1}) and (IsForbid = {2} or 0 = {2})", Id, (short)isDelete, (short)isForbid), sort);
            for (Int32 i = 0; i < dChildRows.Length; i++)
            {
                Int32         childId   = dChildRows[i]["Id"].ToString().ToInt32();
                List <OUInfo> childList = GetOU(childId, dt);
                list.AddRange(childList);
            }
            return(list);
        }
示例#9
0
文件: OU.cs 项目: 15831944/winform-1
        /// <summary>
        /// 根据指定机构节点ID,获取其下面所有机构列表
        /// </summary>
        /// <param name="parentId">指定机构节点ID</param>
        /// <returns></returns>
        public List <OUInfo> GetAllOUsByParent(Int32 parentId, IsDelete isDelete = IsDelete.否, IsForbid isForbid = IsForbid.否)
        {
            List <OUInfo> list = new List <OUInfo>();
            string        sql  = string.Format("Select * From {0} Where (IsDelete = {1} or 0 = {1}) and (IsForbid = {2} or 0 = {2}) Order By Pid, Name ", tableName, (short)isDelete, (short)isForbid);

            DataTable dt   = SqlTable(sql);
            string    sort = string.Format("{0} {1}", GetSafeFileName(sortField), isDescending ? "DESC" : "ASC");

            DataRow[] dataRows = dt.Select(string.Format(" Pid = {0}", parentId), sort);
            for (Int32 i = 0; i < dataRows.Length; i++)
            {
                Int32 id = dataRows[i]["Id"].ToString().ToInt32();
                list.AddRange(GetOU(id, dt));
            }

            return(list);
        }
示例#10
0
文件: OU.cs 项目: 15831944/winform-1
        public List <OUInfo> GetOUsByUser(Int32 userId, IsDelete isDelete = IsDelete.否, IsForbid isForbid = IsForbid.否)
        {
            string sql = string.Format("SELECT * FROM {0}OU a INNER JOIN {0}OU_User On a.Id={0}OU_User.OuId WHERE UserId = {1} and (a.IsDelete = {2} or 0 = {2}) and (a.IsForbid = {3} or 0 = {3})", SQLServerPortal.gc._securityTablePre, userId, (short)isDelete, (short)isForbid);

            return(this.GetList(sql, null));
        }