private void register_Click(object sender, EventArgs e) { if (textBox2.Text != "" && textBox3.Text != "" && comboBox1.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "" && textBox7.Text != "" && male.Checked == true || female.Checked == true) { if (s.hosp.available(textBox3.Text)) { if (comboBox1.Text == "doctor") { doctor d = new doctor(textBox2.Text, textBox6.Text, textBox7.Text, Int32.Parse(textBox5.Text), textBox1.Text); s.hosp.add_doctor(d); //s.hosp.save(); s.hosp.save_doctor(); s.hosp.save_pharmacy(); account a = new account(textBox3.Text, textBox4.Text, textBox2.Text, comboBox1.Text); s.hosp.add_account(a); // s.hosp.save(); s.hosp.save_accounts(); MessageBox.Show("successfully Registered"); signin x = new signin(); this.Hide(); x.Show(); } else if (comboBox1.Text == "pharmacist") { doctor d = new doctor(textBox2.Text, textBox6.Text, textBox7.Text, Int32.Parse(textBox5.Text), "pharmacist"); s.hosp.add_doctor(d); //s.hosp.save(); s.hosp.save_doctor(); s.hosp.save_pharmacy(); account a = new account(textBox3.Text, textBox4.Text, textBox2.Text, comboBox1.Text); s.hosp.add_account(a); // s.hosp.save(); s.hosp.save_accounts(); MessageBox.Show("successfully Registered"); signin x = new signin(); this.Hide(); x.Show(); } else if (comboBox1.Text == "receptionist") { account a = new account(textBox3.Text, textBox4.Text, textBox2.Text, comboBox1.Text); s.hosp.add_account(a); //s.hosp.save(); s.hosp.save_accounts(); MessageBox.Show("successfully Registered"); signin x = new signin(); this.Hide(); x.Show(); } } else { MessageBox.Show("This E-mail Is Already Exist"); } } else { MessageBox.Show("Please enter all your information"); } }
public void add_account(account a) { accounts.Add(a); }