//---------------------------------------------------------------------------------------// protected void Page_Load(object sender, EventArgs e) { lblResponse.Visible = false; if (!IsPostBack) { // // Populate textboxes with the user's information // AuthorizationWrapperClass wrapper = new AuthorizationWrapperClass(); User sessionUser = new User(); int userID = Convert.ToInt32(Session[Consts.STRSSN_UserID]); sessionUser = wrapper.GetUsersWrapper(new int[] { userID })[0]; txtUsername.Enabled = false; txtUsername.Text = sessionUser.userName; txtFirstName.Text = sessionUser.firstName; txtLastName.Text = sessionUser.lastName; txtEmail.Text = sessionUser.email; txtNewPassword.Text = ""; txtConfirmPassword.Text = ""; // To list all the groups a user belongs to int[] groupIDs = wrapper.ListGroupsForAgentWrapper(userID); //since we already have the groups a user has access // if we use wrapper here, it will deny authentication Group[] gps = AdministrativeAPI.GetGroups(groupIDs); ArrayList nonRequestGroups = new ArrayList(); ArrayList requestGroups = new ArrayList(); foreach (Group g in gps) { if (g.groupName.EndsWith("request")) requestGroups.Add(g); else if (!g.groupName.Equals("NewUserGroup")) nonRequestGroups.Add(g); } // // List Groups for which the user is a member // StringBuilder sb = new StringBuilder(); if ((nonRequestGroups != null) && (nonRequestGroups.Count > 0)) { for (int i = 0; i < nonRequestGroups.Count; i++) { sb.Append(((Group)nonRequestGroups[i]).groupName); if (i < nonRequestGroups.Count - 1) { sb.Append("<br />"); } } } else { sb.Append("No group"); } lblGroups.Text = sb.ToString(); // // List Groups for which the user has requested membership // sb = new StringBuilder(); if ((requestGroups != null) && (requestGroups.Count > 0)) { for (int i = 0; i < requestGroups.Count; i++) { int origGroupID = AdministrativeAPI.GetAssociatedGroupID(((Group)requestGroups[i]).groupID); string origGroupName = AdministrativeAPI.GetGroups(new int[] { origGroupID })[0].groupName; sb.Append(origGroupName); if (i < requestGroups.Count - 1) { sb.Append("<br />"); } } } else { sb.Append("No group"); } lblRequestGroups.Text = sb.ToString(); } }
protected void Page_Load(object sender, System.EventArgs e) { AuthorizationWrapperClass wrapper = new AuthorizationWrapperClass(); if(! IsPostBack) { //Populate textboxes with User's data User sessionUser = new User(); sessionUser = wrapper.GetUsersWrapper(new int[]{Convert.ToInt32(Session["UserID"])})[0]; txtUsername.Text = sessionUser.userName; txtUsername.Enabled = false; txtFirstName.Text = sessionUser.firstName; txtLastName.Text = sessionUser.lastName; txtEmail.Text = sessionUser.email; txtNewPassword.Text = ""; txtConfirmPassword.Text = ""; // To list all the groups a user belongs to int userID = Convert.ToInt32(Session["UserID"]); int[] groupIDs = wrapper.ListGroupsForAgentWrapper (userID); //since we already have the groups a user has access // if we use wrapper here, it will deny authentication Group[] gps = AdministrativeAPI.GetGroups(groupIDs); ArrayList nonRequestGroups = new ArrayList(); ArrayList requestGroups = new ArrayList(); foreach(Group g in gps) { if (g.groupName.EndsWith("request")) requestGroups.Add(g); else if(!g.groupName.Equals("NewUserGroup")) nonRequestGroups.Add(g); } //List Groups that user belongs to in blue box if ((nonRequestGroups!=null)&& (nonRequestGroups.Count>0)) { for (int i=0;i<nonRequestGroups.Count;i++) { lblGroups.Text+= ((Group)nonRequestGroups[i]).groupName; if (i != nonRequestGroups.Count-1) lblGroups.Text +=", "; } } else { lblGroups.Text = "No group"; } //List Groups that user has requested to in blue box if ((requestGroups!=null)&& (requestGroups.Count>0)) { for (int i=0;i<requestGroups.Count;i++) { int origGroupID = AdministrativeAPI.GetAssociatedGroupID(((Group)requestGroups[i]).groupID); string origGroupName = AdministrativeAPI.GetGroups(new int[] {origGroupID})[0].groupName; lblRequestGroups.Text+= origGroupName; if (i != requestGroups.Count-1) lblRequestGroups.Text +=", "; } } else { lblRequestGroups.Text = "No group"; } } }