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()
{
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;

View File

@ -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<Appointment>? selectedAppointments = _appointments.Where(a => a.Start == date).ToList();
var startDate = calendar.SelectionStart.ToUniversalTime();
var selectedDate = startDate.Date;
List<Appointment>? selectedAppointments = _appointments.Where(a => a.Start.Date == selectedDate).ToList();
appointmentDataView.DataSource = selectedAppointments?.Count > 0 ? selectedAppointments : null;
}

View File

@ -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: