Example #1
0
        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(); }
                    }
                }
            }
        }
Example #2
0
        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.";
            //}
        }
Example #3
0
        private void SaveContent()
        {
            if (!ContentChanged)
            {
                return;
            }

            String cID    = String.Empty;
            String sQuery = String.Concat("SELECT ContentID FROM [Employers] WHERE EmployerID = ", ddlEmployers.SelectedValue);
            String uQuery = "UPDATE [EmployerContent] SET ";

            try
            {
                using (BaseCCHData b = new BaseCCHData(sQuery, true))
                {
                    b.GetFrontEndData();
                    if (b.HasErrors)
                    {
                        throw new Exception("Error finding Content in database");
                    }
                    cID = b.Tables[0].Rows[0][0].ToString();
                }

                List <KeyValuePair <String, object> > l = Changes.Where(kvp => kvp.Value != null).ToList <KeyValuePair <String, object> >();
                l.ForEach(delegate(KeyValuePair <String, object> kvp)
                {
                    uQuery = String.Concat(uQuery, kvp.Key, " = '", kvp.Value, "'");
                    if (kvp.Key != l.Last().Key)
                    {
                        uQuery = String.Concat(uQuery, ", ");
                    }
                });
                if (cID == String.Empty)
                {
                    throw new Exception("Could not find content ID in the table");
                }
                uQuery = String.Concat(uQuery, " WHERE CMID = '", cID, "'");
                using (BaseCCHData b = new BaseCCHData(uQuery, true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors)
                    {
                        throw new Exception("Error updating content with changes");
                    }
                }
                this.feedback = feedback.Append("Changes Saved Successfully");
            }
            catch (Exception ex)
            {
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Page.Header.Controls.Add(new LiteralControl("<link rel=\"stylesheet\" href=\"" + ResolveUrl("~/Styles/Notify.css") + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + "\" type=\"text/css\" />"));
                ThisSession.UserLogginID = Membership.GetUser().ProviderUserKey.ToString();

                using (BaseCCHData employees = new BaseCCHData("GetBNCUserInfoForAdmin"))
                {
                    employees.GetFrontEndData();
                    if (employees.Tables.Count >= 1 && employees.Tables[0].Rows.Count > 0)
                    {
                        this.Employees = (from employee in employees.Tables[0].AsEnumerable()
                                          select new EmployeeData()
                                          {
                                              UserId = employee.Field<object>("userid"),
                                              UserName = employee.Field<object>("username"),
                                              Locked = employee.Field<object>("IsLockedOut"),
                                              EmployerID = employee.Field<object>("employerid"),
                                              ConnectionString = employee.Field<object>("connectionstring"),
                                              DataBase = employee.Field<object>("DataBase"),
                                              CCHID = employee.Field<object>("CCHID")
                                          }).ToDictionary(k => k.UserId.ToString(), v => v);
                    }
                    var t = this.Employees.Select(Em => new { Em.Value.UserName, Em.Value.UserId }).OrderBy(Em => Em.UserName).ToList();
                    ddlUsers.DataBind(t);
                    if (employees.Tables.Count >= 2 && employees.Tables[1].Rows.Count > 0)
                    {
                        this.EmployeesInRoles = (from role in employees.Tables[1].AsEnumerable()
                                                 select new RoleData()
                                                 {
                                                     UserId = role.Field<object>("userid"),
                                                     RoleName = role.Field<object>("rolename"),
                                                     UserName = role.Field<object>("username")
                                                 }).ToLookup(k => k.UserId.ToString(), v => v);
                    }
                    if (employees.Tables.Count >= 3 && employees.Tables[2].Rows.Count > 0)
                    {
                        this.Orphans = (from orphan in employees.Tables[2].AsEnumerable()
                                        select new EmployeeData()
                                        {
                                            UserId = orphan.Field<object>("userid"),
                                            UserName = orphan.Field<object>("username")
                                        }).ToDictionary(k => k.UserId.ToString(), v => v);
                    }
                    t = this.Orphans.Select(Or => new { Or.Value.UserName, Or.Value.UserId }).ToList();
                    ddlOrphans.DataBind(t);
                }
                
            }
        }
Example #5
0
        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);
                }
            }
        }
Example #6
0
        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);
                }
            }
        }
Example #7
0
        private void SetContent()
        {
            String cmQuery =
                "select " +
                String.Concat <String>(
                    emptyChanges
                    .Keys
                    .Where <String>(key =>
                                    key == "employerid" ||
                                    key == "EmployerName" ||
                                    key == "Insurer" ||
                                    key == "RXProvider" ||
                                    key == "ShowYourCostColumn")
                    .Select <String, String>(key =>
                                             "e." + key + ", ")) +
                String.Concat <String>(
                    emptyChanges
                    .Keys
                    .Where(k =>
                           k != "ContentManagementEnabled" &&
                           k != "employerid" &&
                           k != "EmployerName" &&
                           k != "Insurer" &&
                           k != "RXProvider" &&
                           k != "ShowYourCostColumn")
                    .Select <String, String>(k =>
                                             "ec." + k + ", ")) +
                "CASE WHEN ec.cmid is null THEN 0 ELSE 1 END as ContentManagementEnabled " +
                "from employers e " +
                "left join employercontent ec on e.contentid = ec.cmid";

            using (BaseCCHData b = new BaseCCHData(cmQuery, true))
            {
                b.GetFrontEndData();

                if (b.Tables.Count > 0)
                {
                    this.content = b.Tables[0];
                }
            }
        }
Example #8
0
        private void DisableCM()
        {
            String oldID           = String.Empty;
            String qUpdateEmpEntry = String.Concat(
                "UPDATE [Employers] SET ContentID = NULL OUTPUT Deleted.ContentID WHERE EmployerID = ", ddlEmployers.SelectedValue);
            String qRemCMEntry = "DELETE FROM [EmployerContent] WHERE CMID = '{0}'";

            try
            {
                using (BaseCCHData b = new BaseCCHData(qUpdateEmpEntry, true))
                {
                    b.GetFrontEndData();
                    if (b.HasErrors)
                    {
                        throw new Exception("Error  unlinking content from employer");
                    }
                    oldID = b.Tables[0].Rows[0][0].ToString();
                }
                if (oldID == String.Empty)
                {
                    throw new Exception("Could not find previous content ID");
                }
                using (BaseCCHData b = new BaseCCHData(String.Format(qRemCMEntry, oldID), true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors)
                    {
                        throw new Exception("Error removing old content from table");
                    }
                }
                this.feedback = feedback.Append(
                    String.Concat(
                        "Content Management Removed from ",
                        ddlEmployers.SelectedItem.Text,
                        " Successfully"));
            }
            catch (Exception ex)
            {
            }
        }
Example #9
0
        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
        }
Example #10
0
        private void EnableCM()
        {
            String newID       = Guid.NewGuid().ToString();
            String qAddCMEntry = String.Concat(
                "INSERT INTO [EmployerContent] (CMID, SSNOnly, HasOtherPeopleSection, HasNotificationSection, TandCVisible, CanSignIn, Canregister, InternalLogo, MemberIDFormat, ContactText, SpecialtyNetworkText, PastCareDisclaimerText, RxResultDisclaimerText, SpecialtyDrugDisclaimerText, OverrideRegisterButton, SCIQInMonth, SCIQUserEarnings, SCIQButtonText, SCIQDashboardName) ",  //  lam, 20130418, MSF-299
                "VALUES ('", newID, "', 1, 0, 0, 1, 0, 0, 0, '','','','','','',0,'','','','')");
            String qUpdateEmpEntry = String.Concat(
                "UPDATE [Employers] SET ContentID = '", newID, "' WHERE EmployerID = ", ddlEmployers.SelectedValue);

            try
            {
                using (BaseCCHData b = new BaseCCHData(qAddCMEntry, true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors)
                    {
                        throw new Exception("Error adding new entry to content management table");
                    }
                }
                using (BaseCCHData b = new BaseCCHData(qUpdateEmpEntry, true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors)
                    {
                        throw new Exception("Error updating employers with new content");
                    }
                }
                this.feedback = feedback.Append(
                    String.Concat("Content Management Added to ",
                                  ddlEmployers.SelectedItem.Text,
                                  " Successfully"));
            }
            catch (Exception ex)
            {
            }
        }
Example #11
0
        protected void ValidateInput(object sender, EventArgs e)
        {
            //Handle no email entered
            if (Email.Text.Trim() == String.Empty)
            {
                VerifyFailureText.Text = "Email is required.";
                Email.Focus();
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ResetCursor", "document.body.style.cursor = 'default';", true);
                return;
            }

            //Handle no SSN nor Member ID
            if (SSN.Text.Trim() == String.Empty && MemberID.Text.Trim() == String.Empty)
            {
                if (onlySSN)
                {
                    VerifyFailureText.Text = "Please enter the last 4 digits of your SSN.";
                    SSN.Focus();
                }
                else
                {
                    VerifyFailureText.Text = "Please enter either the last 4 digits of your SSN or you Member ID.";
                }
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ResetCursor", "document.body.style.cursor = 'default';", true);
                return;
            }

            //Get the Employer Connection String to validate the user
            String cnxString = String.Empty;
            using (GetEmployerConnString gecs = new GetEmployerConnString(empID))
            {
                if (!gecs.HasErrors && gecs.Tables[0].Rows.Count > 0)
                {
                    cnxString = gecs.ConnectionString;
                }
                else
                {
                    VerifyFailureText.Text = "There was an error validating your enrollment.";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ResetCursor", "document.body.style.cursor = 'default';", true);
                    return;
                }
            }

            //Always try to use SSN if it has something in the text box
            Boolean ssnSuccess = false;
            if (SSN.Text.Trim() != String.Empty)
            {
                String cleanSSN = Regex.Replace(SSN.Text, "[^0-9]", "");
                if (cleanSSN.Length == 4)
                {
                    String query = String.Concat(
                        "SELECT MemberSSN FROM Enrollments WHERE Email = '",
                        Email.Text.Trim(),
                        "'");
                    using (BaseCCHData b = new BaseCCHData(query, true))
                    {
                        b.GetData(cnxString);
                        if (!b.HasErrors && b.Tables[0].Rows.Count > 0)
                        {
                            Int32 idFromDB = Convert.ToInt32(b.Tables[0].Rows[0]["MemberSSN"].ToString());
                            if (idFromDB == Convert.ToInt32(cleanSSN))
                            {
                                ssnSuccess = true;
                                sSSN = cleanSSN;
                            }
                        }
                    }
                }
            }

            //If nothing was entered into SSN or if SSN validation failed
            Boolean memberIdSuccess = false;
            if (!ssnSuccess)
            {
                if (MemberID.Text.Trim() != String.Empty)
                {
                    String cleanMemberID = Regex.Replace(MemberID.Text, "[^0-9]", "");
                    if (cleanMemberID.Length == 11)
                    {
                        String query = String.Concat(
                            "SELECT MemberMedicalID FROM Enrollments WHERE Email = '",
                            Microsoft.Security.Application.Encoder.HtmlEncode(Email.Text.Trim()),
                            "'");
                        using (BaseCCHData b = new BaseCCHData(query, true))
                        {
                            b.GetData(cnxString);
                            if (!b.HasErrors && b.Tables[0].Rows.Count > 0)
                            {
                                Int64 idFromDB = Convert.ToInt64(b.Tables[0].Rows[0]["MemberMedicalID"].ToString());
                                if (idFromDB == Convert.ToInt64(cleanMemberID))
                                {
                                    memberIdSuccess = true;
                                }
                            }
                        }
                    }
                }
            }

            if (ssnSuccess || memberIdSuccess)
            {
                sUserName = Membership.GetUserNameByEmail(Microsoft.Security.Application.Encoder.HtmlEncode(Email.Text.Trim()));
                if (String.IsNullOrWhiteSpace(sUserName))
                {
                    VerifyFailureText.Text = "User not found.";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ResetCursor", "document.body.style.cursor = 'default';", true);
                }
                else
                {
                    lblQuestion.Text = Membership.GetUser(Microsoft.Security.Application.Encoder.HtmlEncode(Email.Text.Trim())).PasswordQuestion;
                    tblVerify.Visible = pnlVerify.Visible = false;
                    tblReset.Visible = pnlReset.Visible = true;
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ResetCursor", "document.body.style.cursor = 'default';", true);
                }
            }
            else
            {
                VerifyFailureText.Text = "There was an error resetting your password with the information provided.<br />Please double check the information you entered and try again.";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ResetCursor", "document.body.style.cursor = 'default';", true);
            }
        }
