예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool check = ValidateForm();

            if (check == true)
            {
                string  role        = StatusList.GetItemText(StatusList.SelectedItem);
                string  name        = NameTbx.Text;
                string  email       = EmailTb.Text;
                string  password    = PasswordTbx.Text;
                string  phoneNumber = PhoneTbx.Text;
                string  address     = AddressTbx.Text;
                string  text        = "";
                Contact contact     = new Contact();

                if (role.Equals("CLIENT"))
                {
                    CustomerAccount client = new CustomerAccount();
                    int             group  = Int32.Parse(textBox1.Text);

                    text = client.addNewClient(name, password, group, email, phoneNumber, address);
                }
                else
                {
                    TeacherAccount staff = new TeacherAccount();
                    text = staff.addNewStaff(name, password, role, email, address, phoneNumber);
                }

                MessageBox.Show(text);
            }
        }