Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            signin myform = new signin();

            this.Hide();
            myform.ShowDialog();
        }
Ejemplo n.º 2
0
 private void button3_Click_1(object sender, EventArgs e)
 {
     if (randomCode == (ResetPass.Text).ToString())
     {
         SqlConnection con = new SqlConnection(@"Data Source=MATAN-PC;Initial Catalog=master;Integrated Security=True");
         SqlCommand    cmd = new SqlCommand("UPDATE [dbo].[UsersInfoDataBase] SET [Password] = '" + ResetPass.Text + " WHERE Username='******'", con);
         con.Open();
         cmd.ExecuteNonQuery();
         con.Close();
         MessageBox.Show("Reset Successfully");
         signin myForm = new signin();
         this.Hide();
         myForm.ShowDialog();
         this.Close();
     }
     else
     {
         MessageBox.Show("Wrong Code!");
     }
 }
Ejemplo n.º 3
0
 //SIGNUP
 private void button4_Click(object sender, EventArgs e)
 {
     {
         bool ErrorFlag = false;
         if (Username.Text == "")
         {
             ErrorFlag = true;
         }
         if (FirstName.Text == "")
         {
             ErrorFlag = true;
         }
         if (LastName.Text == "")
         {
             ErrorFlag = true;
         }
         if (Email.Text == "")
         {
             ErrorFlag = true;
         }
         if (Password.Text == "")
         {
             ErrorFlag = true;
         }
         if (ErrorFlag == true)
         {
             MessageBox.Show("One or more empty lines!", "ok", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             ///// בדיקת השם משתמש ואימייל במאגר הנתונים
             bool           EmailExists    = false;
             bool           UsernameExists = false;
             SqlDataAdapter da             = new SqlDataAdapter("Select Username From UsersInfoDataBase where Username='******'", con);
             DataTable      dt             = new DataTable();
             da.Fill(dt);
             SqlDataAdapter da1 = new SqlDataAdapter("Select Email from UsersInfoDataBase where Email ='" + Email.Text + "'", con);
             DataTable      dt1 = new DataTable();
             da1.Fill(dt1);
             if (dt.Rows.Count >= 1)
             {
                 UsernameExists = true;
             }
             if (dt1.Rows.Count >= 1)
             {
                 EmailExists = true;
             }
             if (EmailExists)
             {
                 MessageBox.Show("Error! \nEmail is already Registered!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             if (UsernameExists)
             {
                 MessageBox.Show("Error! \nUsername is Taken!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             if (!UsernameExists && !EmailExists)
             {
                 con.Open();
                 string         Query = "insert into UsersInfoDataBase (email,firstname,lastname, username,password,role,HighScore,GamesPlayed) values('" + this.Email.Text + "','" + this.FirstName.Text + "','" + this.LastName.Text + "','" + this.Username.Text + "','" + this.Password.Text + "','User','0','0');";
                 SqlDataAdapter SDA   = new SqlDataAdapter(Query, con);
                 SDA.SelectCommand.ExecuteNonQuery();
                 con.Close();
                 MessageBox.Show("Welcome! \nPlease try to login into ur account now.", "Register Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 signin myform = new signin();
                 myform.ShowDialog();
                 this.Close();
             }
         }
     }
 }