From 4001a1c7e40a03c43b5ec5f53dd812852ca5c506 Mon Sep 17 00:00:00 2001 From: Spudnut2000 Date: Wed, 25 Jun 2025 23:12:32 -0500 Subject: [PATCH] Fixed the small bugs --- C969Project/AddOrUpdateAppointmentForm.cs | 9 +++++++-- C969Project/AppointmentsForm.cs | 6 ++++-- C969Project/todo.md | 5 ----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/C969Project/AddOrUpdateAppointmentForm.cs b/C969Project/AddOrUpdateAppointmentForm.cs index 08b619c..d03bded 100644 --- a/C969Project/AddOrUpdateAppointmentForm.cs +++ b/C969Project/AddOrUpdateAppointmentForm.cs @@ -21,15 +21,16 @@ public partial class AddOrUpdateAppointmentForm : Form public AddOrUpdateAppointmentForm() { InitializeComponent(); - RefreshComponents(); + RefreshCustomersList(); typeComboBox.DataSource = _appointmentTypes; saveButton.Click += SaveButton_Click; cancelButton.Click += (s, e) => Close(); } - private void RefreshComponents() + private void RefreshCustomersList() { + customerComboBox.DataSource = null; _customers.Clear(); _customers.AddRange(DatabaseHelper.RetrieveCustomers()); customerComboBox.DataSource = _customers; @@ -37,6 +38,8 @@ public partial class AddOrUpdateAppointmentForm : Form public void InitAdd() { + RefreshCustomersList(); + label1.Text = "Add New Appointment"; _currentAppointment = null; @@ -57,6 +60,8 @@ public partial class AddOrUpdateAppointmentForm : Form public void InitUpdate(Appointment appointment) { + RefreshCustomersList(); + label1.Text = "Update Appointment"; _currentAppointment = appointment; diff --git a/C969Project/AppointmentsForm.cs b/C969Project/AppointmentsForm.cs index 2278b8f..ffa3fce 100644 --- a/C969Project/AppointmentsForm.cs +++ b/C969Project/AppointmentsForm.cs @@ -11,6 +11,7 @@ public partial class AppointmentsForm : Form public AppointmentsForm() { InitializeComponent(); + UpdateAppointmentsList(null, EventArgs.Empty); Shown += UpdateAppointmentsList; _addOrUpdateAppointmentForm.UpdateAppointmentsList += UpdateAppointmentsList; @@ -72,8 +73,9 @@ public partial class AppointmentsForm : Form private void ShowAppointmentsFromSelectedDay(object? sender, EventArgs e) { - var date = calendar.SelectionStart; - List? selectedAppointments = _appointments.Where(a => a.Start == date).ToList(); + var startDate = calendar.SelectionStart.ToUniversalTime(); + var selectedDate = startDate.Date; + List? selectedAppointments = _appointments.Where(a => a.Start.Date == selectedDate).ToList(); appointmentDataView.DataSource = selectedAppointments?.Count > 0 ? selectedAppointments : null; } diff --git a/C969Project/todo.md b/C969Project/todo.md index a6aeffb..1d22ba2 100644 --- a/C969Project/todo.md +++ b/C969Project/todo.md @@ -1,10 +1,5 @@ # ✅ C# Application Development To-Do List -## Current issues -- [x] Customers dont update when adding -- [ ] Cant select appointment by day anymore -- [ ] Add/Update appt form doesn't update user list - ## 1. Login Form - [x] Create a login form with the following functionality: