protected void Page_Load(object sender, EventArgs e) { //Response.Write("----" + BLL.UserDataRigth.Instance.GetUserDataRigth(1).RightType + "--------"); //if (BLL.UserDataRigth.Instance.GetUserDataRigth(1) == null) //{ // Response.Write("------------"); //} //BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.GetRoleInfoByUserIDAndSysID(0, ConfigurationUtil.GetAppSettingValue("ThisSysID")); DataTable db = BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.GetRoleInfoBySysID(ConfigurationUtil.GetAppSettingValue("ThisSysID")); Rpt_Role.DataSource = db; Rpt_Role.DataBind(); AreaManageConfig config = new AreaManageConfig(HttpContext.Current.Server); List <string> list = config.GetCurrentUserArea(); DataTable tbArea = new DataTable(); DataColumn dcName = new DataColumn("Name", typeof(string)); DataColumn dcValue = new DataColumn("Value", typeof(string)); tbArea.Columns.Add(dcName); tbArea.Columns.Add(dcValue); if (list != null && list.Count > 0) { foreach (string s in list) { DataRow dr = tbArea.NewRow(); int value = 1; if (s == "西安") { value = 2; } dr["Name"] = s; dr["Value"] = value; tbArea.Rows.Add(dr); } } rptArea.DataSource = tbArea; rptArea.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int userId = BLL.Util.GetLoginUserID(); if (!BLL.Util.CheckRight(userId, "SYS024BUT5103")) { Response.Write(BLL.Util.GetNotAccessMsgPage("您没有访问该页面的权限")); Response.End(); } Xaid = (int)RegionID.XiAn; Bjid = (int)RegionID.BeiJ; string xanm = BitAuto.ISDC.CC2012.BLL.Util.GetEnumOptText(typeof(RegionID), Xaid); string bjnm = BitAuto.ISDC.CC2012.BLL.Util.GetEnumOptText(typeof(RegionID), Bjid); if (Action == "modify") { AreaManageConfig config = new AreaManageConfig(Server); Dictionary <string, string> dic_bj = new Dictionary <string, string>(); Dictionary <string, string> dic_xa = new Dictionary <string, string>(); if (Regionid == Bjid.ToString()) { dic_xa = config.ReadFile(xanm); dic_bj = ConvertDic(Data); } else if (Regionid == Xaid.ToString()) { dic_bj = config.ReadFile(bjnm); dic_xa = ConvertDic(Data); } Dictionary <string, Dictionary <string, string> > dic = new Dictionary <string, Dictionary <string, string> >(); dic.Add(bjnm, dic_bj); dic.Add(xanm, dic_xa); config.WriteFile(dic); } htmlBj = BindUserName(bjnm); htmlXa = BindUserName(xanm); } }
/// 获取绑定的html代码 /// <summary> /// 获取绑定的html代码 /// </summary> /// <param name="area"></param> /// <returns></returns> private string BindUserName(string area) { AreaManageConfig config = new AreaManageConfig(Server); Dictionary <string, string> dic = config.ReadFile(area); string html = ""; foreach (string key in dic.Keys) { string name = BitAuto.YanFa.Crm2009.BLL.UserInfo.Instance.GetTrueNameByUserID(key); int length = name.Length + 1; double prelen = 12.5; int len = (int)(prelen * (double)length); html += " <li style='width: " + len + "px;' userid='" + key + "'>" + name + "</li>"; } if (dic.Count == 0) { //空 占位 使得ul的宽度起作用 html += " <li style='width: 50px;' userid=''> </li>"; } return(html); }
private void GetArea() { AreaManageConfig config = new AreaManageConfig(HttpContext.Current.Server); List <string> list = config.GetCurrentUserArea(); if (list != null && list.Count > 0) { foreach (string s in list) { DataRow dr = tbArea.NewRow(); int value = 1; if (s == "西安") { value = 2; } dr["Name"] = s; dr["Value"] = value; tbArea.Rows.Add(dr); } } }