protected void btnBookNow_Click(object sender, EventArgs e) { try { btnBookNow.Enabled = false; if (chkPreUser.Checked != true)//New Lead with silent User Registration. check in again { if (ValidateUserName()) { SetProperties_UserRegistration(); int userId = csuserRegistration.ExecuteProcedure("INSERT");//this will excute the proc "usp_UserRegProc" with insert mode and userid will be the output after registration process. try { SetProperties_NewLead(userId); objLeads.SaveData("INSERT");//this will excute the proc "usp_Leads" with insert mode fnSendEmail(txtEmail.Text.Trim()); lblMessage.Text = "Your Request have been submitted successfully. Our Executive will contact you shortly. Thank you "; LoginNewUser(); } catch { //Roll Back Registration process } } } else { if (Validation_Returning_User()) { SetProperties_NewLead(Convert.ToInt32(Session["userID"])); objLeads.SaveData("INSERT"); string strMessage = "Dear Customer,<br> Thank You for your association with us. We are in receipt of your concern with Easy-Labour." + "<br>Our team tried to get in touch with as per Service Request no.–" + objLeads.Ticket + ". " + "<br>We will be happy to help you to resolve your issue at a time of your convenience. " + "<br>In case of any further clarification, feel free to call or write to us at the contacts given in this email."; LMT.Customer.AddNewCase.EmailSendDelegate emailSendDelegate = new LMT.Customer.AddNewCase.EmailSendDelegate(csGlobalFunction.SendEmail); emailSendDelegate.BeginInvoke(Session["userEmail"].ToString(), "Lead Confirmation mail", strMessage, null, null); //lblMessage.Text = "Your Request have been submitted successfully. Our Executive will contact you shortly. Thank you "; //ScriptManager.RegisterStartupScript(this, this.GetType(), "LaunchServerSide", "$(function() { SaveSuccess(); });", true); if (Session["UserType"].ToString() == "Admin") { Response.Redirect("~/MasterPages/AdminMenuboard.aspx", false); } else if (Session["UserType"].ToString() == "Supplier") { Response.Redirect("~/MasterPages/SupplierMenuboard.aspx", false); } else if (Session["UserType"].ToString() == "Customer") { Response.Redirect("~/Customer/AddNewCase.aspx", false); } else { Response.Redirect("~/login.aspx", false); } } } } catch (Exception ex) { string strFnc = ""; strFnc = ex.Message; ScriptManager.RegisterStartupScript(this, this.GetType(), "CatchMsg", "alert('" + strFnc + "');", true); } finally { btnBookNow.Enabled = true; } }
public void fnSendEmail(string Email = "") { //For User string strMessage = "Dear Subscriber,<br> Your registration is comfirmed.<br> Your Login ID :" + txtUserName.Text.Trim() + ". <br> Password :"******""; string strSubject = "Registration Confirmation mail"; LMT.User.UserRegistration.MailDelegate mailDelegate = new LMT.User.UserRegistration.MailDelegate(csGlobalFunction.SendHTMLEmail); mailDelegate.BeginInvoke(Email == "" ? Session["userEmail"].ToString() : Email, strSubject, txtUserName.Text.Trim(), csLogin.DecodeFrom64(csuserRegistration.PWD), null, null); //For Lead string strLeadMessage = "Dear Customer,<br> Thank You for your association with us. We are in receipt of your concern with Easy-Labour." + "<br>Our team tried to get in touch with as per Service Request no.–" + objLeads.Ticket + ". " + "<br>We will be happy to help you to resolve your issue at a time of your convenience. " + "<br>In case of any further clarification, feel free to call or write to us at the contacts given in this email."; LMT.Customer.AddNewCase.EmailSendDelegate emailSendDelegate = new LMT.Customer.AddNewCase.EmailSendDelegate(csGlobalFunction.SendEmail); emailSendDelegate.BeginInvoke(Email == "" ? Session["userEmail"].ToString() : Email, "Lead Confirmation mail", strLeadMessage, null, null); }