private void UpdateAccess() { if (((Panel)cuwReview.CreateUserStep.ContentTemplateContainer.FindControl("pnlOtherMembers")).Visible) { Repeater rptOtherMembers = (Repeater)cuwReview.CreateUserStep.ContentTemplateContainer.FindControl("rptOtherMembers"); SqlParameter UserID = new SqlParameter("UserID", SqlDbType.UniqueIdentifier); UserID.Value = Guid.Parse(Membership.GetUser(cuwReview.UserName).ProviderUserKey.ToString()); SqlParameter PastCareRequests = new SqlParameter("PastCareRequests", SqlDbType.Structured); DataTable dtPastCareRequest = new DataTable("PastCareRequest"); dtPastCareRequest.Columns.Add("CCHID", typeof(int)); dtPastCareRequest.Columns.Add("CCHID_Dependent", typeof(int)); dtPastCareRequest.Columns.Add("RequestAccessFromDependent", typeof(bool)); dtPastCareRequest.Columns.Add("GrantAccessToDependent", typeof(bool)); dtPastCareRequest.Columns.Add("DependentEmail", typeof(string)); DataRow drPastCareRequestRow = dtPastCareRequest.NewRow(); foreach (RepeaterItem ri in rptOtherMembers.Items) { drPastCareRequestRow["CCHID"] = ThisSession.CCHID; Dependent d = ThisSession.Dependents[ri.ItemIndex]; if (d.ShowAccessQuestions) { drPastCareRequestRow["CCHID_Dependent"] = d.CCHID; //If you've already been given access, set to false as we don't want to request again, otherwise set to value of checkbox drPastCareRequestRow["RequestAccessFromDependent"] = ((CheckBox)ri.FindControl("cbRequestToSee")).Checked; //If you've already given access, set to value of DisallowCheckbox, otherwise set to value of AllowCheckbox drPastCareRequestRow["GrantAccessToDependent"] = ((CheckBox)ri.FindControl("cbAllowSeeMy")).Checked; drPastCareRequestRow["DependentEmail"] = Encoder.HtmlEncode(((TextBox)ri.FindControl("txtDepEmail")).Text); dtPastCareRequest.Rows.Add(drPastCareRequestRow); drPastCareRequestRow = dtPastCareRequest.NewRow(); } } PastCareRequests.Value = dtPastCareRequest; using (SqlConnection conn = new SqlConnection(ThisSession.CnxString)) { using (SqlCommand comm = new SqlCommand("UpdateUserAccessRequest", conn)) { comm.CommandType = CommandType.StoredProcedure; comm.Parameters.Add(UserID); comm.Parameters.Add(PastCareRequests); try { conn.Open(); comm.ExecuteNonQuery(); } catch (Exception ex) { using (BaseCCHData errorHandler = new BaseCCHData()) { errorHandler.CaptureError(ex); } } finally { conn.Close(); } } } } }
private void SaveAlerts() { CheckBox cbEmailAlerts = (CheckBox)cuwReview.CreateUserStep.ContentTemplateContainer.FindControl("cbEmailAlerts"); CheckBox cbTextAlerts = (CheckBox)cuwReview.CreateUserStep.ContentTemplateContainer.FindControl("cbTextAlerts"); CheckBox cbConciergeAlerts = (CheckBox)cuwReview.CreateUserStep.ContentTemplateContainer.FindControl("cbConciergeAlerts"); //TextBox txtMobileAlert = (TextBox)cuwReview.CreateUserStep.ContentTemplateContainer.FindControl("txtMobilePhone"); if (cbTextAlerts.Checked) { String FullPhone = String.Format("{0}{1}{2}", ((TextBox)cuwReview.CreateUserStep.ContentTemplateContainer.FindControl("txtAreaCode")).Text, ((TextBox)cuwReview.CreateUserStep.ContentTemplateContainer.FindControl("txtFirstThree")).Text, ((TextBox)cuwReview.CreateUserStep.ContentTemplateContainer.FindControl("txtLastFour")).Text); FullPhone = Microsoft.Security.Application.Encoder.HtmlEncode(FullPhone); using (SqlConnection conn = new SqlConnection(ThisSession.CnxString)) { using (SqlCommand comm = new SqlCommand("UpdateUserNotificationSettings", conn)) { comm.CommandType = CommandType.StoredProcedure; comm.Parameters.AddWithValue("CCHID", ThisSession.CCHID); comm.Parameters.AddWithValue("OptInEmailAlerts", cbEmailAlerts.Checked); comm.Parameters.AddWithValue("OptInTextMsgAlerts", cbTextAlerts.Checked); comm.Parameters.AddWithValue("MobilePhone", FullPhone); comm.Parameters.AddWithValue("OptInPriceConcierge", cbConciergeAlerts.Checked); try { conn.Open(); comm.ExecuteNonQuery(); ThisSession.PatientPhone = FullPhone; } catch (Exception ex) { using (BaseCCHData errorHandler = new BaseCCHData()) { errorHandler.CaptureError(ex); } } finally { conn.Close(); } } } } //if (cbConciergeAlerts.Checked) //{ // ((Literal)cuwReview.CompleteStep.ContentTemplateContainer.FindControl("ltlRegisterComplete")).Text = "You have registered and been entered into a raffle for the chance to win one of twenty $500 prizes."; //} //else //{ ((Literal)cuwReview.CompleteStep.ContentTemplateContainer.FindControl("ltlRegisterComplete")).Text = "You are now registered."; //} }
private void UpdateSecurityQuestion() { DropDownList ddl = (DropDownList)cuwReview.CreateUserStep.ContentTemplateContainer.FindControl("ddlQuestion"); try { Membership.GetUser(cuwReview.UserName).ChangePasswordQuestionAndAnswer(cuwReview.Password, ddl.SelectedValue, cuwReview.Answer); } catch (Exception ex) { using (BaseCCHData errorHandler = new BaseCCHData()) { errorHandler.CaptureError(ex, true); } } }
protected void cuwReview_CreatedUser(object sender, EventArgs e) { //FormsAuthentication.SetAuthCookie(cuwReview.UserName, false); ThisSession.PatientEmail = cuwReview.UserName; ThisSession.CurrentSecurityQuestion = cuwReview.Question; try //(JM 9-10-12)Wrap this in a try catch as we were having errors with users already in a role when the registered. This was failing and causing everything else to be skipped { Roles.AddUserToRole(cuwReview.UserName, "Customer"); } catch (System.Configuration.Provider.ProviderException pEx) { //Capture the error using (BaseCCHData errorHandler = new BaseCCHData()) { errorHandler.CaptureError(pEx, true); } } SetupUserProfile(); UpdateEmailAddress(); UpdateRegistrationPhone(); // lam, 20130227, add UpdatePhone for MSB-142 UpdateAccess(); UpdateHearCCH(); // lam, 20130411, MSF-290 SaveAlerts(); //UpdateSecurityQuestion(); //JM 10/23/12 - Native registration does this, no need to do it a second time. Was causing Orphans LoadUserSessionInfo(); //MUST BE DONE LAST LoadEmployerContent(); CaptureRegistrationLogin(); //Can come after as it's just an insert and not a retrieval // JM 2-6-13 // Forced user into the site after successfull registration in order to properly audit the registration login if (Membership.ValidateUser(cuwReview.UserName, cuwReview.Password)) { FormsAuthentication.SetAuthCookie(cuwReview.UserName, false); if (ThisSession.SavingsChoiceEnabled) { Response.Redirect(ResolveUrl("~/SavingsChoice/SavingsChoiceWelcome.aspx")); } else { FormsAuthentication.RedirectFromLoginPage(cuwReview.UserName, false); } } }
protected void cuwReview_CreatedUser(object sender, EventArgs e) { ThisSession.PatientEmail = cuwReview.UserName; ThisSession.CurrentSecurityQuestion = cuwReview.Question; try //(JM 9-10-12)Wrap this in a try catch as we were having errors with users already in a role when the registered. This was failing and causing everything else to be skipped { Roles.AddUserToRole(cuwReview.UserName, "Customer"); } catch (System.Configuration.Provider.ProviderException pEx) { //Capture the error using (BaseCCHData errorHandler = new BaseCCHData()) { errorHandler.CaptureError(pEx, true); } } SetupUserProfile(); UpdateEmailAddress(); UpdateAccess(); SaveAlerts(); UpdateSecurityQuestion(); LoadUserSessionInfo(); //MUST BE DONE LAST CaptureRegistrationLogin(); //Can come after as it's just an insert and not a retrieval GenerateReferralLink(); //Generate Refferel link }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { using (System.IO.StringWriter sw = new System.IO.StringWriter()) { using (HtmlTextWriter htw = new HtmlTextWriter(sw)) { htw.RenderBeginTag(HtmlTextWriterTag.H2); htw.Write("We regret to report that something went wrong processing your request."); htw.WriteBreak(); htw.Write("Please feel free to try what you were doing again in a few minutes."); htw.RenderEndTag(); htw.WriteBreak(); htw.RenderBeginTag(HtmlTextWriterTag.H3); MembershipUser mu = Membership.GetUser(); if (mu != null) if (mu.IsOnline) htw.Write("Click here to log back in and try again."); else htw.Write("Click here to try logging in again."); else htw.Write("Click here to continue to the sign-in page."); htw.RenderEndTag(); htw.AddAttribute(HtmlTextWriterAttribute.Href, ResolveUrl("~/Sign_in.aspx")); htw.AddAttribute(HtmlTextWriterAttribute.Class, "submitlink"); htw.RenderBeginTag(HtmlTextWriterTag.A); htw.Write("Continue"); htw.RenderEndTag(); if (Roles.IsUserInRole("DebugUser")) { htw.WriteBreak(); htw.WriteBreak(); htw.RenderBeginTag(HtmlTextWriterTag.Table); htw.RenderBeginTag(HtmlTextWriterTag.Tr); htw.AddAttribute(HtmlTextWriterAttribute.Width, "110px"); htw.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "Bold"); htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write("From Page:"); htw.RenderEndTag(); //TD htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write(Request.UrlReferrer.PathAndQuery); htw.RenderEndTag(); //TD htw.RenderEndTag(); //TR htw.RenderBeginTag(HtmlTextWriterTag.Tr); htw.AddAttribute(HtmlTextWriterAttribute.Width, "110px"); htw.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "Bold"); htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write("Error Message:"); htw.RenderEndTag(); //TD htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write(ThisSession.AppException.Message); htw.RenderEndTag(); //TD htw.RenderEndTag(); //TR htw.RenderBeginTag(HtmlTextWriterTag.Tr); htw.AddAttribute(HtmlTextWriterAttribute.Width, "110px"); htw.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "Bold"); htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write("Error Source:"); htw.RenderEndTag(); //TD htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write(ThisSession.AppException.Source); htw.RenderEndTag(); //TD htw.RenderEndTag(); //TR htw.RenderBeginTag(HtmlTextWriterTag.Tr); htw.AddAttribute(HtmlTextWriterAttribute.Width, "110px"); htw.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "Bold"); htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write("Error Stack:"); htw.RenderEndTag(); //TD htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write(ThisSession.AppException.StackTrace); htw.RenderEndTag(); //TD htw.RenderEndTag(); //TR htw.RenderEndTag(); //Table } using (BaseCCHData errorHandler = new BaseCCHData()) { errorHandler.CaptureError(ThisSession.AppException, (mu != null && !mu.IsOnline)); } } ltlErrorMessage.Text = sw.ToString(); } HttpContext.Current.Session.Abandon(); FormsAuthentication.SignOut(); } }
private void UpdateAccess() { Repeater rptOtherMembers = (Repeater)cuwReview.CreateUserStep.ContentTemplateContainer.FindControl("rptOtherMembers"); SqlParameter UserID = new SqlParameter("UserID", SqlDbType.UniqueIdentifier); UserID.Value = Guid.Parse(Membership.GetUser(cuwReview.UserName).ProviderUserKey.ToString()); SqlParameter PastCareRequests = new SqlParameter("PastCareRequests", SqlDbType.Structured); DataTable dtPastCareRequest = new DataTable("PastCareRequest"); dtPastCareRequest.Columns.Add("CCHID", typeof(int)); dtPastCareRequest.Columns.Add("CCHID_Dependent", typeof(int)); dtPastCareRequest.Columns.Add("RequestAccessFromDependent", typeof(bool)); dtPastCareRequest.Columns.Add("GrantAccessToDependent", typeof(bool)); dtPastCareRequest.Columns.Add("DependentEmail", typeof(string)); DataRow drPastCareRequestRow = dtPastCareRequest.NewRow(); foreach (RepeaterItem ri in rptOtherMembers.Items) { drPastCareRequestRow["CCHID"] = ThisSession.CCHID; Dependent d = ThisSession.Dependents[ri.ItemIndex]; if (d.ShowAccessQuestions) { drPastCareRequestRow["CCHID_Dependent"] = d.CCHID; //If you've already been given access, set to false as we don't want to request again, otherwise set to value of checkbox drPastCareRequestRow["RequestAccessFromDependent"] = ((CheckBox)ri.FindControl("cbRequestToSee")).Checked; //If you've already given access, set to value of DisallowCheckbox, otherwise set to value of AllowCheckbox drPastCareRequestRow["GrantAccessToDependent"] = ((CheckBox)ri.FindControl("cbAllowSeeMy")).Checked; drPastCareRequestRow["DependentEmail"] = Microsoft.Security.Application.Encoder.HtmlEncode(((TextBox)ri.FindControl("txtDepEmail")).Text); dtPastCareRequest.Rows.Add(drPastCareRequestRow); drPastCareRequestRow = dtPastCareRequest.NewRow(); } } PastCareRequests.Value = dtPastCareRequest; using (SqlConnection conn = new SqlConnection(ThisSession.CnxString)) { using (SqlCommand comm = new SqlCommand("UpdateUserAccessRequest", conn)) { comm.CommandType = CommandType.StoredProcedure; comm.Parameters.Add(UserID); comm.Parameters.Add(PastCareRequests); try { conn.Open(); comm.ExecuteNonQuery(); } catch (Exception ex) { using (BaseCCHData errorHandler = new BaseCCHData()) { errorHandler.CaptureError(ex); } } finally { conn.Close(); } } } }
protected void cuwReview_CreatedUser(object sender, EventArgs e) { //FormsAuthentication.SetAuthCookie(cuwReview.UserName, false); ThisSession.PatientEmail = cuwReview.UserName; ThisSession.CurrentSecurityQuestion = cuwReview.Question; try //(JM 9-10-12)Wrap this in a try catch as we were having errors with users already in a role when the registered. This was failing and causing everything else to be skipped { Roles.AddUserToRole(cuwReview.UserName, "Customer"); } catch (System.Configuration.Provider.ProviderException pEx) { //Capture the error using (BaseCCHData errorHandler = new BaseCCHData()) { errorHandler.CaptureError(pEx, true); } } SetupUserProfile(); UpdateEmailAddress(); UpdateRegistrationPhone(); // lam, 20130227, add UpdatePhone for MSB-142 UpdateAccess(); UpdateHearCCH(); // lam, 20130411, MSF-290 SaveAlerts(); //UpdateSecurityQuestion(); //JM 10/23/12 - Native registration does this, no need to do it a second time. Was causing Orphans LoadUserSessionInfo(); //MUST BE DONE LAST LoadEmployerContent(); CaptureRegistrationLogin(); //Can come after as it's just an insert and not a retrieval // JM 2-6-13 // Forced user into the site after successfull registration in order to properly audit the registration login if (Membership.ValidateUser(cuwReview.UserName, cuwReview.Password)) { FormsAuthentication.SetAuthCookie(cuwReview.UserName, false); if (ThisSession.SavingsChoiceEnabled) Response.Redirect(ResolveUrl("~/SavingsChoice/SavingsChoiceWelcome.aspx")); else FormsAuthentication.RedirectFromLoginPage(cuwReview.UserName, false); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { using (System.IO.StringWriter sw = new System.IO.StringWriter()) { using (HtmlTextWriter htw = new HtmlTextWriter(sw)) { htw.RenderBeginTag(HtmlTextWriterTag.H2); htw.Write("We regret to report that something went wrong processing your request."); htw.WriteBreak(); htw.Write("Please feel free to try what you were doing again in a few minutes."); htw.RenderEndTag(); htw.WriteBreak(); htw.RenderBeginTag(HtmlTextWriterTag.H3); MembershipUser mu = Membership.GetUser(); if (mu != null) { if (mu.IsOnline) { htw.Write("Click here to log back in and try again."); } else { htw.Write("Click here to try logging in again."); } } else { htw.Write("Click here to continue to the sign-in page."); } htw.RenderEndTag(); htw.AddAttribute(HtmlTextWriterAttribute.Href, ResolveUrl("~/Sign_in.aspx")); htw.AddAttribute(HtmlTextWriterAttribute.Class, "submitlink"); htw.RenderBeginTag(HtmlTextWriterTag.A); htw.Write("Continue"); htw.RenderEndTag(); if (Roles.IsUserInRole("DebugUser")) { htw.WriteBreak(); htw.WriteBreak(); htw.RenderBeginTag(HtmlTextWriterTag.Table); htw.RenderBeginTag(HtmlTextWriterTag.Tr); htw.AddAttribute(HtmlTextWriterAttribute.Width, "110px"); htw.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "Bold"); htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write("From Page:"); htw.RenderEndTag(); //TD htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write(Request.UrlReferrer.PathAndQuery); htw.RenderEndTag(); //TD htw.RenderEndTag(); //TR htw.RenderBeginTag(HtmlTextWriterTag.Tr); htw.AddAttribute(HtmlTextWriterAttribute.Width, "110px"); htw.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "Bold"); htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write("Error Message:"); htw.RenderEndTag(); //TD htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write(ThisSession.AppException.Message); htw.RenderEndTag(); //TD htw.RenderEndTag(); //TR htw.RenderBeginTag(HtmlTextWriterTag.Tr); htw.AddAttribute(HtmlTextWriterAttribute.Width, "110px"); htw.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "Bold"); htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write("Error Source:"); htw.RenderEndTag(); //TD htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write(ThisSession.AppException.Source); htw.RenderEndTag(); //TD htw.RenderEndTag(); //TR htw.RenderBeginTag(HtmlTextWriterTag.Tr); htw.AddAttribute(HtmlTextWriterAttribute.Width, "110px"); htw.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "Bold"); htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write("Error Stack:"); htw.RenderEndTag(); //TD htw.RenderBeginTag(HtmlTextWriterTag.Td); htw.Write(ThisSession.AppException.StackTrace); htw.RenderEndTag(); //TD htw.RenderEndTag(); //TR htw.RenderEndTag(); //Table } using (BaseCCHData errorHandler = new BaseCCHData()) { errorHandler.CaptureError(ThisSession.AppException, (mu != null && !mu.IsOnline)); } } ltlErrorMessage.Text = sw.ToString(); } HttpContext.Current.Session.Abandon(); FormsAuthentication.SignOut(); } }