Example #12
0
        private void SetContent()
        {
            String cmQuery =
                "select " +
                String.Concat<String>(
                    emptyChanges
                        .Keys
                        .Where<String>(key =>
                            key == "employerid" ||
                            key == "EmployerName" ||
                            key == "Insurer" ||
                            key == "RXProvider" ||
                            key == "ShowYourCostColumn")
                        .Select<String, String>(key =>
                            "e." + key + ", ")) +
                String.Concat<String>(
                    emptyChanges
                        .Keys
                        .Where(k =>
                            k != "ContentManagementEnabled" &&
                            k != "employerid" &&
                            k != "EmployerName" &&
                            k != "Insurer" &&
                            k != "RXProvider" &&
                            k != "ShowYourCostColumn")
                        .Select<String, String>(k =>
                            "ec." + k + ", ")) +
                "CASE WHEN ec.cmid is null THEN 0 ELSE 1 END as ContentManagementEnabled " +
                    "from employers e " +
                    "left join employercontent ec on e.contentid = ec.cmid";

            using (BaseCCHData b = new BaseCCHData(cmQuery, true))
            {
                b.GetFrontEndData();

                if(b.Tables.Count > 0)
                    this.content = b.Tables[0];
            }
        }
Example #13
0
        private void SaveContent()
        {
            if (!ContentChanged) return;

            String cID = String.Empty;
            String sQuery = String.Concat("SELECT ContentID FROM [Employers] WHERE EmployerID = ", ddlEmployers.SelectedValue);
            String uQuery = "UPDATE [EmployerContent] SET ";
            try
            {
                using (BaseCCHData b = new BaseCCHData(sQuery, true))
                {
                    b.GetFrontEndData();
                    if (b.HasErrors) throw new Exception("Error finding Content in database");
                    cID = b.Tables[0].Rows[0][0].ToString();
                }

                List<KeyValuePair<String, object>> l = Changes.Where(kvp => kvp.Value != null).ToList<KeyValuePair<String, object>>();
                l.ForEach(delegate(KeyValuePair<String, object> kvp)
                {
                    uQuery = String.Concat(uQuery, kvp.Key, " = '", kvp.Value, "'");
                    if (kvp.Key != l.Last().Key) uQuery = String.Concat(uQuery, ", ");
                });
                if (cID == String.Empty) throw new Exception("Could not find content ID in the table");
                uQuery = String.Concat(uQuery, " WHERE CMID = '", cID, "'");
                using (BaseCCHData b = new BaseCCHData(uQuery, true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors) throw new Exception("Error updating content with changes");
                }
                this.feedback = feedback.Append("Changes Saved Successfully");
            }
            catch (Exception ex)
            {
            }
        }
