private void SignIntxt_Click(object sender, EventArgs e) { textBox2.Visible = false; label8.Visible = false; if (radioButton2.Checked) { try { Reader R = new Reader(); if (R.Sign_in(UserNametxt.Text, Passwordtxt.Text) == 1) { this.Hide(); Form3 F = new Form3(); F.Show(); } else if (R.Sign_in(UserNametxt.Text, Passwordtxt.Text) > 1) { MessageBox.Show("Dupliacate Data"); } else { MessageBox.Show("Data is incorrect"); } } catch (Exception) { MessageBox.Show("Some field is empty"); } } else if (radioButton1.Checked) { try { Librarian l = new Librarian(); if (textBox2.Text == l.serial_no().ToString()) { if (l.Sign_in(UserNametxt.Text, Passwordtxt.Text) == 1) { textBox2.Clear(); this.Hide(); Form4 F = new Form4(); F.Show(); } else if (l.Sign_in(UserNametxt.Text, Passwordtxt.Text) > 1) { MessageBox.Show("Dupliacate Data"); } else { MessageBox.Show("Data is incorrect"); } } else { MessageBox.Show("Incorrect serial number"); } } catch (Exception) { MessageBox.Show("Some field is empty"); } } else { MessageBox.Show("You should choose the type"); } }
private void CreateAccount_Click(object sender, EventArgs e) { textBox2.Visible = false; label8.Visible = false; if (radioButton1.Checked) { try { Librarian Lb = new Librarian(); if (textBox2.Text == Lb.serial_no().ToString()) { if (Lb.Sign_in(First_Name.Text + " " + Last_Name.Text, Password.Text) == 0) { Lb.Sign_Up(First_Name.Text, Last_Name.Text, Convert.ToInt32(Cell_Phone.Text), Address.Text, Email.Text, Password.Text); MessageBox.Show("Done"); textBox2.Clear(); Form1 f = new Form1(); f.Show(); this.Hide(); } else { MessageBox.Show("There a person has the the same User name or password change one of them"); } } else { MessageBox.Show("Incorrect"); } } catch (Exception) { MessageBox.Show("There is empty field"); } } else if (radioButton2.Checked) { try { Reader Rd = new Reader(); if (Rd.Sign_in(First_Name.Text + " " + Last_Name.Text, Password.Text) == 0) { Rd.Sign_Up(First_Name.Text, Last_Name.Text, Convert.ToInt32(Cell_Phone.Text), Address.Text, Email.Text, Password.Text); MessageBox.Show("Done"); Form1 f = new Form1(); f.Show(); this.Hide(); } else { MessageBox.Show("There a person has the the same User name or password change one of them"); } } catch (Exception) { MessageBox.Show("There is empty field"); } } else { MessageBox.Show("You should select the type of person"); } }