Ejemplo n.º 1
0
        /** Method initiates process of saving a booking */
        private void saveBookingButton_Click(object sender, EventArgs e)
        {
            BookingController controller = new BookingController();
            string            startTime  = timeOfBooking.Text.Substring(0, 5);
            string            endTime    = timeOfBooking.Text.Substring(7);
            int userId = ApplicationState.userId;

            if (ApplicationState.userType == "admin")
            {
                if ((int)patientListBox.SelectedValue == 0)
                {
                    FeedbackWindow message = new FeedbackWindow();
                    message.setCustomizedMessage("You are required to choose a patient");
                    message.Show();
                    return;
                }
                else
                {
                    userId = (int)patientListBox.SelectedValue;
                }
            }
            bool result = false;

            result = controller.bookAppointment(commentTextField.Text, startTime, endTime, userId, staffScheduleId);
            this.reloadScheduleOrShowFeedbackWindowBasedOnResult(result);
            if (result && (printCheckBox.Checked || emailCheckBox.Checked))
            {
                PrintingPrompt printingPrompt = new PrintingPrompt(this.date, startTime, endTime, this.doctorsName, staffScheduleId);
                printingPrompt.Show();
            }
        }
Ejemplo n.º 2
0
        /** Method initiaties the process of updating the attendance process */
        private void saveButton_Click(object sender, System.EventArgs e)
        {
            FeedbackWindow message = new FeedbackWindow();

            if (attendanceOptions.SelectedIndex != 0)
            {
                BookingController        controller     = new BookingController();
                string                   selectedOption = (attendanceOptions.SelectedItem as ListItem).text;
                Dictionary <string, int> options        = controller.getAttendanceOptions()[selectedOption];
                booking.setAttendance(options["attendance"]);
                booking.setConfirmation(options["confirmation"]);
                booking.setLackOfCancellation(options["lackOfCancellation"]);
                if (controller.updateAttendanceStatus(booking))
                {
                    message.setMessageForSuccessfullOperation();
                }
                else
                {
                    message.setMessageForSavingError();
                }
                parent.getAppointmentBoxes();
                this.Hide();
            }
            else
            {
                message.setCustomizedMessage(ATTENDANCE_OPTION_NOT_SELECTED);
            }
            message.Show();
        }
 /** Method prevents selecting end time earlier than start time */
 private void workEndTime_ValueChanged(object sender, EventArgs e)
 {
     if (workEndTime.Value.Date < workStartTime.Value.Date)
     {
         feedback.setCustomizedMessage(END_DATE_EARLIER_THAN_START_DATE);
         feedback.Show();
     }
 }
Ejemplo n.º 4
0
        /** Method is responsible for starting process of logging the user in or showing feedback message */
        private void logInButton_Click(object sender, EventArgs e)
        {
            Logger         logger  = new Logger();
            FeedbackWindow message = new FeedbackWindow();

            try {
                if (Validator.validateLogger(loginField.Text, passwordField.Text))
                {
                    try {
                        if (logger.logUserIn(loginField.Text, passwordField.Text) == true)
                        {
                            LogInPanel.Visible = false;
                            HomePanel.Visible  = true;
                            this.CenterToScreen();
                            loadLeftPanel();
                            loadInitialInformationPanel();
                            if (ApplicationState.userType != "admin")
                            {
                                loadHomePanel();
                            }
                            else
                            {
                                loadSurgeryManagementPanel();
                            }
                        }
                    }
                    catch (LoggerException ex) {
                        message.setCustomizedMessage(ex.Message);
                        message.Show();
                    }
                }
                else
                {
                    message.setCustomizedMessage(Validator.getEmptyLoginMessage());
                    message.Show();
                }
            }
            catch (Exception) {
                message.setMessageForExceptionReporting();
                message.Show();
            }
        }
        /** Method initializes a process of saving and absance model to the database */
        private void saveButton_Click(object sender, EventArgs e)
        {
            if (!this.isDateTimeValid())
            {
                feedbackWindow.setCustomizedMessage(validationMessage);
                feedbackWindow.ShowDialog();
                validationMessage = "";
                return;
            }
            AbsenceModel absence = this.getAbsenceModelFromPresenterForm();

            List <string>     invalidFields = new List <string>();
            AbsenceController controller    = new AbsenceController();

            if (allTheDoctors.Enabled)
            {
                invalidFields = controller.isDataValid(startDatePicker, endDatePicker, startTimePicker, endTimePicker, invalidFields, allTheDoctors);
            }
            else
            {
                invalidFields = controller.isDataValid(startDatePicker, endDatePicker, startTimePicker, endTimePicker, invalidFields);
            }
            if (invalidFields == null || invalidFields.Count == 0)
            {
                if (!controller.save(absence))
                {
                    this.feedbackWindow.setMessageForAbsencesProblems();
                }
                else
                {
                    this.feedbackWindow.setMessageForSuccessfullOperation();
                }
            }
            else
            {
                feedbackWindow.setMessageForInvalidFieldsValues(invalidFields);
            }
            feedbackWindow.ShowDialog();
        }