Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Doctor doctor = new Doctor(
                addUserDoctor.Username, addUserDoctor.Password,
                addUserDoctor.Firstname, addUserDoctor.Middlename,
                addUserDoctor.Lastname, addUserDoctor.Gender,
                addUserDoctor.PhoneNumber, addUserDoctor.Permission,
                addUserDoctor.UType, txtSpecialisation.Text
                );
            Admin admin  = new Admin();
            int   result = admin.addDoctorAccount(doctor);

            if (result > 0)
            {
                MessageBox.Show("Doctor successfully added");
            }
            else if (result == -1)
            {
                MessageBox.Show(string.Format(
                                    "Username {0} already exist", addUserDoctor.Username));
            }
            else
            {
                MessageBox.Show("Error in adding doctor");
            }
            if (result != -1)
            {
                adminHome.resetAdminHome();
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Admin admin = new Admin(
                addUserAdmin.Username, addUserAdmin.Password,
                addUserAdmin.Firstname, addUserAdmin.Middlename,
                addUserAdmin.Lastname, addUserAdmin.Gender,
                addUserAdmin.PhoneNumber, addUserAdmin.Permission,
                addUserAdmin.UType
                );

            int result = superAdmin.addAdmin(admin);

            if (result > 0)
            {
                MessageBox.Show("Admin successfully added");
            }
            else if (result == -2)
            {
                MessageBox.Show("Access not granted. Contact Administration for help. ");
            }
            else if (result == -1)
            {
                MessageBox.Show(string.Format(
                                    "Username {0} already exist", addUserAdmin.Username));
            }
            else
            {
                MessageBox.Show("Error in adding admin");
            }

            if (result != -1)
            {
                adminHome.resetAdminHome();
            }
        }