protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { var token = Session["TOKEN"] as string; var user = TokenManager.Identifytoken(token); if (user != null) { var context = new MOMEntities(); //this.BindGrid(); var context = new MOMEntities(); var list = context.DEPARTMENTTABLE.ToList(); var list1 = context.ROLETABLE.ToList(); Rolelist.DataSource = list1; Rolelist.DataTextField = "ROLE"; Rolelist.DataValueField = "ROLEID"; Rolelist.DataBind(); DepList.DataSource = list; DepList.DataTextField = "DEPARTMENT"; DepList.DataValueField = "KEY"; DepList.DataBind(); } else { Response.Redirect("Login.aspx"); } } }
public ExcuteState getPlayerList() { ExcuteState state = new ExcuteState(); try { string jsontext = null; //byte[] arrOutput = m_client.DownloadBytearr(GlobalVal.CmdURL + "player@getPlayerList", string.Empty, false); //byte[] arrDescrypt = ZlibCompress.DecompressBytes(arrOutput); while (true) { string outputstr = m_client.DownloadBytearr2(GlobalVal.CmdURL + "player@getPlayerList", string.Empty, false); jsontext = Regex.Match(outputstr, "\\[(?<value>.*?)\\]").Groups["value"].Value; if (string.IsNullOrEmpty(jsontext)) {// 创角 RoleCreate.GetForceInfo(m_client); } else { break; } } // 目前只有一个角色 webRole webrole = (webRole)JsonManager.JsonToObject(jsontext, typeof(webRole)); if (webrole != null) { Rolelist.Add(webrole); } else { state.Description = "getPlayerList() 转化json为对象失败, json=" + jsontext; return(state); } state.State = IdentityCode.Success; } catch (Exception ex) { state.Description = "发生异常=" + ex.Message + ";\r\n" + ex.StackTrace; return(state); } return(state); }