Fixed the small bugs

This commit is contained in:
Spudnut2000 2025-06-25 23:12:32 -05:00
parent eba8dd8d3a
commit 4001a1c7e4
3 changed files with 11 additions and 9 deletions

View File

@ -21,15 +21,16 @@ public partial class AddOrUpdateAppointmentForm : Form
public AddOrUpdateAppointmentForm() public AddOrUpdateAppointmentForm()
{ {
InitializeComponent(); InitializeComponent();
RefreshComponents(); RefreshCustomersList();
typeComboBox.DataSource = _appointmentTypes; typeComboBox.DataSource = _appointmentTypes;
saveButton.Click += SaveButton_Click; saveButton.Click += SaveButton_Click;
cancelButton.Click += (s, e) => Close(); cancelButton.Click += (s, e) => Close();
} }
private void RefreshComponents() private void RefreshCustomersList()
{ {
customerComboBox.DataSource = null;
_customers.Clear(); _customers.Clear();
_customers.AddRange(DatabaseHelper.RetrieveCustomers()); _customers.AddRange(DatabaseHelper.RetrieveCustomers());
customerComboBox.DataSource = _customers; customerComboBox.DataSource = _customers;
@ -37,6 +38,8 @@ public partial class AddOrUpdateAppointmentForm : Form
public void InitAdd() public void InitAdd()
{ {
RefreshCustomersList();
label1.Text = "Add New Appointment"; label1.Text = "Add New Appointment";
_currentAppointment = null; _currentAppointment = null;
@ -57,6 +60,8 @@ public partial class AddOrUpdateAppointmentForm : Form
public void InitUpdate(Appointment appointment) public void InitUpdate(Appointment appointment)
{ {
RefreshCustomersList();
label1.Text = "Update Appointment"; label1.Text = "Update Appointment";
_currentAppointment = appointment; _currentAppointment = appointment;

View File

@ -11,6 +11,7 @@ public partial class AppointmentsForm : Form
public AppointmentsForm() public AppointmentsForm()
{ {
InitializeComponent(); InitializeComponent();
UpdateAppointmentsList(null, EventArgs.Empty);
Shown += UpdateAppointmentsList; Shown += UpdateAppointmentsList;
_addOrUpdateAppointmentForm.UpdateAppointmentsList += UpdateAppointmentsList; _addOrUpdateAppointmentForm.UpdateAppointmentsList += UpdateAppointmentsList;
@ -72,8 +73,9 @@ public partial class AppointmentsForm : Form
private void ShowAppointmentsFromSelectedDay(object? sender, EventArgs e) private void ShowAppointmentsFromSelectedDay(object? sender, EventArgs e)
{ {
var date = calendar.SelectionStart; var startDate = calendar.SelectionStart.ToUniversalTime();
List<Appointment>? selectedAppointments = _appointments.Where(a => a.Start == date).ToList(); var selectedDate = startDate.Date;
List<Appointment>? selectedAppointments = _appointments.Where(a => a.Start.Date == selectedDate).ToList();
appointmentDataView.DataSource = selectedAppointments?.Count > 0 ? selectedAppointments : null; appointmentDataView.DataSource = selectedAppointments?.Count > 0 ? selectedAppointments : null;
} }

View File

@ -1,10 +1,5 @@
# ✅ C# Application Development To-Do List # ✅ 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 ## 1. Login Form
- [x] Create a login form with the following functionality: - [x] Create a login form with the following functionality: