protected void btnSave_Click(object sender, EventArgs e)
    {
        int user_id = Convert.ToInt32(Request.QueryString["userID"]);
        int training_id = Convert.ToInt32(ddlTrainings.SelectedValue);

        qLrn_UserTraining u_training = qLrn_UserTraining.GetUserTraining(user_id, training_id);
        qPtl_UserProfile u_profile = new qPtl_UserProfile(user_id);
        qLrn_Training training = new qLrn_Training(training_id);

        u_profile.Phone1 = txtPhone.Text;
        u_profile.Phone1Type = "Work";
        u_profile.LastModified = DateTime.Now;
        u_profile.Update();

        // if changing from waitlist then display option for email notification
        if (u_training.Status.Contains("Waitlist") && !Convert.ToString(ddlStatus.SelectedValue).Contains("Waitlist"))
            btnSendWaitlistEmail.Visible = true;
        else
            btnSendWaitlistEmail.Visible = false;

        u_training.Status = Convert.ToString(ddlStatus.SelectedValue);
        u_training.PaymentMethod = rblPaymentOption.SelectedValue;
        u_training.ApplyingForCECredits = ddlCredits.SelectedValue;
        string evalDate = Convert.ToString(dpkCompletedDate.SelectedDate);
        DateTime newCompletedDate = new DateTime();

        if (training.TrainingTypeID == 3 && ddlStatus.SelectedValue == "Completed" && !String.IsNullOrEmpty(evalDate))
            if (DateTime.TryParse(evalDate, out newCompletedDate))
                u_training.Completed = newCompletedDate;
        else if (training.TrainingTypeID == 3 && ddlStatus.SelectedValue == "Completed")
            u_training.Completed = training.EndTime;
        else
            u_training.Completed = null;

        if (!String.IsNullOrEmpty(ddlSelectCredit.SelectedValue))
            u_training.CECreditID = Convert.ToInt32(ddlSelectCredit.SelectedValue);
        else
            u_training.CECreditID = 0;

        u_training.Update();

        lblMessage.Text = " * Training information successfully updated";
    }
    protected void btnAgreeRules_Click(object sender, EventArgs e)
    {
        int user_id = Convert.ToInt32(Context.Items["UserID"]);
        qPtl_UserProfile profile = new qPtl_UserProfile(user_id);
        profile.AgreeRules = DateTime.Now;
        profile.Update();

        // see if this is the action page -- if so, update actionID
        int action_id = 0;
        if (!String.IsNullOrEmpty(Convert.ToString(Request.QueryString["actionID"])))
        {
            action_id = Convert.ToInt32(Request.QueryString["actionID"]);
            qPtl_UserAction action = new qPtl_UserAction(user_id, action_id);
            action.LastModified = DateTime.Now;
            action.LastModifiedBy = user_id;
            action.UserCompleted = DateTime.Now;
            action.Update();

            Response.Redirect(action.RedirectURL);
        }
    }
Beispiel #3
0
    protected void btnAgreeRules_Click(object sender, EventArgs e)
    {
        int user_id = Convert.ToInt32(Context.Items["UserID"]);
        qPtl_UserProfile profile = new qPtl_UserProfile(user_id);

        profile.AgreeRules = DateTime.Now;
        profile.Update();

        // see if this is the action page -- if so, update actionID
        int action_id = 0;

        if (!String.IsNullOrEmpty(Convert.ToString(Request.QueryString["actionID"])))
        {
            action_id = Convert.ToInt32(Request.QueryString["actionID"]);
            qPtl_UserAction action = new qPtl_UserAction(user_id, action_id);
            action.LastModified   = DateTime.Now;
            action.LastModifiedBy = user_id;
            action.UserCompleted  = DateTime.Now;
            action.Update();

            Response.Redirect(action.RedirectURL);
        }
    }
    protected void btnEnroll_Click(object sender, EventArgs e)
    {
        // run check for mobile text
        if (!String.IsNullOrEmpty(lblCampaignID.Text))
        {
            campaign_id = Convert.ToInt32(lblCampaignID.Text);
        }
        return_url = lblReturnURL.Text;
        string mobile_number = txtMobileNumber.Text;
        bool error_occurred = false;
        bool phone_belongs_to_another_user = false;

        // check to see if this number is already being used by another user
        int curr_user_id = Convert.ToInt32(Context.Items["UserID"]);
        int scope_id = Convert.ToInt32(Context.Items["ScopeID"]);

        var check_user = qPtl_User.GetUserByPhone(txtMobileNumber.Text, scope_id);

        if (check_user.UserID > 0)
        {
            if (check_user.UserID != curr_user_id)
            {
                error_occurred = true;
                phone_belongs_to_another_user = true;
            }
        }

        // replace characters
        if (mobile_number.Contains("-"))
            mobile_number = mobile_number.Replace("-", "");

        if (mobile_number.Contains("."))
            mobile_number = mobile_number.Replace(".", "");

        if (mobile_number.Contains("/"))
            mobile_number = mobile_number.Replace("/", "");

        if (mobile_number.Contains("("))
            mobile_number = mobile_number.Replace("(", "");

        if (mobile_number.Contains(")"))
            mobile_number = mobile_number.Replace(")", "");

        if (mobile_number.Contains("*"))
            mobile_number = mobile_number.Replace("*", "");

        if (mobile_number.Contains(" "))
            mobile_number = mobile_number.Replace(" ", "");

        try
        {
            string first_char = mobile_number.Substring(0, 1);
            if (mobile_number.Length == 11 && first_char == "1")
                mobile_number = mobile_number.Substring(1, 10);
        }
        catch
        {
            litMsg.Text = "<br><br>* Make sure to enter a 10 digit phone number";
            error_occurred = true;
        }

        if (String.IsNullOrEmpty(mobile_number))
        {
            litMsg.Text = "<br><br>* Make sure to enter a 10 digit phone number";
            error_occurred = true;
        }

        string pat_m = @"^[0-9]{10}$";
        Regex r_m = new Regex(pat_m, RegexOptions.IgnoreCase);
        Match m_m = r_m.Match(mobile_number);
        if (!m_m.Success)
        {
            error_occurred = true;
            litMsg.Text = "<br><br>* Make sure to enter a 10 digit phone number";
        }

        if (error_occurred == false)
        {

            if (btnEnroll.Text == "Turn Off Text Messages")
            {
                qCom_UserPreference pref = new qCom_UserPreference(curr_user_id);
                pref.OkSms = "No";
                pref.Update();
            }
            else
            {
                // save phone number to profile
                qPtl_UserProfile profile = new qPtl_UserProfile(curr_user_id);
                if (profile.Phone1Type == "Mobile")
                {
                    profile.Phone1 = string.Empty;
                    profile.Phone1Type = string.Empty;
                }
                if (profile.Phone2Type == "Mobile")
                {
                    profile.Phone2 = string.Empty;
                    profile.Phone2Type = string.Empty;
                }
                profile.Phone1 = txtMobileNumber.Text;
                profile.Phone1Type = "Mobile";

                profile.Update();

                // add new mobile verification code to qCom_UserPreferences
                var pref = qCom_UserPreference.GetUserPreference(curr_user_id);
                int new_pin = qCom_UserPreference.GenerateMobilePIN();

                if (pref != null)
                {
                    if (pref.UserID > 0)
                    {
                        pref.MobilePIN = Convert.ToString(new_pin);
                        pref.Update();
                    }
                }
                else
                {
                    qCom_UserPreference pref2 = new qCom_UserPreference();
                    pref2.ScopeID = Convert.ToInt32(Context.Items["ScopeID"]);
                    pref2.Available = "Yes";
                    pref2.Created = DateTime.Now;
                    pref2.CreatedBy = curr_user_id;
                    pref2.LastModified = DateTime.Now;
                    pref2.LastModifiedBy = curr_user_id;
                    pref2.UserID = curr_user_id;
                    pref2.OkBulkEmail = "Yes";
                    pref2.OkSms = "Yes";
                    pref2.OkEmail = "Yes";
                    pref2.MobilePIN = Convert.ToString(new_pin);
                    pref2.Insert();
                }

                // get correct DID
                string alt_did = string.Empty;
                // see if user has custom record
                var camp_pref = qCom_UserCampaignPreference.GetUserCampaignPreferences(campaign_id, curr_user_id);
                if (camp_pref != null)
                    alt_did = camp_pref.DID;
                else
                {
                    // see if campaign has available dedicated DIDs
                    qSoc_Campaign campaign = new qSoc_Campaign(campaign_id);
                    qPtl_User user = new qPtl_User(curr_user_id);
                    alt_did = AddCampaignUserPreference(campaign, user, scope_id);

                    if (String.IsNullOrEmpty(alt_did))
                        alt_did = System.Configuration.ConfigurationManager.AppSettings["SMSDid"];
                }

                string alt_pin_message_uri = string.Empty;
                var c_pref = qCom_CampaignPreference.GetCampaignPreferences(campaign_id);
                if (c_pref != null)
                {
                    if (c_pref.CampaignPreferenceID > 0)
                    {
                        alt_pin_message_uri = c_pref.MobileVerifySMSURI;
                    }
                }

                // send mobile pin
                qCom_UserPreference.SendMobilePIN(Convert.ToString(new_pin), curr_user_id, alt_did, alt_pin_message_uri);

                plhManage.Visible = false;
                plhVerify.Visible = true;
            }
        }
        else
        {
            if (phone_belongs_to_another_user == true)
                litMsg.Text = "<br><br>* This phone number belongs to another user.";
        }
    }
    protected void btnUpdateProfile_Click(object sender, EventArgs e)
    {
        profile_id = Convert.ToInt32(Request.QueryString["userID"]);
        Page.Validate("profile");

        if (Page.IsValid)
        {
            qPtl_User user = new qPtl_User(profile_id);
            user.FirstName = txtFirstName.Text;
            user.LastName = txtLastName.Text;
            user.Email = txtEmail.Text;
            user.Update();

            qPtl_UserProfile profile = new qPtl_UserProfile(profile_id);
            profile.Gender = ddlGender.SelectedValue;
            if (!String.IsNullOrEmpty(Convert.ToString(rdtDOB)))
                profile.DOB = rdtDOB.SelectedDate;
            string race = string.Empty;
            int n = 0;
            foreach (ListItem item in cblRace.Items)
            {
                if (item.Selected)
                {
                    if (n > 0)
                    {
                        race += "," + item.Value;
                    }
                    else
                    {
                        race += item.Value;
                    }
                    n++;
                }
            }
            n = 0;
            profile.Race = race;
            profile.Update();

            Response.Redirect("/manage/members/member-profile.aspx?userID=" + profile_id + "&currTab=profile&message=successfully updated member profile");
        }
    }
