protected void Page_Load(object sender, System.EventArgs e) { aid = Convert.ToInt32(Request.QueryString["AccountID"]); if (aid == 0) { Page_Error("AccountID Missing"); } if (aid == 1) { bnRemove.Visible = false; } account = new Account(appEnv.GetConnection()); property = new AccountProperty(appEnv.GetConnection()); roles = new AccountRoles(appEnv.GetConnection()); dr = account.GetAccountForID(aid); if (!IsPostBack) { tbUserID.Text = dr["UserName"].ToString().Trim(); tbUserName.Text = property.GetValue(aid, "UserName").Trim(); tbEmail.Text = dr["Email"].ToString().Trim(); DataTable roledt = roles.GetRolesForID(aid); string Cmd = "Select * FROM Roles"; SqlDataAdapter DAdpt = new SqlDataAdapter(Cmd, appEnv.GetConnection()); DataSet ds = new DataSet(); DAdpt.Fill(ds, "Roles"); DataTable allRolesdt = ds.Tables["Roles"]; foreach (DataRow drr in allRolesdt.Rows) { ListItem li = new ListItem(drr["Role"].ToString()); foreach (DataRow adr in roledt.Rows) { if (drr["Role"].ToString().Equals(adr["Role"].ToString())) { li.Selected = true; } } lbRoles.Items.Add(li); } if (aid == 1) { bnRemove.Visible = false; lbRoles.Enabled = false; } } }
protected void Page_Load(object sender, System.EventArgs e) { aid = Convert.ToInt32(Request.QueryString["AccountID"]); if (aid == 0) { Page_Error("AccountID Missing"); } if (aid == 1) { bnRemove.Visible = false; } account = new Account(appEnv.GetConnection()); property = new AccountProperty(appEnv.GetConnection()); roles = new AccountRoles(appEnv.GetConnection()); dr = account.GetAccountForID(aid); lbUserID.Text = dr["UserName"].ToString(); lbUserName.Text = property.GetValue(aid, "UserName"); lbEmail.Text = dr["Email"].ToString(); DataTable roledt = roles.GetRolesForID(aid); foreach (DataRow drr in roledt.Rows) { lbRoles.Items.Add(drr["Role"].ToString()); } if (roledt.Rows.Count == 0) { lbRoles.Items.Add("User"); } }