Example #14
0
        private void EnableCM()
        {
            String newID = Guid.NewGuid().ToString();
            String qAddCMEntry = String.Concat(
                "INSERT INTO [EmployerContent] (CMID, SSNOnly, HasOtherPeopleSection, HasNotificationSection, TandCVisible, CanSignIn, Canregister, InternalLogo, MemberIDFormat, ContactText, SpecialtyNetworkText, PastCareDisclaimerText, RxResultDisclaimerText, SpecialtyDrugDisclaimerText, OverrideRegisterButton, SCIQInMonth, SCIQUserEarnings, SCIQButtonText, SCIQDashboardName) ",  //  lam, 20130418, MSF-299
                "VALUES ('", newID, "', 1, 0, 0, 1, 0, 0, 0, '','','','','','',0,'','','','')");
            String qUpdateEmpEntry = String.Concat(
                "UPDATE [Employers] SET ContentID = '", newID, "' WHERE EmployerID = ", ddlEmployers.SelectedValue);

            try
            {
                using (BaseCCHData b = new BaseCCHData(qAddCMEntry, true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors) throw new Exception("Error adding new entry to content management table");
                }
                using (BaseCCHData b = new BaseCCHData(qUpdateEmpEntry, true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors) throw new Exception("Error updating employers with new content");
                }
                this.feedback = feedback.Append(
                    String.Concat("Content Management Added to ",
                        ddlEmployers.SelectedItem.Text,
                        " Successfully"));
            }
            catch (Exception ex)
            {
            }
        }
Example #15
0
        private void DisableCM()
        {
            String oldID = String.Empty;
            String qUpdateEmpEntry = String.Concat(
                "UPDATE [Employers] SET ContentID = NULL OUTPUT Deleted.ContentID WHERE EmployerID = ", ddlEmployers.SelectedValue);
            String qRemCMEntry = "DELETE FROM [EmployerContent] WHERE CMID = '{0}'";

            try
            {
                using (BaseCCHData b = new BaseCCHData(qUpdateEmpEntry, true))
                {
                    b.GetFrontEndData();
                    if (b.HasErrors) throw new Exception("Error  unlinking content from employer");
                    oldID = b.Tables[0].Rows[0][0].ToString();
                }
                if (oldID == String.Empty) throw new Exception("Could not find previous content ID");
                using (BaseCCHData b = new BaseCCHData(String.Format(qRemCMEntry, oldID), true))
                {
                    b.PostFrontEndData();
                    if (b.HasErrors) throw new Exception("Error removing old content from table");
                }
                this.feedback = feedback.Append(
                    String.Concat(
                        "Content Management Removed from ",
                        ddlEmployers.SelectedItem.Text,
                        " Successfully"));
            }
            catch (Exception ex)
            {
            }
        }
Example #16
0
        private void SaveNewLocation(String newLatitude, String newLongitude)
        {
            dsSavedAddresses.ConnectionString = ThisSession.CnxString;
            if (rbUseSaved.Checked)
            {
                String RawQuery = "";
                if (ddlSavedAddresses.SelectedValue != "Orig")
                {
                    RawQuery = "Select Address1, Address2, City, State, Zip From SavedAltAddresses Where AddressID = '" + ddlSavedAddresses.SelectedValue + "'";
                }
                else
                {
                    RawQuery = "Select Address1, Address2, City, State, Zipcode as [Zip] from Enrollments Where CCHID = '" + ThisSession.CCHID + "'";
                }
                using (BaseCCHData b = new BaseCCHData(RawQuery, true))
                {
                    b.GetData();
                    if (b.Tables.Count > 0 && b.Tables[0].Rows.Count > 0)
                    {
                        using (DataTable dt = b.Tables[0])
                        {
                            DataRow dr = dt.Rows[0];
                            ThisSession.PatientAddress1 = dr.Field<String>("Address1");
                            ThisSession.PatientAddress2 = dr.Field<String>("Address2");
                            ThisSession.PatientCity = dr.Field<String>("City");
                            ThisSession.PatientState = dr.Field<String>("State");
                            ThisSession.PatientZipCode = dr.Field<String>("Zip");
                        }
                    }
                }
            }
            else if (cbSaveAddress.Checked)
            {
                using (SaveAddress sa = new SaveAddress())
                {
                    sa.CCHID = ThisSession.CCHID;
                    sa.Address1 = Encoder.HtmlEncode(txtChgAddress.Text);
                    sa.Address2 = String.Empty;
                    sa.City = Encoder.HtmlEncode(txtChgCity.Text);
                    sa.State = ddlState.SelectedValue;
                    if (txtChgZipCode.Text.ToLower().StartsWith("zip"))
                        sa.Zip = String.Empty;
                    else
                        sa.Zip = Encoder.HtmlEncode(txtChgZipCode.Text);
                    sa.PostData();
                }
                ThisSession.PatientAddress1 = Encoder.HtmlEncode(txtChgAddress.Text);
                ThisSession.PatientAddress2 = "";
                ThisSession.PatientCity = Encoder.HtmlEncode(txtChgCity.Text);
                ThisSession.PatientState = ddlState.SelectedValue;
                ThisSession.PatientZipCode = Encoder.HtmlEncode(txtChgZipCode.Text);
            }
            else
            {
                ThisSession.PatientAddress1 = Encoder.HtmlEncode(txtChgAddress.Text);
                ThisSession.PatientAddress2 = "";
                ThisSession.PatientCity = Encoder.HtmlEncode(txtChgCity.Text);
                ThisSession.PatientState = ddlState.SelectedValue;
                ThisSession.PatientZipCode = Encoder.HtmlEncode(txtChgZipCode.Text);
            }
            ddlSavedAddresses.Items.Clear();
            dsSavedAddresses.Select(new DataSourceSelectArguments());
            ddlSavedAddresses.DataBind();

            ClearLocationFields();
        }
