/// <summary> /// 取有权限的操作列表(仅资源权限) /// </summary> /// <param name="code"></param> /// <param name="className"></param> /// <returns></returns> public EntityData GetOperationEntityDataOfResource(string code, string className) { try { string stationCodes = BuildStationCodeString(this.BuildStationCodes()); object[] ooo = new object[] { code , SystemClassDescription.GetItemClassCode(className) , this.UserCode , stationCodes , SystemClassDescription.GetItemTableName(className) , SystemClassDescription.GetItemKeyColumnName(className) , SystemClassDescription.GetItemTypeColumnName(className) , SystemClassDescription.GetItemCreateUserColumnName(className) }; string selfAccessString = String.Format(" ( AccessRange.ResourceCode = ( Select ResourceCode from Resource where RelationCode='{0}' and ClassCode='{1}' ) and ( ( AccessRange.AccessRangeType=0 and AccessRange.relationCode = '{2}' ) or ( AccessRange.AccessRangeType=1 and AccessRange.relationCode in ( {3} ) and ( RoleLevel <> 1 or RoleLevel is null ) ) or ( AccessRange.AccessRangeType=1 and AccessRange.relationCode in ( {3} ) and RoleLevel = 1 and {4}.{7}='{2}' ) ) ) " , ooo); string sss = String.Format("select accessrange.* from accessrange , {4} where substring (AccessRange.operationCode,1,4 )='{1}' and {4}.{5} = '{0}' and ( " + selfAccessString + " )" , ooo); QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("AccessRange", sss); qa.Dispose(); return(entity); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取用户对某个资源类的权限表 /// </summary> /// <param name="className"></param> /// <returns></returns> public ArrayList GetClassRight(string className) { try { string stationCodes = BuildStationCodeString(this.BuildStationCodes()); object[] ooo = new object[] { SystemClassDescription.GetItemClassCode(className) , this.UserCode , stationCodes }; string s0 = String.Format(" ( AccessRange.AccessRangeType=0 and AccessRange.relationCode = '{1}' ) " , ooo); string s1 = ""; if (stationCodes != "") { s1 = String.Format(" or ( AccessRange.AccessRangeType=1 and AccessRange.relationCode in ( {2} ) ) " , ooo); } string sss = String.Format("select distinct(operationCode) from accessrange where substring(operationcode,1,4)='{0}' and isnull( groupCode ,'') <> '' and ( {1} {2} )" , new object[] { SystemClassDescription.GetItemClassCode(className), s0, s1 }); QueryAgent qa = new QueryAgent(); DataSet entity = qa.ExecSqlForDataSet(sss); qa.Dispose(); ArrayList ar = new ArrayList(); foreach (DataRow dr in entity.Tables[0].Rows) { if (!dr.IsNull("OperationCode")) { string oCode = (string)dr["OperationCode"]; if (!ar.Contains(oCode)) { ar.Add(oCode); } } } entity.Dispose(); return(ar); } catch (Exception ex) { throw ex; } }
public static string CheckDeleteSystemGroup(string GroupCode) { string text13; try { string text = ""; EntityData systemGroupByCode = SystemManageDAO.GetSystemGroupByCode(GroupCode); if (systemGroupByCode.HasRecord()) { string classCode = systemGroupByCode.GetString("ClassCode"); string parentFullID = systemGroupByCode.GetString("FullID"); string itemInfoByClassCode = SystemClassDescription.GetItemInfoByClassCode(classCode); if (itemInfoByClassCode != "") { EntityData systemGroupIncludeAllChildByParentFullID = SystemManageDAO.GetSystemGroupIncludeAllChildByParentFullID(parentFullID); string text5 = ""; foreach (DataRow row in systemGroupIncludeAllChildByParentFullID.CurrentTable.Rows) { string text6 = row["GroupCode"].ToString(); if (text5 != "") { text5 = text5 + ","; } text5 = text5 + "'" + text6 + "'"; } string[] textArray = itemInfoByClassCode.Split(",".ToCharArray()); foreach (string text7 in textArray) { if (text7 != "") { string[] textArray2 = text7.Split("|".ToCharArray()); string text8 = textArray2[0]; string text9 = textArray2[1]; string queryString = string.Format("select top 1 {1} from {0} where {1} in ({2})", text8, text9, text5); QueryAgent agent = new QueryAgent(); try { try { string code = ConvertRule.ToString(agent.ExecuteScalar(queryString)); if (code != "") { EntityData data3 = SystemManageDAO.GetSystemGroupByCode(code); string text12 = data3.GetString("SortID") + " " + data3.GetString("GroupName"); data3.Dispose(); return(string.Format("表 {0} 中已存在类别为 {1} 的记录,不能删除该类别", text8, text12)); } } catch { } } finally { agent.Dispose(); } } } } } systemGroupByCode.Dispose(); text13 = text; } catch (Exception exception) { throw exception; } return(text13); }