public DataTable GetRoleUsers(string roleCode) { string strSql = "select Us.ID,Us.UserName from Role R, RoleUser U," + DBHelperProxy.FormatTable("User") + " Us where R.ID=U.RoleID and U.UserID=Us.ID And R.Code='" + roleCode + "' And (R.UnitID =0 Or R.UnitID=" + this.unitID + ")"; DataTable dt = DBHelperProxy.GetDataSet(strSql).Tables[0]; return(dt); }
public DataTable GetList(long typeid) { string strSql = "SELECT ID,Name,Code,Sequence,TypeID,Flag, UnitID,Remark FROM Role Where Code<>'Developor' And Code<>'System' And Code<>'Audit' And Code<>'Admin' And (UnitID =0 Or UnitID=" + this.unitID + ")"; if (typeid != 0) { strSql += " And TypeID=" + typeid; } strSql += " order by sequence"; return(DBHelperProxy.GetDataSet(strSql).Tables[0]); }
/// <summary> /// 获得某个用户的所有角色 /// </summary> /// <returns></returns> public List <int> GetUserRoles(int userID, int UnitID) { string strSql = "select RoleID from RoleUser where UserID=" + userID; List <int> roleIDs = new List <int>(); DataTable dt = DBHelperProxy.GetDataSet(strSql).Tables[0]; foreach (DataRow dr in dt.Rows) { roleIDs.Add((int)dr["RoleID"]); } return(roleIDs); }
public List <int> GetUserIDs(string roleCode) { string strSql = "select U.UserID from Role R, RoleUser U where R.ID=U.RoleID And R.Code='" + roleCode + "' And (R.UnitID =0 Or R.UnitID=" + this.unitID + ")"; DataTable dt = DBHelperProxy.GetDataSet(strSql).Tables[0]; List <int> lstUserIDs = new List <int>(); foreach (DataRow dr in dt.Rows) { lstUserIDs.Add((int)dr["UserID"]); } return(lstUserIDs); }
/// <summary> /// 获得角色用户 /// </summary> /// <param name="iRoleID"></param> /// <returns></returns> public List <int> GetUserIDs(int iRoleID) { string strSql = "select UserID from RoleUser where RoleID=" + iRoleID + " And (UnitID =0 Or UnitID=" + this.unitID + ")"; DataTable dt = DBHelperProxy.GetDataSet(strSql).Tables[0]; List <int> lstUserIDs = new List <int>(); foreach (DataRow dr in dt.Rows) { lstUserIDs.Add((int)dr["UserID"]); } return(lstUserIDs); }
/// <summary> /// 获得角色模块ID集合 /// </summary> /// <param name="iRoleID"></param> /// <returns></returns> public List <int> GetModuleIDs(int iRoleID, int sUnitID) { string strSql = "select ModuleID from ModuleAccess where flag=1 and UserRoleID=" + iRoleID + " And UnitID=" + sUnitID; DataTable dt = DBHelperProxy.GetDataSet(strSql).Tables[0]; List <int> lstModuleIDs = new List <int>(); foreach (DataRow dr in dt.Rows) { lstModuleIDs.Add((int)dr["ModuleID"]); } return(lstModuleIDs); }
/// <summary> /// 获得根ID /// </summary> /// <returns></returns> public static int GetRootID() { string strSql = "select ID from Dept where ParentID=0"; DataTable dt = DBHelperProxy.GetDataSet(strSql).Tables[0]; int iRootID; if (dt.Rows.Count > 0) { iRootID = (int)dt.Rows[0]["ID"]; } else { strSql = "insert into Dept ( Name, ParentID, Layer, Path, Sequence, IsStop) " + "values('根部门',0,0,',',0,1)"; DBHelperProxy.ExecuteNonQuery(strSql); iRootID = GetRootID(); } return(iRootID); }
public List <int> GetModuleIDs(List <int> RoleIDs, int UnitID) { string strRoleIDs = "0"; foreach (int id in RoleIDs) { strRoleIDs += "," + id; } string strSql = "select ModuleID from ModuleAccess where flag=1 and UserRoleID in (" + strRoleIDs + ") And (UnitID =0 Or UnitID=" + UnitID + ")"; DataTable dt = DBHelperProxy.GetDataSet(strSql).Tables[0]; List <int> ModuleIDs = new List <int>(); foreach (DataRow dr in dt.Rows) { ModuleIDs.Add((int)dr["ModuleID"]); } return(ModuleIDs); }
/// <summary> /// 获得本单位所有部门列表 /// </summary> /// <returns></returns> public DataTable GetList() { string strSql = "select * from Dept where ID>0 and UnitID=" + this.unitID.ToString() + " order by sequence"; return(DBHelperProxy.GetDataSet(strSql).Tables[0]); }
/// <summary> /// 获取特定单位下的部门ID Name Sequence /// 人事专用 /// </summary> /// <returns></returns> public DataTable GetDict() { string strSql = "select ID,Name,sequence from Dept where unitID=" + unitID + " order by sequence"; return(DBHelperProxy.GetDataSet(strSql).Tables[0]); }
public DataTable GetUnits() { string strSql = "select * from Dept where isUnit = 1 order by sequence"; return(DBHelperProxy.GetDataSet(strSql).Tables[0]); }
/// <summary> /// 获得某一级部门下的子部门列表 /// </summary> /// <param name="parentID"></param> /// <returns></returns> public DataTable GetList(int parentID) { string strSql = "select * from Dept where ID>0 and ParentID=" + parentID + " order by sequence"; return(DBHelperProxy.GetDataSet(strSql).Tables[0]); }
/// <summary> /// 获得所有部门列表 /// </summary> /// <returns></returns> public DataTable GetAllList() { string strSql = "select * from Dept where ID>0 order by sequence"; return(DBHelperProxy.GetDataSet(strSql).Tables[0]); }
public DataSet GetDictItems(int dirID) { string strSQL = "select * from DictItem where DirID =" + dirID; return(DBHelperProxy.GetDataSet(strSQL)); }