/** 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 reloads schedule or shows feedback windown based on result passed as parameter * * @param result of saving the appointment */ private void reloadScheduleOrShowFeedbackWindowBasedOnResult(bool result) { if (result) { parent.reloadSchedule(); this.Close(); } else { FeedbackWindow window = new FeedbackWindow(); window.setMessageForBookingProblem(); window.Show(); } }
/** Method changes date to previous month */ private void previousMonthButton_Click(object sender, EventArgs e) { if (this.date.AddMonths(-1).Month >= DateTime.Today.Month) { this.date = this.date.AddMonths(-1); reloadDayBoxes(); } else { FeedbackWindow message = new FeedbackWindow(); message.setMessageForBookingNotAvailableForDateDueToDateInThePast(); message.Show(); } }
private void dayOfaWeekBox_Click(object sender, EventArgs e) { if (this.morningAppointments + this.afternoonAppointments == 0) { FeedbackWindow message = new FeedbackWindow(); message.setMessageForNoAppointmentsPerDay(); message.Show(); return; } if (this.date.Date < DateTime.Today.Date) { FeedbackWindow message = new FeedbackWindow(); message.setMessageForBookingNotAvailableForDateDueToDateInThePast(); message.Show(); return; } this.singleDay.ShowDialog(); }
/** * Method calls on saving controller method based on validation * * @param errors list of errors * @param user user model */ private void save(List <string> errors, UserModel user) { UserController controller = new UserController(); FeedbackWindow feedback = new FeedbackWindow(); if (errors.Count != 0) { feedback.setMessageForInvalidFieldsValues(errors); } else if (!controller.save(user)) { feedback.setMessageForSavingError(); } else { feedback.setMessageForSuccessfullOperation(); } feedback.Show(); }
/** Method is responsible for initiation of the process of saving the settings */ private void saveUserSettings_Click(object sender, EventArgs e) { List <string> notification = new List <string>(); List <string> verification = new List <string>(); List <string> confirmation = new List <string>(); if (onThePhoneVerification.Enabled && onThePhoneVerification.Checked) { verification.Add(settingsPanel.verificationOptions.call.ToString()); } if (emailVerification.Enabled && emailVerification.Checked) { verification.Add(settingsPanel.verificationOptions.email.ToString()); } if (printableConfirmation.Enabled && printableConfirmation.Checked) { confirmation.Add(settingsPanel.confirmationOptions.print.ToString()); } if (emailConfirmation.Enabled && emailConfirmation.Checked) { confirmation.Add(settingsPanel.confirmationOptions.email.ToString()); } FeedbackWindow feedback = new FeedbackWindow(); if (!controller.saveSettings(notification, verification, confirmation)) { feedback.setMessageForSavingError(); } else { feedback.setMessageForSuccessfullOperation(); } feedback.Show(); fillInSettingsBasedOnUserData(); }
/** Method calls on controller method for saving staff member */ private void saveButton_Click(object sender, EventArgs e) { StaffController controller = new StaffController(); StaffModel staffMember = this.getStaffModelFromForm(); List <string> errors = Validator.validateStaffMember(staffMember, (int)staffTypes.SelectedValue); if (errors.Count == 0) { bool result = controller.addStaffMember(staffMember); if (!result) { feedback.setMessageForSavingError(); } else { feedback.setMessageForSuccessfullOperation(); } } else { feedback.setMessageForInvalidFieldsValues(errors); } feedback.Show(); }
private void Feedback() { FeedbackWindow fw = new FeedbackWindow(parent); fw.Show(); }
/** Method initiaties processed for saving staffSchedule model */ private void saveScheduleButton_Click(object sender, EventArgs e) { this.errors = new List <string>(); this.validateSelection(); if (errors.Count == 0) { List <DateTime> selectedMonths = getCheckedMonths(); int staffId = getSelectedStaffId(); List <string> daysToBeScheduled = getDaysToBeScheduled(); Dictionary <string, Dictionary <string, string> > timesPerDay = getTimesPerDay(); List <int> scheduledDays = getScheduleIdsPerPeriod(selectedMonths, daysToBeScheduled, timesPerDay); if (this.saveStaffSchedules(staffId, scheduledDays)) { clearAllTheFields(); } } else { feedback.setMessageForInvalidFieldsValues(errors); feedback.Show(); } }
/** Method performs actions preparing data for saving and the firing the process */ private void saveButton_Click(object sender, EventArgs e) { List <string> validationErrors = Validator.validateScheduleEntry(workStartTime.Value, workEndTime.Value, breakStartTime.Value, breakEndTime.Value); if (validationErrors.Count != 0) { feedback.setMessageForInvalidFieldsValues(validationErrors); feedback.Show(); workStartTime.Value = new DateTime(2012, 12, 12, 9, 0, 0); workEndTime.Value = new DateTime(2012, 12, 12, 17, 0, 0); return; } ScheduleModel schedule = new ScheduleModel(); ScheduleController controller = new ScheduleController(); int staffId = ((ListItem)allTheStaffMembers.SelectedItem).id; if (staffId == 0) { feedback.setMessageForInvalidFieldsValues(new List <string>() { "staff member" }); feedback.Show(); return; } schedule.setDate(dateToBeScheduled.Value.Date.ToString("yyyy-MM-dd")); List <int> scheduleIdList = new List <int>(); if (!noBreakCheckBox.Checked) { schedule.setStartTime(workStartTime.Value.TimeOfDay.ToString()); schedule.setEndTime(breakStartTime.Value.TimeOfDay.ToString()); if (controller.saveSchedule(schedule)) { scheduleIdList.Add(controller.getScheduleIdBasedOnOtherScheduleInformation(schedule)); } schedule.setStartTime(breakEndTime.Value.TimeOfDay.ToString()); schedule.setEndTime(workEndTime.Value.TimeOfDay.ToString()); if (controller.saveSchedule(schedule)) { scheduleIdList.Add(controller.getScheduleIdBasedOnOtherScheduleInformation(schedule)); } } else { schedule.setStartTime(workStartTime.Value.TimeOfDay.ToString()); schedule.setEndTime(workEndTime.Value.TimeOfDay.ToString()); controller.saveSchedule(schedule); scheduleIdList.Add(controller.getScheduleIdBasedOnOtherScheduleInformation(schedule)); } List <bool> errors = controller.saveStaffSchedules(staffId, scheduleIdList); if (errors.Count == 0) { feedback.setMessageForSuccessfullOperation(); } else { feedback.setMessageForSavingError(); } feedback.Show(); }