protected void FilterEngage_Clicked(object sender, EventArgs e) { EnsureChildControls(); UsingFilterOptions = true; if (inKeyword.Text.ToLower() != "find a cohort by name" && !helper.IsStringEmptyWhiteSpace(inKeyword.Text)) { inKeyword.Text = string.Empty; } CohortIDsToCompare = new string[0]; ArrayList filters = new ArrayList(); foreach (CECFilteringOptions fo in FilterControls) { CheckBox[] cklist = fo.GetCheckedBoxes(); foreach (CheckBox ck in cklist) { filters.Add(ck.ID); } } Session_FilterTreeState = (string[])filters.ToArray(typeof(string)); CurrentFilterString = SqlizeFilterCriteria(); CECWebSrv.AuditLog_AddActivity(UserToken.userid, "select cohort page:search engaged:: " + CurrentFilterString); PopulateSummaryTable(); SetSummaryGridForDisplay(); }
protected override bool OnBubbleEvent(object source, EventArgs args) { EnsureChildControls(); bool handled = false; if (args is CommandEventArgs) { CommandEventArgs cea = (args as CommandEventArgs); switch (cea.CommandName) { case "export": handled = true; string filepath = String.Format("./user_files/{0}/cancer_{1}.xlsx", UserToken.userid, DateTime.Now.ToString("yyyyMMMddmm")); PopulateCancerGrid(); ExportDataGridToExcel(cancerTbl, MapPath(filepath)); CECWebSrv.AuditLog_AddActivity(UserToken.userid, "cancer export created"); Page.ClientScript.RegisterStartupScript(GetType(), "downloadExport", String.Format("<script>window.open('{0}');</script>", filepath)); break; } return(handled); } else { return(base.OnBubbleEvent(source, args)); } }
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 override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { CECWebSrv.AuditLog_AddActivity(0, "[anonymous] forgot password page"); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { CohortIDsToCompare = new string[0]; CancerTypes = new string[0]; Genders = new string[0]; CECWebSrv.AuditLog_AddActivity(UserToken.userid, "cancer page"); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Request.QueryString != null && Request.QueryString.AllKeys.Contains("tab")) { SelectedTabID = int.Parse(Request.QueryString["tab"]); } if (!IsPostBack) { CECWebSrv.AuditLog_AddActivity(UserToken.userid, String.Format("compare page::tab {0}", SelectedTabID)); } // populate filter selections PopulateFilterLabels(); }
protected override bool OnBubbleEvent(object source, EventArgs args) { bool handled = false; if (args is CommandEventArgs) { EnsureChildControls(); CommandEventArgs cea = (args as CommandEventArgs); switch (cea.CommandName) { case "viewDetails": handled = true; redirect = true; redirectionUrl = (String.Format("./cohortDetails.aspx?cohort_id={0}", cea.CommandArgument)); break; case "export": handled = true; string filepath = String.Format("./user_files/{0}/cohortselect_{1}.xlsx", UserToken.userid, DateTime.Now.ToString("yyyyMMMddmm")); PopulateSummaryTable(); ExportDataGridToExcel(summaryTable, MapPath(filepath)); CECWebSrv.AuditLog_AddActivity(UserToken.userid, "select cohort export created"); Page.ClientScript.RegisterStartupScript(GetType(), "downloadExport", String.Format("<script>window.open('{0}');</script>", filepath)); break; } return(handled); } else { return(base.OnBubbleEvent(source, args)); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); PopulateSummaryTable(); if (Request.Params.HasKeys() && Request.Params["__EVENTTARGET"] != null) { if (Request.Params["__EVENTTARGET"].Contains("cohortCompare")) { string id = Request.Params["__EVENTARGUMENT"]; SaveCohortIDToSession(id); /// return focus to clicked checkbox checkboxToGetFocus = "compare_" + id; } } // not sure why this does not consistently work. if ((Request.UrlReferrer != null) && !(Request.UrlReferrer.PathAndQuery.Contains("/select.aspx") || Request.UrlReferrer.PathAndQuery.EndsWith("/"))) { RestoreFilterTreeSessionStates(); } PopulateSummaryTable(); SetSummaryGridForDisplay(); //UserData ud = CECWebSrv.GetUserInformation(UserToken.email); //if (!ud.help_shown) //{ // Page.ClientScript.RegisterStartupScript(typeof(CECPage), "HelpTour", "tour.init(); tour.restart();", true); // ud.help_shown = true; // CECWebSrv.SetUserSecurityAttributes(UserToken, ud); //} if (!IsPostBack) { CECWebSrv.AuditLog_AddActivity(UserToken.userid, "select cohort page"); } }
protected override bool OnBubbleEvent(object source, EventArgs args) { bool handled = false; if (args is CommandEventArgs) { CommandEventArgs cea = (args as CommandEventArgs); switch (cea.CommandName) { //case "tabNav": //handled = true; //SelectedTabID = Convert.ToInt32(cea.CommandArgument); //PopulateCompareGrid(); //break; case "export": handled = true; //if (compareTbl == null) PopulateCompareGrid(); string filepath = String.Format("./user_files/{0}/compare{1}_{2}.xlsx", UserToken.userid, SelectedTabID, DateTime.Now.ToString("yyyyMMMddmm")); ExportDataGridToExcel(compareTbl, MapPath(filepath)); CECWebSrv.AuditLog_AddActivity(UserToken.userid, "compare export created"); Page.ClientScript.RegisterStartupScript(GetType(), "downloadExport", String.Format("<script>window.open('{0}');</script>", filepath)); break; } return(handled); } else { return(base.OnBubbleEvent(source, args)); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Page.Request.QueryString["cohort_id"] != null || Page.Request.QueryString["cohort_acronym"] != null) { System.Data.DataSet ds1, ds2; if (Page.Request.QueryString["cohort_id"] != null) { ds1 = CECWebSrv.GetCohortDetails(UserToken, int.Parse(Page.Request.QueryString["cohort_id"])); } else { ds1 = CECWebSrv.GetCohortDetails(UserToken, Page.Request.QueryString["cohort_acronym"]); } System.Data.DataTable cohort = ds1.Tables["tbl_web_cohorts_v4_0"]; if (cohort.Rows.Count == 0) { cd_errorMsg.InnerText = "cohort not found"; return; } ///---------------------------------------- /// stopped commenting, code has been hacked to handle changes from the client /// in the time provided. first casualities are comments/documentation.... o.0 /// // grab all columns from the cohort_meta table System.Data.DataTable cohort_meta = CECWebSrv.GetFilteredCohortRecords(UserToken, "*", String.Format(" (cohort_id={0})", cohort.Rows[0]["cohort_id"])).Tables["tbl_web_cohorts_v4_0"]; if (cohort_meta.Rows.Count > 0) { //if ((cohort_meta.Rows[0]["attachmentQuestionnairePending"] != DBNull.Value) && (bool)cohort_meta.Rows[0]["attachmentQuestionnairePending"]) // ChangeDefaultAttachmentEmptyText(quest_attachments.ID); //if ((cohort_meta.Rows[0]["attachmentPoliciesPending"] != DBNull.Value) && (bool)cohort_meta.Rows[0]["attachmentPoliciesPending"]) // ChangeDefaultAttachmentEmptyText(pol_attachments.ID); //if ((cohort_meta.Rows[0]["attachmentPublicationsPending"] != DBNull.Value) && (bool)cohort_meta.Rows[0]["attachmentPublicationsPending"]) // ChangeDefaultAttachmentEmptyText(pub_attachments.ID); //if ((cohort_meta.Rows[0]["attachmentGrantsPending"] != DBNull.Value) && (bool)cohort_meta.Rows[0]["attachmentGrantsPending"]) // ChangeDefaultAttachmentEmptyText(grant_attachments.ID); //if ((cohort_meta.Rows[0]["attachmentProtocolsPending"] != DBNull.Value) && (bool)cohort_meta.Rows[0]["attachmentProtocolsPending"]) // ChangeDefaultAttachmentEmptyText(prot_attachments.ID); } /// hacking ends here...spaghetti code! /// ------------------------------------------- dt_cohort = cohort; PopulateWebFieldValues(cohort); PopulateOtherSection(cohort); ds2 = CECWebSrv.GetCohortAttachmentList(UserToken, (int)cohort.Rows[0]["id"]); PopulateAttachmentSection(ds2.Tables[0]); PopulateFormURL(cohort); if (Page.Request.QueryString["tab"] != null) { string clientScr = String.Format("<script>toggleAccordion({0});</script>", helper.HTMLEncode(Page.Request.QueryString["tab"])); Page.ClientScript.RegisterStartupScript(GetType(), "tab", clientScr); } if (!IsPostBack) { CECWebSrv.AuditLog_AddActivity(UserToken.userid, String.Format("cohort {0} details page", cohort.Rows[0]["cohort_acronym"])); } } if (Page.Request.QueryString["download"] != null) { string savePath = CECWebSrv.GetCohortDocument(UserToken, Convert.ToInt32(Page.Request.QueryString["download"])); savePath = savePath.Replace("'", "\\'"); Page.ClientScript.RegisterStartupScript(GetType(), "download", String.Format("<script>window.open('{0}');</script>", savePath)); } }
protected override void OnLoad(EventArgs e) { if (Session["PageException"] != null) { Exception ex = (Exception)Session["PageException"]; if (!IsPostBack) { CECWebSrv.AuditLog_AddActivity((UserToken.userid == 0 ? 0 : UserToken.userid), String.Format("website error, email {0} :: {1}", GetUserEmail(), ex.Message)); } switch (ex.Message.ToLower()) { #region Session/Login Related Errors case "session is invalid": error_sessioninvalid.Visible = true; break; case "invalid session id": error_sessioninvalid.Visible = true; break; case "session not valid": error_sessioninvalid.Visible = true; break; case "accountlockedoutexception": error_accountlockout.Visible = true; break; #endregion default: // ignore bad request url errors if (ex.Message.ToLower().Contains("dangerous request.rawurl value")) { simpleError.InnerText = "bad url detected"; break; } ///----------------------------------- /// exception message to screen /// simpleError.InnerHtml = helper.HTMLEncode(ex.Message); #if (DEBUG || DEBUGDEV) simpleError.InnerHtml += "<br /><br />" + ex.StackTrace.Replace(Environment.NewLine, "<br />"); #endif LogError(simpleError.InnerText, ex); try { Session.RemoveAll(); FormsAuthentication.SignOut(); string messageContent = String.Format("Error Was Encountered On {1} {0} {2} {0}{0} Error Origin: {3}{0} User: {4}{0} {0}Stack Trace: {5}", (new object[] { Environment.NewLine, Request.Url.Authority, ex.Message, helper.HTMLEncode(GetReferrerUrl()), GetUserEmail(), ex.ToString() })); if (ex is AccountLockedOutException) { messageContent = "Login Attempted With Locked Account " + (ex as AccountLockedOutException).User; } //System.Net.Mail.MailMessage msg = // new MailMessage("*****@*****.**", Configuration["EmailRecipient"], "CEDCD Website Error Encountered", messageContent); //helper help = new helper(); //help.SendEmail(msg); //simpleError.InnerHtml += String.Format("<br/><br/>Email Sent To Web Admins"); } catch (Exception oops) { simpleError.InnerHtml += String.Format("<br/><br/>Error Sending Email: {0}", oops.Message); LogError(simpleError.InnerText, ex); } break; } } }
protected void registrationBtnClicked(object sender, EventArgs e) { string captcha = rg_captcha.Text; rg_captcha.Text = ""; if (captcha != CaptchaAnswer.ToString()) { rg_errorMsg.InnerText = "CAPTCHA answer is incorrect"; RegisterJSAlert(rg_errorMsg.InnerText); return; } if (!helper.IsStringEmptyWhiteSpace(rg_password1.Text) && rg_password2.Text != rg_password1.Text) { rg_errorMsg.InnerText = "Password does not match confirm password"; RegisterJSAlert(rg_errorMsg.InnerText); return; } try { UserData ud = websrv.GetUserInformationByUserID(UserToken, UserToken.userid); if (!helper.IsStringEmptyWhiteSpace(rg_password1.Text)) { CECMembershipProvider cecMp = (Membership.Providers["CECProvider"] as CECMembershipProvider); cecMp.UserToken = UserToken; if (cecMp.ValidatePasswordStrength(rg_password1.Text)) { cecMp.ChangePassword(rg_password1.Text); } ud.password_expired = false; ud.password_change_date = DateTime.Today; if (ForPasswordReset) { ud.password_reset_required = false; } websrv.SetUserSecurityAttributes(UserToken, ud); } if (!helper.IsStringEmptyWhiteSpace(rg_displayName.Text) && ud.display_name != rg_displayName.Text) { ud.display_name = rg_displayName.Text; } if (!helper.IsStringEmptyWhiteSpace(rg_emailAddress.Text) && ud.email != rg_emailAddress.Text) { ud.email = rg_emailAddress.Text; } websrv.SetUserInformation(UserToken, ud); CECWebSrv.AuditLog_AddActivity(UserToken.userid, "user profile information updated"); SendEmailConfirmation(); Response.Redirect("/input/bouncer.aspx", false); } catch (Exception ex) { if (ex is MembershipPasswordException) { rg_errorMsg.InnerText = ex.Message; } else { rg_errorMsg.InnerText = "User account was not saved"; } #if (DEBUG || DEBUGDEV) rg_errorMsg.InnerText += String.Format(" ({0})", ex.Message); #endif LogError(rg_errorMsg.InnerText, ex); RegisterJSAlert(String.Format("ERROR: {0}", rg_errorMsg.InnerText)); } }
protected void forgotPassword_SendBtnClicked(object sender, EventArgs e) { if (helper.IsStringEmptyWhiteSpace(fg_email.Text)) { fg_errorMsg.InnerText = "Email address cannot be left blank"; RegisterJSAlert(fg_errorMsg.InnerText); return; } else if (!helper.IsEmailAddress(fg_email.Text)) { fg_errorMsg.InnerText = "Email address not in expected format"; RegisterJSAlert(fg_errorMsg.InnerText); return; } try { UserData ud = ps.GetUserInformationByEmail(fg_email.Text); CECMembershipProvider prov = (Membership.Providers["CECProvider"] as CECMembershipProvider); string newPass = prov.ResetPassword(ud.email, string.Empty); System.Collections.Specialized.NameValueCollection data = new NameValueCollection(); data.Add("password", newPass); data.Add("to", ud.email); DataRow[] dr_users; using (DataTable dt_users = ps.GetUsers(helper.CreateTemporaryToken(), "uid, username, email")) { dr_users = dt_users.Select(String.Format("email='{0}'", ud.email)); } if (dr_users.Length > 1) { string additional_accounts = string.Empty; foreach (DataRow dr in dr_users) { additional_accounts += String.Format("\t{0}\n", dr["username"]); } data.Add("additional_accounts", String.Format("<p>The following accounts were updated with the password above because they are associated with this email address:<pre>{0}</pre></p>", additional_accounts)); } else { data.Add("additional_accounts", string.Empty); } ps.CreateEmailAndSend(helper.CreateTemporaryToken(), "lost_password", data); CECWebSrv.AuditLog_AddActivity(ud.userid, "password reset; email sent"); fg_errorMsg.Attributes["class"] = "bg-success text-sucess"; fg_errorMsg.InnerText = "Email successfully sent"; //Response.Redirect("/select.aspx", false); } catch (Exception ex) { fg_errorMsg.InnerText = String.Format("Failed to email the password to {0}.", fg_email.Text); LogError(fg_errorMsg.InnerText, ex); } }