예제 #1
0
 public ReservationsNurseController(ReservationsNurse view)
 {
     this.view             = view;
     this.reservationModel = new Models.Reservation();
     this.employeeModel    = new Models.Employee();
     this.nurseModel       = new Models.Nurse();
 }
예제 #2
0
 public NurseScheduleController(Schedule view)
 {
     this.view              = view;
     this.employeeModel     = new Models.Employee();
     this.nurseModel        = new Models.Nurse();
     this.workingHoursModel = new Models.WorkingHours();
 }
 public ReservationsController(Reservations view)
 {
     this.view             = view;
     this.reservationModel = new Models.Reservation();
     this.serviceModel     = new Models.Service();
     this.patientModel     = new Models.Patient();
     this.doctorModel      = new Models.Doctor();
     this.nurseModel       = new Models.Nurse();
 }
예제 #4
0
 public AnalyticsController(ManagerAnalytics view)
 {
     this.view                 = view;
     this.serviceModel         = new Models.Service();
     this.patientModel         = new Models.Patient();
     this.doctorModel          = new Models.Doctor();
     this.nurseModel           = new Models.Nurse();
     this.reservationAnalytics = new Models.ReservationAnalytics();
 }
예제 #5
0
 public UsersController(Users view)
 {
     this.view          = view;
     this.userModel     = new Models.User();
     this.roleModel     = new Models.Role();
     this.sectorModel   = new Models.Sector();
     this.operatorModel = new Models.Operator();
     this.doctorModel   = new Models.Doctor();
     this.nurseModel    = new Models.Nurse();
 }
예제 #6
0
        /**
         * Controller to submit user information
         */

        public async void handleSubmit()
        {
            try {
                Cursor.Current = Cursors.WaitCursor;

                int    role           = (int)this.view.CBox.comboBox.SelectedValue;
                string email          = this.view.FormEmailTxtBox.Text;
                string password       = this.view.FormPasswordTxtBox.Text;
                string firstName      = this.view.FormFirstNameTxtBox.Text;
                string lastName       = this.view.FormLastNameTxtBox.Text;
                string dob            = this.view.FormDOBPicker.Value.ToString(DateTimeFormats.MYSQL_DATE);
                string phoneNumber    = this.view.FormPhoneNumberTxtBox.Text;
                string address        = this.view.FormAddressTxtBox.Text;
                int    specialization = (int)this.view.SpecializationCBox.comboBox.SelectedValue;

                // Check if one role is selected
                if (role < 1)
                {
                    MessageBox.Show("Nuk është zgjedhur roli!", "Problem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    return;
                }

                // Create user
                userModel = new Models.User();
                long createdUserId = await userModel.createUser(email, password, role);

                // Create objects based on selected role
                if (this.view.SelectedRole == Roles.OPERATOR)
                {
                    operatorModel = new Models.Operator();
                    long createdOperatorId = await operatorModel.createOperator(
                        firstName,
                        lastName,
                        dob,
                        createdUserId
                        );
                }
                else if (this.view.SelectedRole == Roles.DOCTOR)
                {
                    employeeModel = new Models.Employee();
                    long createdEmployeeId = await employeeModel.createEmployee(
                        firstName,
                        lastName,
                        phoneNumber,
                        address,
                        dob,
                        createdUserId
                        );

                    doctorModel = new Models.Doctor();
                    await doctorModel.createDoctor(specialization, createdEmployeeId);
                }
                else if (this.view.SelectedRole == Roles.NURSE)
                {
                    employeeModel = new Models.Employee();
                    long createdEmployeeId = await employeeModel.createEmployee(
                        firstName,
                        lastName,
                        phoneNumber,
                        address,
                        dob,
                        createdUserId
                        );

                    nurseModel = new Models.Nurse();
                    await nurseModel.createNurse(createdEmployeeId);
                }

                this.handleRoleSelection();
                Cursor.Current = Cursors.Arrow;
                MessageBox.Show("Përdoruesi u shtua me sukses!", "Sukses", MessageBoxButtons.OK, MessageBoxIcon.Information);
            } catch (Exception e) {
                string caption = "Problem në shkrim";
                MessageBox.Show(e.Message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }