protected void btnChangePassword_Click(object sender, EventArgs e) { Page.Validate(); if (Page.IsValid) { //passwords match and page is valid so save the new password using (QueriesTableAdapters.QueriesTableAdapter qta = new QueriesTableAdapters.QueriesTableAdapter()) { qta.sp_ChangePasswordByLogin(StringCipher.Decrypt(Request.QueryString["u"]), StringCipher.Encrypt(this.txtConfirmPassword.Text.Trim(), true)); SetVisibleControls(true); } } }
protected void btnChangePassword_Click(object sender, EventArgs e) { Page.Validate(); if (Page.IsValid) { //passwords match and page is valid so save the new password using (QueriesTableAdapters.QueriesTableAdapter qta = new QueriesTableAdapters.QueriesTableAdapter()) { qta.sp_ChangePasswordByLogin(StringCipher.Decrypt(Request.QueryString["u"]), StringCipher.Encrypt(this.txtConfirmPassword.Text.Trim(), true)); SetVisibleControls(true); } } }
protected void btnSavePersonalSettings_Click(object sender, EventArgs e) { using (QueriesTableAdapters.QueriesTableAdapter qta = new QueriesTableAdapters.QueriesTableAdapter()) { DateTime dtBirthdate = DateTime.Today.Date; try { dtBirthdate = new DateTime(Convert.ToInt32(ddBirthdate_Year.SelectedValue), Convert.ToInt32(ddBirthdate_Month.SelectedValue), Convert.ToInt32(txtBirthdate_Day.Text.Trim())); } catch (ArgumentOutOfRangeException) { return; } qta.sp_UpdateUserSettings(LoginRow.user_id, Convert.ToByte(((TextBox)this.fvLowNormal.Row.FindControl("LowNormal")).Text), Convert.ToByte(((TextBox)this.fvHighNormal.Row.FindControl("HighNormal")).Text), Convert.ToByte(ddMorningStart.SelectedValue), Convert.ToByte(ddAfternoonStart.SelectedValue), Convert.ToByte(ddNightStart.SelectedValue), PendingAvatar, txtFirstName.Text.Trim(), txtMiddleName.Text.Trim(), txtLastName.Text.Trim(), txtAddress1.Text.Trim(), txtAddress2.Text.Trim(), txtCity.Text.Trim(), Convert.ToInt16(ddState.SelectedValue), txtZipcode.Text.Trim(), Convert.ToByte(ddUserType.SelectedValue), Convert.ToInt32(ddCountry.SelectedValue), Convert.ToInt32(ddIncome.SelectedValue), Convert.ToInt16(ddSex.SelectedValue), Convert.ToInt16(ddRace.SelectedValue), dtBirthdate, txtEmail.Text.Trim(), txtOtherState.Text.Trim(), Convert.ToInt16(ddTimezone.SelectedValue), Convert.ToInt16(ddDiabetesType.SelectedValue)); } Session.Remove("PendingAvatar"); if (Session["OnSave"] != null && Session["OnSave"].ToString().Trim() != null && Session["OnSave"].ToString().Trim() != string.Empty) { string target = Session["OnSave"].ToString(); Session.Remove("OnSave"); Response.Redirect(target); } }
protected void btnFinishRegistration_Click(object sender, EventArgs e) { Page.Validate(); if (Page.IsValid) { using (QueriesTableAdapters.sp_DoesLoginExistTableAdapter ta = new QueriesTableAdapters.sp_DoesLoginExistTableAdapter()) { using (Queries.sp_DoesLoginExistDataTable dt = new Queries.sp_DoesLoginExistDataTable()) { ta.Fill(dt, Session["login"].ToString().Trim().ToLowerInvariant()); if (((int)dt.Rows[0]["Count"]) == 0) { //no login of this name so clear to create a new one using (QueriesTableAdapters.QueriesTableAdapter qta = new QueriesTableAdapters.QueriesTableAdapter()) { short stateid = 0; try { stateid = Convert.ToInt16(State.SelectedValue); } catch { } DateTime dtBirthdate = DateTime.Today.Date; try { dtBirthdate = new DateTime(Convert.ToInt32(ddBirthdate_Year.SelectedValue), Convert.ToInt32(ddBirthdate_Month.SelectedValue), Convert.ToInt32(txtBirthdate_Day.Text.Trim())); } catch (ArgumentOutOfRangeException) { return; } //call stored procedure to add new user qta.sp_CreateLogin(FirstName.Text.Trim(), MiddleName.Text.Trim(), LastName.Text.Trim(), Address1.Text.Trim(), Address2.Text.Trim(), City.Text.Trim(), stateid, Zipcode.Text.Trim(), Session["login"].ToString().Trim(), StringCipher.Encrypt(Session["password"].ToString().Trim(), true), null, null, 1,//usertype Convert.ToInt32(Country.SelectedValue), Convert.ToInt32(Income.SelectedValue), Convert.ToInt16(Sex.SelectedValue), Convert.ToInt16(Race.SelectedValue), dtBirthdate, null, Session["email"].ToString().Trim(), OtherState.Text.Trim(), true, Convert.ToInt16(Timezone.SelectedValue), Convert.ToInt16(DiabetesType.SelectedValue)); } Response.Redirect("/Account/RegistrationComplete.aspx"); } } } } }
protected void btnFinishRegistration_Click(object sender, EventArgs e) { Page.Validate(); if (Page.IsValid) { using (QueriesTableAdapters.sp_DoesLoginExistTableAdapter ta = new QueriesTableAdapters.sp_DoesLoginExistTableAdapter()) { using (Queries.sp_DoesLoginExistDataTable dt = new Queries.sp_DoesLoginExistDataTable()) { ta.Fill(dt, Session["login"].ToString().Trim().ToLowerInvariant()); if (((int)dt.Rows[0]["Count"]) == 0) { //no login of this name so clear to create a new one using (QueriesTableAdapters.QueriesTableAdapter qta = new QueriesTableAdapters.QueriesTableAdapter()) { short stateid = 0; try { stateid = Convert.ToInt16(State.SelectedValue); } catch { } DateTime dtBirthdate = DateTime.Today.Date; try { dtBirthdate = new DateTime(Convert.ToInt32(ddBirthdate_Year.SelectedValue), Convert.ToInt32(ddBirthdate_Month.SelectedValue), Convert.ToInt32(txtBirthdate_Day.Text.Trim())); } catch (ArgumentOutOfRangeException) { return; } //call stored procedure to add new user qta.sp_CreateLogin(FirstName.Text.Trim(), MiddleName.Text.Trim(), LastName.Text.Trim(), Address1.Text.Trim(), Address2.Text.Trim(), City.Text.Trim(), stateid, Zipcode.Text.Trim(), Session["login"].ToString().Trim(), StringCipher.Encrypt(Session["password"].ToString().Trim(), true), null, null, 1,//usertype Convert.ToInt32(Country.SelectedValue), Convert.ToInt32(Income.SelectedValue), Convert.ToInt16(Sex.SelectedValue), Convert.ToInt16(Race.SelectedValue), dtBirthdate, null, Session["email"].ToString().Trim(), OtherState.Text.Trim(), true, Convert.ToInt16(Timezone.SelectedValue), Convert.ToInt16(DiabetesType.SelectedValue)); } Response.Redirect("/Account/RegistrationComplete.aspx"); } } } } }
protected void btnSavePersonalSettings_Click(object sender, EventArgs e) { using (QueriesTableAdapters.QueriesTableAdapter qta = new QueriesTableAdapters.QueriesTableAdapter()) { DateTime dtBirthdate = DateTime.Today.Date; try { dtBirthdate = new DateTime(Convert.ToInt32(ddBirthdate_Year.SelectedValue), Convert.ToInt32(ddBirthdate_Month.SelectedValue), Convert.ToInt32(txtBirthdate_Day.Text.Trim())); } catch (ArgumentOutOfRangeException) { return; } qta.sp_UpdateUserSettings(LoginRow.user_id, Convert.ToByte(((TextBox)this.fvLowNormal.Row.FindControl("LowNormal")).Text), Convert.ToByte(((TextBox)this.fvHighNormal.Row.FindControl("HighNormal")).Text), Convert.ToByte(ddMorningStart.SelectedValue), Convert.ToByte(ddAfternoonStart.SelectedValue), Convert.ToByte(ddNightStart.SelectedValue), PendingAvatar, txtFirstName.Text.Trim(), txtMiddleName.Text.Trim(), txtLastName.Text.Trim(), txtAddress1.Text.Trim(), txtAddress2.Text.Trim(), txtCity.Text.Trim(), Convert.ToInt16(ddState.SelectedValue), txtZipcode.Text.Trim(), Convert.ToByte(ddUserType.SelectedValue), Convert.ToInt32(ddCountry.SelectedValue), Convert.ToInt32(ddIncome.SelectedValue), Convert.ToInt16(ddSex.SelectedValue), Convert.ToInt16(ddRace.SelectedValue), dtBirthdate, txtEmail.Text.Trim(), txtOtherState.Text.Trim(), Convert.ToInt16(ddTimezone.SelectedValue), Convert.ToInt16(ddDiabetesType.SelectedValue)); } Session.Remove("PendingAvatar"); if (Session["OnSave"] != null && Session["OnSave"].ToString().Trim() != null && Session["OnSave"].ToString().Trim() != string.Empty) { string target = Session["OnSave"].ToString(); Session.Remove("OnSave"); Response.Redirect(target); } }