public static string SetResourceAccessRange(string code, string classCode, string unitCode, ArrayList ar, bool isRefreshRight) { string text3; try { string resourceCode = GetResourceCode(code, classCode); bool flag = resourceCode == ""; EntityData entity = null; if (flag) { resourceCode = SystemManageDAO.GetNewSysCode("ResourceCode"); entity = new EntityData("Standard_Resource"); DataRow newRecord = entity.GetNewRecord(); newRecord["ResourceCode"] = resourceCode; newRecord["ClassCode"] = classCode; newRecord["UnitCode"] = unitCode; newRecord["RelationCode"] = code; entity.AddNewRecord(newRecord); } else { entity = ResourceDAO.GetStandard_ResourceByCode(resourceCode); entity.CurrentRow["unitCode"] = unitCode; } if (isRefreshRight) { entity.DeleteAllTableRow("AccessRange"); } entity.SetCurrentTable("AccessRange"); int count = ar.Count; for (int i = 0; i < count; i++) { AccessRange range = (AccessRange)ar[i]; foreach (string text2 in range.Operations.Split(new char[] { ',' })) { DataRow row = entity.GetNewRecord(); row["AccessRangeCode"] = SystemManageDAO.GetNewSysCode("AccessRangeCode"); row["ResourceCode"] = resourceCode; row["UnitCode"] = unitCode; row["OperationCode"] = text2; row["AccessRangeType"] = range.AccessRangeType; row["RelationCode"] = range.RelationCode; entity.AddNewRecord(row); } } ResourceDAO.SubmitAllStandard_Resource(entity); entity.Dispose(); text3 = resourceCode; } catch (Exception exception) { throw exception; } return(text3); }
public static string SetResourceAccessRange(string code, string classCode, string unitCode, bool isRefreshRight) { string text5; try { string resourceCode = GetResourceCode(code, classCode); bool flag = resourceCode == ""; EntityData entity = null; if (flag) { resourceCode = SystemManageDAO.GetNewSysCode("ResourceCode"); entity = new EntityData("Standard_Resource"); DataRow newRecord = entity.GetNewRecord(); newRecord["ResourceCode"] = resourceCode; newRecord["ClassCode"] = classCode; newRecord["UnitCode"] = unitCode; newRecord["RelationCode"] = code; entity.AddNewRecord(newRecord); } else { entity = ResourceDAO.GetStandard_ResourceByCode(resourceCode); entity.CurrentRow["unitCode"] = unitCode; } if (isRefreshRight) { entity.DeleteAllTableRow("AccessRange"); } EntityData stationByUnitAccess = OBSDAO.GetStationByUnitAccess(unitCode); entity.SetCurrentTable("AccessRange"); foreach (DataRow row2 in stationByUnitAccess.CurrentTable.Rows) { string text2 = row2["RoleCode"].ToString(); string text3 = row2["StationCode"].ToString(); EntityData data3 = SystemManageDAO.GetStandard_RoleByCode(text2); foreach (DataRow row3 in data3.Tables["RoleOperation"].Select(string.Format(" SubString(OperationCode,1,4)='{0}' ", classCode))) { string text4 = (string)row3["OperationCode"]; DataRow row = entity.GetNewRecord(); row["AccessRangeCode"] = SystemManageDAO.GetNewSysCode("AccessRangeCode"); row["ResourceCode"] = resourceCode; row["UnitCode"] = unitCode; row["OperationCode"] = text4; row["AccessRangeType"] = 1; row["RelationCode"] = text3; entity.AddNewRecord(row); } data3.Dispose(); } stationByUnitAccess.Dispose(); ResourceDAO.SubmitAllStandard_Resource(entity); entity.Dispose(); text5 = resourceCode; } catch (Exception exception) { throw exception; } return(text5); }