public static string GetRoleName(string code) { string text2; try { string text = ""; EntityData roleByCode = SystemManageDAO.GetRoleByCode(code); if (roleByCode.HasRecord()) { text = roleByCode.GetString("RoleName"); } roleByCode.Dispose(); text2 = text; } catch (Exception exception) { throw exception; } return(text2); }
private void LoadData() { ///////////权限 string mainCode = "%"; string roleCode = Request["RoleCode"] + ""; try { EntityData role = DAL.EntityDAO.SystemManageDAO.GetStandard_RoleByCode(roleCode); FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder(); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.ChildTreeNode, mainCode)); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsAvailable, "0")); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsRightControlPoint, "0")); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.IsRoleControlPoint, "0")); QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("FunctionStructure", sb.BuildMainQueryString()); entity.CurrentTable.Columns.Add("ShowCode"); qa.Dispose(); string allCode = ""; string aCode = ""; int iCount = entity.CurrentTable.Rows.Count; for (int i = 0; i < iCount; i++) { entity.SetCurrentRow(i); string code = entity.GetString("FunctionStructureCode"); int deep = entity.GetInt("Deep"); entity.CurrentRow["ShowCode"] = BuildShowCode(deep); int iA = entity.GetInt("IsAvailable"); if (allCode != "") { allCode += ","; } allCode += code; } role.SetCurrentTable("RoleOperation"); foreach (DataRow dr in role.CurrentTable.Select(String.Format(" OperationCode like '{0}%' ", mainCode))) { string code = (string)dr["OperationCode"]; if (aCode != "") { aCode += ","; } aCode += string.Format("'{0}'", code); } aCode = " FunctionStructureCode in (" + aCode + ") "; DataView dv = new DataView(entity.Tables["FunctionStructure"]); dv.RowFilter = aCode; this.rptFunction.DataSource = dv; this.rptFunction.DataBind(); entity.Dispose(); role.Dispose(); } catch (Exception ex) { //ApplicationLog.WriteLog(this.ToString(), ex, ""); //Response.Write(Rms.Web.JavaScript.Alert(true, "显示权限时发生出错")); } ////////////////////////////////// try { EntityData ds = SystemManageDAO.GetRoleByCode(roleCode); if (ds.HasRecord()) { this.lblRoleName.Text = ds.GetString("RoleName"); this.lblDescription.Text = ds.GetString("Description"); sortID.Text = ds.GetString("sortid"); } ds.Dispose(); EntityData entity = OBSDAO.GetStationByRoleCode(roleCode); this.dgList.DataSource = entity.CurrentTable; this.dgList.DataBind(); entity.Dispose(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, "显示出错")); } }