protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack && UserToken.TokenSet) { UserData ud = websrv.GetUserInformationByUserID(UserToken, UserToken.userid); rg_emailAddress.Text = ud.email; rg_displayName.Text = ud.display_name; } if (ForPasswordReset && !IsPostBack) { CECWebSrv.AuditLog_AddActivity(UserToken.userid, "user profile page; for password reset"); userInformation.Visible = false; fg_cancelBtn.Visible = false; rg_errorMsg.InnerText = "Account password has expired, please set a new password"; RegisterJSAlert(rg_errorMsg.InnerText); } else if (!ForPasswordReset) { CECWebSrv.AuditLog_AddActivity(UserToken.userid, "user profile page"); } }
protected void userList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { e.Row.CssClass = "col-header"; e.Row.TableSection = TableRowSection.TableHeader; e.Row.Cells.RemoveAt(0); foreach (TableCell tc in e.Row.Cells) { if (tc.Controls.Count == 0) { continue; } if (tc.Controls[0] is LinkButton) { tc.ID = (tc.Controls[0] as LinkButton).Text; switch (tc.ID) { case "username": (tc.Controls[0] as LinkButton).Controls.Add(new LiteralControl("User Name")); break; case "access_level": (tc.Controls[0] as LinkButton).Controls.Add(new LiteralControl("User Type")); break; case "email": (tc.Controls[0] as LinkButton).Controls.Add(new LiteralControl("Email")); break; case "account_lockout": tc.Text = "Lock"; break; case "cohort_id": (tc.Controls[0] as LinkButton).Controls.Add(new LiteralControl("Cohort Acronym")); break; case "display_name": (tc.Controls[0] as LinkButton).Controls.Add(new LiteralControl("Name")); break; } } if (tc.ID != "account_lockout") { tc.CssClass = "sortable"; if (tc.ID == SortColumn) { tc.CssClass += String.Format(" columnSorting_{0}", GetSortString(SortOrder)); } System.Web.UI.HtmlControls.HtmlGenericControl span = new HtmlGenericControl("span"); span.Attributes["class"] = "glyphicon glyphicon-sort"; (tc.Controls[0] as LinkButton).Controls.Add(span); } } e.Row.Cells.Add(new TableHeaderCell()); e.Row.Cells[6].Text = "Edit"; } else if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells.RemoveAt(0); UserData ud = CECWebSrv.GetUserInformationByUserID(UserToken, (int)(e.Row.DataItem as DataRowView)["uid"]); e.Row.Cells[0].Text = ud.user_name; // email e.Row.Cells[2].Text = ud.email; // access levels switch ((e.Row.DataItem as DataRowView)["access_level"].ToString()) { case "100": e.Row.Cells[3].Text = "Cohort Representative"; break; case "200": e.Row.Cells[3].Text = "NCI Reviewer"; break; case "300": e.Row.Cells[3].Text = "Administrator"; break; } // cohort name if (ud.cohort_id != null && ud.cohort_id != 0) { DataTable dt_cohort = CECWebSrv.GetCohortRecordById(UserToken, (int)ud.cohort_id, true); if (ud.access_level == 100 && dt_cohort.Rows.Count > 0) { e.Row.Cells[4].Text = dt_cohort.Rows[0]["cohort_acronym"].ToString(); } } else { e.Row.Cells[4].Text = String.Empty; } // account lockout e.Row.Cells[5].Controls.Clear(); System.Web.UI.HtmlControls.HtmlButton linkBtn_ii = new HtmlButton(); linkBtn_ii.Attributes["type"] = "button"; linkBtn_ii.Attributes["class"] = "btn btn-primary"; linkBtn_ii.Attributes["uid"] = (e.Row.DataItem as DataRowView)["uid"].ToString(); if ((e.Row.DataItem as DataRowView)["account_lockout"] != null && (bool)(e.Row.DataItem as DataRowView)["account_lockout"]) { linkBtn_ii.ID = String.Format("unlock_user_{0}", (e.Row.DataItem as DataRowView)["uid"]); linkBtn_ii.Controls.Add(new LiteralControl(String.Format(" <span class=\"glyphicon glyphicon-lock\"></span>", (e.Row.DataItem as DataRowView)["uid"]))); e.Row.Cells[5].Controls.Add(linkBtn_ii); } else { linkBtn_ii.ID = String.Format("deactivate_user_{0}", (e.Row.DataItem as DataRowView)["uid"]); linkBtn_ii.Controls.Add(new LiteralControl(String.Format(" <span class=\"glyphicon glyphicon-thumbs-up\"></span>", (e.Row.DataItem as DataRowView)["uid"]))); e.Row.Cells[5].Controls.Add(linkBtn_ii); } e.Row.Cells.Add(new TableCell()); System.Web.UI.HtmlControls.HtmlButton linkBtn = new HtmlButton(); linkBtn.ID = String.Format("modify_user_{0}", (e.Row.DataItem as DataRowView)["uid"]); linkBtn.Attributes["type"] = "button"; linkBtn.Attributes["uid"] = (e.Row.DataItem as DataRowView)["uid"].ToString(); linkBtn.Attributes["class"] = "btn btn-primary"; linkBtn.Controls.Add(new LiteralControl(" <span class=\"glyphicon glyphicon-pencil\"></span>")); e.Row.Cells[6].Controls.Add(linkBtn); } }