Beispiel #6
0
    protected void btnEnroll_Click(object sender, EventArgs e)
    {
        // run check for mobile text
        if (!String.IsNullOrEmpty(lblCampaignID.Text))
        {
            campaign_id = Convert.ToInt32(lblCampaignID.Text);
        }
        return_url = lblReturnURL.Text;
        string mobile_number  = txtMobileNumber.Text;
        bool   error_occurred = false;
        bool   phone_belongs_to_another_user = false;

        // check to see if this number is already being used by another user
        int curr_user_id = Convert.ToInt32(Context.Items["UserID"]);
        int scope_id     = Convert.ToInt32(Context.Items["ScopeID"]);

        var check_user = qPtl_User.GetUserByPhone(txtMobileNumber.Text, scope_id);

        if (check_user.UserID > 0)
        {
            if (check_user.UserID != curr_user_id)
            {
                error_occurred = true;
                phone_belongs_to_another_user = true;
            }
        }

        // replace characters
        if (mobile_number.Contains("-"))
        {
            mobile_number = mobile_number.Replace("-", "");
        }

        if (mobile_number.Contains("."))
        {
            mobile_number = mobile_number.Replace(".", "");
        }

        if (mobile_number.Contains("/"))
        {
            mobile_number = mobile_number.Replace("/", "");
        }

        if (mobile_number.Contains("("))
        {
            mobile_number = mobile_number.Replace("(", "");
        }

        if (mobile_number.Contains(")"))
        {
            mobile_number = mobile_number.Replace(")", "");
        }

        if (mobile_number.Contains("*"))
        {
            mobile_number = mobile_number.Replace("*", "");
        }

        if (mobile_number.Contains(" "))
        {
            mobile_number = mobile_number.Replace(" ", "");
        }

        try
        {
            string first_char = mobile_number.Substring(0, 1);
            if (mobile_number.Length == 11 && first_char == "1")
            {
                mobile_number = mobile_number.Substring(1, 10);
            }
        }
        catch
        {
            litMsg.Text    = "<br><br>* Make sure to enter a 10 digit phone number";
            error_occurred = true;
        }

        if (String.IsNullOrEmpty(mobile_number))
        {
            litMsg.Text    = "<br><br>* Make sure to enter a 10 digit phone number";
            error_occurred = true;
        }

        string pat_m = @"^[0-9]{10}$";
        Regex  r_m   = new Regex(pat_m, RegexOptions.IgnoreCase);
        Match  m_m   = r_m.Match(mobile_number);

        if (!m_m.Success)
        {
            error_occurred = true;
            litMsg.Text    = "<br><br>* Make sure to enter a 10 digit phone number";
        }

        if (error_occurred == false)
        {
            if (btnEnroll.Text == "Turn Off Text Messages")
            {
                qCom_UserPreference pref = new qCom_UserPreference(curr_user_id);
                pref.OkSms = "No";
                pref.Update();
            }
            else
            {
                // save phone number to profile
                qPtl_UserProfile profile = new qPtl_UserProfile(curr_user_id);
                if (profile.Phone1Type == "Mobile")
                {
                    profile.Phone1     = string.Empty;
                    profile.Phone1Type = string.Empty;
                }
                if (profile.Phone2Type == "Mobile")
                {
                    profile.Phone2     = string.Empty;
                    profile.Phone2Type = string.Empty;
                }
                profile.Phone1     = txtMobileNumber.Text;
                profile.Phone1Type = "Mobile";

                profile.Update();

                // add new mobile verification code to qCom_UserPreferences
                var pref    = qCom_UserPreference.GetUserPreference(curr_user_id);
                int new_pin = qCom_UserPreference.GenerateMobilePIN();

                if (pref != null)
                {
                    if (pref.UserID > 0)
                    {
                        pref.MobilePIN = Convert.ToString(new_pin);
                        pref.Update();
                    }
                }
                else
                {
                    qCom_UserPreference pref2 = new qCom_UserPreference();
                    pref2.ScopeID        = Convert.ToInt32(Context.Items["ScopeID"]);
                    pref2.Available      = "Yes";
                    pref2.Created        = DateTime.Now;
                    pref2.CreatedBy      = curr_user_id;
                    pref2.LastModified   = DateTime.Now;
                    pref2.LastModifiedBy = curr_user_id;
                    pref2.UserID         = curr_user_id;
                    pref2.OkBulkEmail    = "Yes";
                    pref2.OkSms          = "Yes";
                    pref2.OkEmail        = "Yes";
                    pref2.MobilePIN      = Convert.ToString(new_pin);
                    pref2.Insert();
                }

                // get correct DID
                string alt_did = string.Empty;
                // see if user has custom record
                var camp_pref = qCom_UserCampaignPreference.GetUserCampaignPreferences(campaign_id, curr_user_id);
                if (camp_pref != null)
                {
                    alt_did = camp_pref.DID;
                }
                else
                {
                    // see if campaign has available dedicated DIDs
                    qSoc_Campaign campaign = new qSoc_Campaign(campaign_id);
                    qPtl_User     user     = new qPtl_User(curr_user_id);
                    alt_did = AddCampaignUserPreference(campaign, user, scope_id);

                    if (String.IsNullOrEmpty(alt_did))
                    {
                        alt_did = System.Configuration.ConfigurationManager.AppSettings["SMSDid"];
                    }
                }

                string alt_pin_message_uri = string.Empty;
                var    c_pref = qCom_CampaignPreference.GetCampaignPreferences(campaign_id);
                if (c_pref != null)
                {
                    if (c_pref.CampaignPreferenceID > 0)
                    {
                        alt_pin_message_uri = c_pref.MobileVerifySMSURI;
                    }
                }

                // send mobile pin
                qCom_UserPreference.SendMobilePIN(Convert.ToString(new_pin), curr_user_id, alt_did, alt_pin_message_uri);

                plhManage.Visible = false;
                plhVerify.Visible = true;
            }
        }
        else
        {
            if (phone_belongs_to_another_user == true)
            {
                litMsg.Text = "<br><br>* This phone number belongs to another user.";
            }
        }
    }