protected void btnForget_Click(object sender, EventArgs e)
        {
            if (txtEmail.Text.Trim() == "")
            {
                lblRegisMsg.Text = "Email ID can not be empty";
            }
            else
            {
                DataTable st = new DataTable();
                st = _bl.GetEmail(txtEmail.Text.Trim());


                if (st.Rows.Count > 0)
                {
                    string     decrptpass = Decryptdata(st.Rows[0]["pass"].ToString());
                    Send_mails sms        = new Send_mails();
                    if (sms.SendMailForgetPassword(txtEmail.Text, st.Rows[0]["Name"].ToString(), decrptpass, Server.MapPath("~/Mail/forget-password.htm")))
                    {
                        lblRegisMsg.Text      = "your password sucessfully send at " + txtEmail.Text;
                        lblRegisMsg.ForeColor = System.Drawing.Color.Green;
                        txtEmail.Text         = "";
                    }
                }
                else
                {
                    lblRegisMsg.Text = "Invaild EmailID";
                    return;
                }
            }
        }
Пример #2
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            Send_mails sm = new Send_mails();

            if (sm.SendMailEmail(txtName.Value, txtEmail.Value, txtMessage.Value, txtMobile.Value, "Enquiry from Site", Server.MapPath("~/Mail/mail.htm")))
            {
                lblMsg.Text      = "Your Enquiry Sucessfully Submitted";
                lblMsg.ForeColor = System.Drawing.Color.Green;
                txtEmail.Value   = "";
                txtMessage.Value = "";
                txtMobile.Value  = "";
                txtName.Value    = "";
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string        constr = ConfigurationManager.ConnectionStrings["cn"].ConnectionString;
            SqlConnection con    = new SqlConnection(constr);
            SqlCommand    cmd    = new SqlCommand();

            cmd.Connection = con;

            SqlDataAdapter da = new SqlDataAdapter("select * from Student where Email = '" + txtEmail.Value.Trim() + "'", con);
            DataSet        ds = new DataSet();

            da.Fill(ds);
            int i = ds.Tables[0].Rows.Count;

            if (txtEmail.Value.Trim() == "" || txtRegisPassword.Value.Trim() == "")
            {
                lblRegisMsg.Text = "Can not be empty!";
            }
            else
            {
                if (i <= 0)
                {
                    hybr["AutoID"]       = 0;
                    hybr["Name"]         = txtName.Value;
                    hybr["Address"]      = "";
                    hybr["Email"]        = txtEmail.Value.Trim();
                    hybr["pass"]         = encryptpass(txtRegisPassword.Value.Trim());
                    hybr["Subscribe"]    = "True";
                    hybr["City"]         = 0;
                    hybr["CountryID"]    = 1;
                    hybr["State"]        = 0;
                    hybr["profilephoto"] = "";
                    hybr["LandMark"]     = "";
                    hybr["Pin"]          = "";
                    hybr["Mobile"]       = txtmobile.Value;
                    long _mUserId = _bl.SaveRegister(hybr);
                    if (_mUserId != -2)
                    {
                        Session["UserID"]     = null;
                        lblRegisMsg.Text      = "Registration Successfully...";
                        lblRegisMsg.ForeColor = Color.Green;


                        Send_mails sms = new Send_mails();
                        if (sms.SendMailRegister(txtName.Value, txtEmail.Value.Trim(), Server.MapPath("~/Mail/RegistrationMail.htm")))
                        {
                            lblRegisMsg.Text      = "Your Activation link has been  send at " + txtEmail.Value;
                            lblRegisMsg.ForeColor = System.Drawing.Color.Green;
                            txtEmail.Value        = "";
                        }
                        txtEmail.Value         = "";
                        txtName.Value          = "";
                        txtRegisPassword.Value = "";
                        txtmobile.Value        = "";
                        txtName.Focus();
                        return;

                        // Session["UserName"] = txtUserName.Text;
                        //Session["UserID"] = _mUserId;
                        // Response.Redirect("~/User/profile.aspx");
                    }
                    else
                    {
                        Session["UserID"] = null;
                        lblRegisMsg.Text  = "EmailID already Exist";

                        return;
                    }
                }
                else
                {
                    lblRegisMsg.Text      = "EmailID already Exist";
                    lblRegisMsg.ForeColor = Color.Red;
                }
            }
        }