protected void btnRegister_Click(object sender, EventArgs e) { UserInfoBll userBll = new UserInfoBll(); UserProfile userProfile = new UserProfile(); try { string ErrorMsg = ""; userProfile.UserId = 0; userProfile.FirstName = txtFirstname.Text.ToString().Trim(); userProfile.LastName = txtLastname.Text.ToString().Trim(); userProfile.Email = txtEmail.Text.ToString().Trim(); userProfile.UserName = txtUsername.Text.ToString().Trim(); userProfile.UserPassword = txtPassword.Text.ToString().Trim(); userProfile.Address = txtAddress.Text.ToString().Trim(); userProfile.Mobile = txtMobile.Text.ToString().Trim(); userProfile.StreetName = txtStreetname.Text.ToString().Trim(); userProfile.CityId = Convert.ToInt32(ddlCity.SelectedItem.Value.ToString().Trim()); userProfile.StateId = Convert.ToInt32(ddlState.SelectedItem.Value.ToString().Trim()); userProfile.ZipCode = txtZipcode.Text.ToString().Trim(); userProfile.CountryId = Convert.ToInt32(ddlCountry.SelectedItem.Value.ToString().Trim()); userProfile.Gender = int.Parse(RadioButtonList1.SelectedItem.Value.ToString().Trim()); ErrorMsg = "Error:"; int intErrorCount = 0; UserCheck(); if (this.intUserAvail == 1) { intErrorCount++; } if (txtPassword.Text != txtRePassword.Text) { //errPwd.Text = "Password mismatch"; //errPwd.Visible = true; intErrorCount++; } //else //errPwd.Visible = false; if (chkYardecart.Checked == false) { ErrCheck.Text = "Please check signup"; ErrCheck.Visible = true; intErrorCount++; } else { ErrCheck.Visible = false; } MailCheck(); if (intMailAvail == 1) { intErrorCount++; lblErrorEmail.Visible = true; } else { lblErrorEmail.Visible = false; } if (chkYardecart.Checked == true && intErrorCount == 0) { int x = userBll.CreateUserInfo(userProfile); //HttpContext.Current.Session.Add("UserId", x); SendMailtoUser(x); Response.Redirect("Success.aspx"); } } catch (System.Threading.ThreadAbortException th) { } catch (Exception ex) { lblError.Text = ex.Message; lblError.Visible = true; } }
protected void btnSave_Click(object sender, EventArgs e) { int intErrorCount = 0; if (strEmail != txtEmail.Text.Trim()) { MailCheck(txtEmail.Text.Trim()); if (intMailAvail == 1) { intErrorCount++; lblErrorEmail.Visible = true; } else { lblErrorEmail.Visible = false; } } if (intErrorCount == 0) { UserInfoBll userBll = new UserInfoBll(); UserProfile userProfile = new UserProfile(); try { userProfile.UserId = Convert.ToInt32(Session["UserId"].ToString()); userProfile.UserName = strUsername; if (txtNewpwd.Text.Trim() != "") { userProfile.UserPassword = txtNewpwd.Text; } else { userProfile.UserPassword = strPassword; } userProfile.FirstName = txtFirstName.Text.ToString().Trim(); userProfile.LastName = txtLastName.Text.ToString().Trim(); userProfile.Email = txtEmail.Text.ToString().Trim(); userProfile.Address = txtAddress.Text.ToString().Trim(); userProfile.Mobile = txtMobile.Text.ToString().Trim(); userProfile.StreetName = txtStreetname.Text.ToString().Trim(); userProfile.CityId = Convert.ToInt32(ddlCity.SelectedItem.Value.ToString().Trim()); userProfile.StateId = Convert.ToInt32(ddlState.SelectedItem.Value.ToString().Trim()); userProfile.ZipCode = txtZipcode.Text.ToString().Trim(); userProfile.CountryId = Convert.ToInt32(ddlCountry.SelectedItem.Value.ToString().Trim()); userProfile.Gender = int.Parse(RadioButtonList1.SelectedItem.Value.ToString().Trim()); if (intErrorCount == 0) { int x = userBll.CreateUserInfo(userProfile); //HttpContext.Current.Session.Add("UserId", x); //SendMailtoUser(x); Response.Redirect("MyProfile.aspx"); } } catch (System.Threading.ThreadAbortException th) { } catch (Exception ex) { } } }