Example #17
0
        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
        }
Example #18
0
 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);
         }
     }
 }
Example #19
0
        protected void ValidateInput(object sender, EventArgs e)
        {
            //Handle no email entered
            if (Email.Text.Trim() == String.Empty)
            {
                VerifyFailureText.Text = "Email is required.";
                Email.Focus();
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ResetCursor", "document.body.style.cursor = 'default';", true);
                return;
            }

            //Handle no SSN nor Member ID
            if (SSN.Text.Trim() == String.Empty && MemberID.Text.Trim() == String.Empty)
            {
                if (onlySSN)
                {
                    VerifyFailureText.Text = "Please enter the last 4 digits of your SSN.";
                    SSN.Focus();
                }
                else
                {
                    VerifyFailureText.Text = "Please enter either the last 4 digits of your SSN or you Member ID.";
                }
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ResetCursor", "document.body.style.cursor = 'default';", true);
                return;
            }

            //Get the Employer Connection String to validate the user
            String cnxString = String.Empty;

            using (GetEmployerConnString gecs = new GetEmployerConnString(empID))
            {
                if (!gecs.HasErrors && gecs.Tables[0].Rows.Count > 0)
                {
                    cnxString = gecs.ConnectionString;
                }
                else
                {
                    VerifyFailureText.Text = "There was an error validating your enrollment.";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ResetCursor", "document.body.style.cursor = 'default';", true);
                    return;
                }
            }

            //Always try to use SSN if it has something in the text box
            Boolean ssnSuccess = false;

            if (SSN.Text.Trim() != String.Empty)
            {
                String cleanSSN = Regex.Replace(SSN.Text, "[^0-9]", "");
                if (cleanSSN.Length == 4)
                {
                    String query = String.Concat(
                        "SELECT MemberSSN FROM Enrollments WHERE Email = '",
                        Email.Text.Trim(),
                        "'");
                    using (BaseCCHData b = new BaseCCHData(query, true))
                    {
                        b.GetData(cnxString);
                        if (!b.HasErrors && b.Tables[0].Rows.Count > 0)
                        {
                            Int32 idFromDB = Convert.ToInt32(b.Tables[0].Rows[0]["MemberSSN"].ToString());
                            if (idFromDB == Convert.ToInt32(cleanSSN))
                            {
                                ssnSuccess = true;
                                sSSN       = cleanSSN;
                            }
                        }
                    }
                }
            }

            //If nothing was entered into SSN or if SSN validation failed
            Boolean memberIdSuccess = false;

            if (!ssnSuccess)
            {
                if (MemberID.Text.Trim() != String.Empty)
                {
                    String cleanMemberID = Regex.Replace(MemberID.Text, "[^0-9]", "");
                    if (cleanMemberID.Length == 11)
                    {
                        String query = String.Concat(
                            "SELECT MemberMedicalID FROM Enrollments WHERE Email = '",
                            Microsoft.Security.Application.Encoder.HtmlEncode(Email.Text.Trim()),
                            "'");
                        using (BaseCCHData b = new BaseCCHData(query, true))
                        {
                            b.GetData(cnxString);
                            if (!b.HasErrors && b.Tables[0].Rows.Count > 0)
                            {
                                Int64 idFromDB = Convert.ToInt64(b.Tables[0].Rows[0]["MemberMedicalID"].ToString());
                                if (idFromDB == Convert.ToInt64(cleanMemberID))
                                {
                                    memberIdSuccess = true;
                                }
                            }
                        }
                    }
                }
            }

            if (ssnSuccess || memberIdSuccess)
            {
                sUserName = Membership.GetUserNameByEmail(Microsoft.Security.Application.Encoder.HtmlEncode(Email.Text.Trim()));
                if (String.IsNullOrWhiteSpace(sUserName))
                {
                    VerifyFailureText.Text = "User not found.";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ResetCursor", "document.body.style.cursor = 'default';", true);
                }
                else
                {
                    lblQuestion.Text  = Membership.GetUser(Microsoft.Security.Application.Encoder.HtmlEncode(Email.Text.Trim())).PasswordQuestion;
                    tblVerify.Visible = pnlVerify.Visible = false;
                    tblReset.Visible  = pnlReset.Visible = true;
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "ResetCursor", "document.body.style.cursor = 'default';", true);
                }
            }
            else
            {
                VerifyFailureText.Text = "There was an error resetting your password with the information provided.<br />Please double check the information you entered and try again.";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ResetCursor", "document.body.style.cursor = 'default';", true);
            }
        }
