private void backButton_Click(object sender, EventArgs e) { Passenger_Login pl = new Passenger_Login(); pl.Show(); this.Hide(); }
private void passengerButton_Click(object sender, EventArgs e) { Passenger_Login pl = new Passenger_Login(); // open the new passenger login form pl.Show(); this.Hide(); }
private void backButton_Click(object sender, EventArgs e) { // Open the new passenger login form Passenger_Login pl = new Passenger_Login(); pl.Show(); this.Hide(); }
private void update() { string email = emailBox.Text; string password = passwordBox.Text; string confirmPassword = confirmPasswordBox.Text; sql.Open(); SqlDataAdapter sda = new SqlDataAdapter("SELECT COUNT(*) from passenger_signup where pEmail='" + emailBox.Text + "'", sql); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { if (password == confirmPassword) { try { SqlCommand cmd = new SqlCommand("update passenger_signup set pPassword=@password", sql); cmd.Parameters.AddWithValue("@password", password); cmd.ExecuteNonQuery(); MessageBox.Show("Password Updated Successfully :)"); Passenger_Login pl = new Passenger_Login(); pl.Show(); this.Hide(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Password Does Not Match !!!...."); } } else { MessageBox.Show("Your Email is incorrect !.."); } sql.Close(); }
private void SignUpButton_Click(object sender, EventArgs e) { string firstName = firstNameBox.Text; string lastName = lastNameBox.Text; string cnic = cnicBox.Text; string email = emailBox.Text; string contact = contactBox.Text; string age = ageBox.Text; string gender; if (maleRadioBttn.Checked == true) { gender = "Male"; } else if (femaleRadioBttn.Checked == true) { gender = "Female"; } else { gender = "Other"; } string city = cityBox.Text; string password = passwordBox.Text; try { sql.Open(); int userID = RandomNumber(1, 1000); SqlCommand sc = new SqlCommand("select pId from passenger_signup where pId=@a", sql); sc.Parameters.AddWithValue("@a", userID); SqlCommand cmd = new SqlCommand("insert into passenger_signup(pId,pFirstName,pLastName,pCnic,pEmail,pContact,age,pGender,pCity,pPassword) values(@userID,@firstName,@lastName,@cnic,@email,@contact,@age,@gender,@city,@password)", sql); cmd.Parameters.AddWithValue("@userID", userID); cmd.Parameters.AddWithValue("@firstName", firstName); cmd.Parameters.AddWithValue("@lastName", lastName); cmd.Parameters.AddWithValue("@cnic", cnic); cmd.Parameters.AddWithValue("@email", email); cmd.Parameters.AddWithValue("@contact", contact); cmd.Parameters.AddWithValue("@age", age); cmd.Parameters.AddWithValue("@gender", gender); cmd.Parameters.AddWithValue("@city", city); cmd.Parameters.AddWithValue("@password", password); cmd.ExecuteNonQuery(); sql.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (passwordBox.Text == confirmPasswordBox.Text) { MessageBox.Show("User Registered Successfully :)"); firstNameBox.Text = ""; lastNameBox.Text = ""; cnicBox.Text = ""; emailBox.Text = ""; ageBox.Text = ""; contactBox.Text = ""; cityBox.Text = ""; passwordBox.Text = ""; confirmPasswordBox.Text = ""; firstNameBox.Focus(); Passenger_Login pl = new Passenger_Login(); pl.Show(); this.Hide(); } else { MessageBox.Show("Password does not Match "); } }