protected void email_ServerClick(object sender, EventArgs e)
    {
        SqlCommand cmd = con.CreateCommand();

        cmd.CommandText = "Select Count(*) From Login Where UserId=@u And Email=@p";
        cmd.Parameters.AddWithValue("@u", Userid.Value.TrimEnd());
        cmd.Parameters.AddWithValue("@p", mail.Value.TrimEnd());
        con.Open();
        int num = Convert.ToInt32(cmd.ExecuteScalar().ToString());

        con.Close();
        if (num == 1)
        {
            cmd.CommandText = "Select Password From Login Where UserId=@u";
            con.Open();
            string pass = (string)(cmd.ExecuteScalar().ToString());
            con.Close();
            if (pass != (DBNull.Value.ToString()))
            {
                string var = "User Id Already Exists";
                Response.Write("<script language=javascript>alert('" + var + "');</script>");
            }
            else
            {
                SendEmail123 a       = new SendEmail123();
                string       message = "Hello Respected User,<br/><br/> Please Follow Go To This Link To Register: <a href='http://localhost:1249/Mailreg.aspx?Id=" + Userid.Value + "&Email=" + mail.Value + "'>Register</a>";
                a.sendEMail(((mail.Value).Trim()), message, "Register Yourself");
                string var = "Email Has Been Sent";
                Response.Write("<script language=javascript>alert('" + var + "');</script>");
                mail.Value   = "";
                Userid.Value = "";
            }
        }
        else
        {
            string var = "User Id Doesent Exist Or Wrong Email";
            Response.Write("<script language=javascript>alert('" + var + "');</script>");
        }
    }
Exemple #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //if (txtfname.Text != null && txtmname.Text != null && txtlname.Text != null)
        //{
        //    if (txtadd1.Text != null && txtadd2.Text != null)
        //    {
        //        if (txtpswd!=null)
        //        {
        if (txtpswd.Text == txtrpswd.Text)
        {
            if (CheckBox1.Checked == true)
            {
                try
                {
                    SqlCommand cmd = conn.CreateCommand();
                    cmd.CommandText = "Insert into Customer(Email,Customer_Name,Address,Password,Mobile_No,Active) values(@Email,@Name,@Address,@Password,@Mobile,@Active)";
                    cmd.Parameters.AddWithValue("@Email", txtemail.Text);
                    cmd.Parameters.AddWithValue("@Name", txtfname.Text + " " + txtmname.Text + " " + txtlname.Text);
                    cmd.Parameters.AddWithValue("@Address", txtadd1.Text + ddltown.SelectedItem.Text + " - " + txtpin.Text + "," + txtstate.Text + "," + txtcountry.Text);
                    cmd.Parameters.AddWithValue("@Password", txtpswd.Text);
                    cmd.Parameters.AddWithValue("@Mobile", txtcontact.Text);
                    cmd.Parameters.AddWithValue("@Active", "yes");
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    conn.Close();
                    SendEmail123 s = new SendEmail123();
                    s.sendEMail(txtemail.Text, "You Have Been Successfully Registered With Digitronicarts");
                    Response.Redirect("Login.aspx");
                }
                catch (SqlException se)
                {
                    string var = "Email Already Exists";
                    Response.Write("<script language=javascript>alert('" + var + "');</script>");
                }
            }
            else
            {
                string var = "Please Accept Terms And Conditions";
                Response.Write("<script language=javascript>alert('" + var + "');</script>");
            }
        }
        else
        {
            string var = "Passwords Do Not Match";
            Response.Write("<script language=javascript>alert('" + var + "');</script>");
        }
        //        }
        //        else
        //        {

        //        }
        //    }
        //    else
        //    {

        //    }
        //}
        //else
        //{

        //}
    }