Example #20
0
        private void SaveNewLocation(String newLatitude, String newLongitude)
        {
            dsSavedAddresses.ConnectionString = ThisSession.CnxString;
            if (rbUseSaved.Checked)
            {
                String RawQuery = "";
                if (ddlSavedAddresses.SelectedValue != "Orig")
                {
                    RawQuery = "Select Address1, Address2, City, State, Zip From SavedAltAddresses Where AddressID = '" + ddlSavedAddresses.SelectedValue + "'";
                }
                else
                {
                    RawQuery = "Select Address1, Address2, City, State, Zipcode as [Zip] from Enrollments Where CCHID = '" + ThisSession.CCHID + "'";
                }
                using (BaseCCHData b = new BaseCCHData(RawQuery, true))
                {
                    b.GetData();
                    if (b.Tables.Count > 0 && b.Tables[0].Rows.Count > 0)
                    {
                        using (DataTable dt = b.Tables[0])
                        {
                            DataRow dr = dt.Rows[0];
                            ThisSession.PatientAddress1 = dr.Field <String>("Address1");
                            ThisSession.PatientAddress2 = dr.Field <String>("Address2");
                            ThisSession.PatientCity     = dr.Field <String>("City");
                            ThisSession.PatientState    = dr.Field <String>("State");
                            ThisSession.PatientZipCode  = dr.Field <String>("Zip");
                        }
                    }
                }
            }
            else if (cbSaveAddress.Checked)
            {
                using (SaveAddress sa = new SaveAddress())
                {
                    sa.CCHID    = ThisSession.CCHID;
                    sa.Address1 = Encoder.HtmlEncode(txtChgAddress.Text);
                    sa.Address2 = String.Empty;
                    sa.City     = Encoder.HtmlEncode(txtChgCity.Text);
                    sa.State    = ddlState.SelectedValue;
                    if (txtChgZipCode.Text.ToLower().StartsWith("zip"))
                    {
                        sa.Zip = String.Empty;
                    }
                    else
                    {
                        sa.Zip = Encoder.HtmlEncode(txtChgZipCode.Text);
                    }
                    sa.PostData();
                }
                ThisSession.PatientAddress1 = Encoder.HtmlEncode(txtChgAddress.Text);
                ThisSession.PatientAddress2 = "";
                ThisSession.PatientCity     = Encoder.HtmlEncode(txtChgCity.Text);
                ThisSession.PatientState    = ddlState.SelectedValue;
                ThisSession.PatientZipCode  = Encoder.HtmlEncode(txtChgZipCode.Text);
            }
            else
            {
                ThisSession.PatientAddress1 = Encoder.HtmlEncode(txtChgAddress.Text);
                ThisSession.PatientAddress2 = "";
                ThisSession.PatientCity     = Encoder.HtmlEncode(txtChgCity.Text);
                ThisSession.PatientState    = ddlState.SelectedValue;
                ThisSession.PatientZipCode  = Encoder.HtmlEncode(txtChgZipCode.Text);
            }
            ddlSavedAddresses.Items.Clear();
            dsSavedAddresses.Select(new DataSourceSelectArguments());
            ddlSavedAddresses.DataBind();

            ClearLocationFields();
        }
