protected void RolesList_SelectedIndexChanged(object sender, EventArgs e) { if (RolesList.SelectedIndex == 1) { var pillars = (from data in db.pillars select data).ToList(); Pillars_List.DataSource = pillars; Pillars_List.Attributes.Add("onclick", "radioMe(event);"); Pillars_List.DataBind(); pillar.Visible = true; project.Visible = false; Implementing_Partner_List.ClearSelection(); } else if (RolesList.SelectedIndex == 2) { var projects = (from data in db.projects where data.status_id == 1 select new { data.project_id, data.project_name }).ToList(); Implementing_Partner_List.DataSource = projects; Implementing_Partner_List.Attributes.Add("onclick", "radioMe(event);"); Implementing_Partner_List.DataBind(); project.Visible = true; pillar.Visible = false; Pillars_List.ClearSelection(); } else { pillar.Visible = false; project.Visible = false; } }
protected void EditClaims_Click(object sender, EventArgs e) { LinkButton btn = sender as LinkButton; UpdateClaims.CommandArgument = btn.CommandArgument; var userStore = new UserStore <IdentityUser>(); var manager = new UserManager <IdentityUser>(userStore); var editUser = manager.FindById(btn.CommandArgument); ModalHeaderLabel1.Text = "Editing User Claims for \"" + editUser.UserName + "\""; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "updateClaimsModal", "$('#updateClaimsModal').modal();", true); UpdatePanel1.Update(); var role = (from data in db.AspNetUserRolesViews where data.UserId == editUser.Id select new { data.RoleId }).SingleOrDefault(); if (role != null) { //Pillar if (role.RoleId.Trim() == "2") { Pill.Visible = true; Pillar_List.DataBind(); Proj.Visible = false; UpdateClaims.Visible = true; var pillarClaims = manager.GetClaims(editUser.Id); foreach (var pillarClaim in pillarClaims) { if (pillarClaim.Type == "Pillar") { Pillar_List.Items.FindByValue(pillarClaim.Value).Selected = true; } } } //Project else if (role.RoleId.Trim() == "3") { Proj.Visible = true; Implementing_Partner_List.DataBind(); Pill.Visible = false; UpdateClaims.Visible = true; var projectClaims = manager.GetClaims(editUser.Id); foreach (var projectClaim in projectClaims) { if (projectClaim.Type == "Project") { Implementing_Partner_List.Items.FindByValue(projectClaim.Value).Selected = true; } } } else { ModalHeaderLabel1.Text = "\"" + editUser.UserName + "\" is an Administrator."; UpdateClaims.Visible = false; Proj.Visible = false; Pill.Visible = false; } } else { ModalHeaderLabel1.Text = "You Must first give \"" + editUser.UserName + "\" a role."; UpdateClaims.Visible = false; Proj.Visible = false; Pill.Visible = false; } //Response.Redirect(String.Format("~/Account/Register.aspx?user={0}", btn.CommandArgument)); }