//once login is pressed begins logincheck and determines what kind of account //is being logged into private void loginBut_Click(object sender, EventArgs e) { //checks if it logged in if (loginCheck()) { //wether its a business or customer if (type == 'B') { if (business.Type == "Restraunt") { RestuarantForm r = new RestuarantForm(business); r.Show(); } else { DoctorOfficeForm d = new DoctorOfficeForm(business); d.Show(); } this.Close(); } else { Search search = new Search(customer); search.Show(); this.Close(); } } else { MessageBox.Show("Username/Password may be wrong please try again."); } }
//once clicked collects all info from textboxes and creates a new business class //then creates a new BusHome form with this business private void Registerbutton_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(UserIDtextBox.Text) || string.IsNullOrEmpty(PasswordtextBox.Text) || string.IsNullOrEmpty(EmailtextBox.Text) || string.IsNullOrEmpty(typeComboBox.Text) || string.IsNullOrEmpty(OpentextBox.Text) || string.IsNullOrEmpty(ClosetextBox.Text) || string.IsNullOrEmpty(NametextBox.Text)) { MessageBox.Show("Please fill all boxes before registering."); } else { string username = UserIDtextBox.Text; string pass = PasswordtextBox.Text; string email = EmailtextBox.Text; string open = OpentextBox.Text; string close = ClosetextBox.Text; string type = typeComboBox.Text; string name = NametextBox.Text; string emailPass = emailPassBox.Text; try { Business create = new Business(username, pass, email, open, close, type, name, emailPass); MessageBox.Show("Your account has been created!"); if (create.Type == "Restraunt") { RestuarantForm r = new RestuarantForm(create); r.Show(); } else { DoctorOfficeForm d = new DoctorOfficeForm(create); d.Show(); } this.Close(); } catch (System.InvalidOperationException) { MessageBox.Show("this account already exists"); } } }