Example #21
0
        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);
            }
        }
Example #22
0
        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();
            }
        }
Example #23
0
        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.";
            //}
        }
Example #24
0
        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(); }
                }
            }
        }
Example #25
0
        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();
            }
        }
Example #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Page.Header.Controls.Add(new LiteralControl("<link rel=\"stylesheet\" href=\"" + ResolveUrl("~/Styles/Notify.css") + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + "\" type=\"text/css\" />"));
                ThisSession.UserLogginID = Membership.GetUser().ProviderUserKey.ToString();

                using (BaseCCHData employees = new BaseCCHData("GetBNCUserInfoForAdmin"))
                {
                    employees.GetFrontEndData();
                    if (employees.Tables.Count >= 1 && employees.Tables[0].Rows.Count > 0)
                    {
                        this.Employees = (from employee in employees.Tables[0].AsEnumerable()
                                          select new EmployeeData()
                                          {
                                              UserId = employee.Field<object>("userid"),
                                              UserName = employee.Field<object>("username"),
                                              Locked = employee.Field<object>("IsLockedOut"),
                                              EmployerID = employee.Field<object>("employerid"),
                                              ConnectionString = employee.Field<object>("connectionstring"),
                                              DataBase = employee.Field<object>("DataBase"),
                                              CCHID = employee.Field<object>("CCHID")
                                          }).ToDictionary(k => k.UserId.ToString(), v => v);
                    }
                    var t = this.Employees.Select(Em => new { Em.Value.UserName, Em.Value.UserId }).OrderBy(Em => Em.UserName).ToList();
                    ddlUsers.DataBind(t);
                    if (employees.Tables.Count >= 2 && employees.Tables[1].Rows.Count > 0)
                    {
                        this.EmployeesInRoles = (from role in employees.Tables[1].AsEnumerable()
                                                 select new RoleData()
                                                 {
                                                     UserId = role.Field<object>("userid"),
                                                     RoleName = role.Field<object>("rolename"),
                                                     UserName = role.Field<object>("username")
                                                 }).ToLookup(k => k.UserId.ToString(), v => v);
                    }
                    if (employees.Tables.Count >= 3 && employees.Tables[2].Rows.Count > 0)
                    {
                        this.Orphans = (from orphan in employees.Tables[2].AsEnumerable()
                                        select new EmployeeData()
                                        {
                                            UserId = orphan.Field<object>("userid"),
                                            UserName = orphan.Field<object>("username")
                                        }).ToDictionary(k => k.UserId.ToString(), v => v);
                    }
                    t = this.Orphans.Select(Or => new { Or.Value.UserName, Or.Value.UserId }).ToList();
                    ddlOrphans.DataBind(t);
                }

            }
        }