protected void btnRegOtp_Click(object sender, EventArgs e) { try { MailUtility objm = new MailUtility(); DashBoardDataBL obje = null; obje = new DashBoardDataBL(); string OTP = GetUniqueKey(); int success = obje.UserEmailVerificationBL(txt_NEmail.Text, lblloginId.Text, OTP); if (success > 0) { objm.SendAccountVerificationEmail(txt_NEmail.Text, OTP); Alert.show("One Time Password (OTP) has been Sent to Email Address"); } } catch (Exception ex) { LogError(ex); } }
protected void txt_NEmail_TextChanged(object sender, EventArgs e) { try { if (ValidateEmail()) { DashBoardDataBL obje = null; obje = new DashBoardDataBL(); string OneTimePassword = GetUniqueKey(); MailUtility objm = new MailUtility(); String[] parts = txt_NEmail.Text.Split(new[] { '@' }); txtloginId.Text = parts[0]; SqlConnection con = DataAccess.GetConnction(); DataSet ds = new DataSet(); SqlCommand cmd = new SqlCommand("Usp_CheckEmailAndloginIdUser", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter { ParameterName = "@UserEmail", DbType = DbType.String, Value = txt_NEmail.Text }); cmd.Parameters.Add(new SqlParameter { ParameterName = "@LoginId", DbType = DbType.String, Value = txtloginId.Text }); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } if (ds.Tables[0].Rows.Count > 0) { txt_NEmail.Text = ""; txt_NEmail.Focus(); txtloginId.Text = ""; Alert.show("Email Id is Already Exist"); } else if (ds.Tables[1].Rows.Count > 0) { String[] LoginID = txt_NEmail.Text.Split(new[] { '@' }); txtloginId.Text = LoginID[0] + LoginID[1].Substring(0, 1); objm.SendAccountVerificationEmail(txt_NEmail.Text, OneTimePassword); int success = obje.UserEmailVerificationBL(txt_NEmail.Text, txtloginId.Text, OneTimePassword); lblVerificationMsg.Text = "One Time Password (OTP) has been Sent to Email Address."; lblVerificationMsg.ForeColor = System.Drawing.Color.Green; txt_NEmail.Enabled = false; OtpDetail.Visible = true; lblRegOtpMsg.Visible = true; btnRegisteration.Enabled = true; } else { objm.SendAccountVerificationEmail(txt_NEmail.Text, OneTimePassword); int success = obje.UserEmailVerificationBL(txt_NEmail.Text, txtloginId.Text, OneTimePassword); lblVerificationMsg.Text = "One Time Password (OTP) has been Sent to Email Address."; lblVerificationMsg.ForeColor = System.Drawing.Color.Green; txt_NEmail.Enabled = false; OtpDetail.Visible = true; lblRegOtpMsg.Visible = true; btnRegisteration.Enabled = true; } } } catch (Exception ex) { LogError(ex); } }