Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shenaldev committed Sep 29, 2023
1 parent 9b7e1cb commit 0560edf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Forms/Dashboard/Common/AddAppointmentForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private void AddAppointmentForm_Load(object sender, EventArgs e)

private void CancelBtn_Click(object sender, EventArgs e)
{
this.Hide();
this.Close();
}

//HANDLE DOCTOR CHANGE AND LOAD SCHEDULES
Expand Down Expand Up @@ -242,7 +242,7 @@ private Int64 MakeAppointment()
private void PaymentFormClosed(FormClosedEventArgs args)
{
MessageBox.Show("Appointment Added Sccessfuly", "Success", default, MessageBoxIcon.Information);
this.Hide();
this.Close();
}

private bool ValidateApptInputs()
Expand Down
9 changes: 8 additions & 1 deletion Forms/Dashboard/Common/AppoinmentForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ private void Add_btn_Click(object sender, EventArgs e)
addAppointmentForm.Dock = DockStyle.Fill;
Parent.Controls.Add(addAppointmentForm);
addAppointmentForm.BringToFront();
addAppointmentForm.FormClosed += (s, args) => addAppointmentFormClosed(args); // CLOSE EVENT
addAppointmentForm.Show();
}

Expand All @@ -55,6 +56,12 @@ private void View_invoice_btn_Click(object sender, EventArgs e)
invoiceView.Show();
}

//REFETCH DATA WHEN ADD APPOINTMENT FORM CLOSED
private void addAppointmentFormClosed(FormClosedEventArgs args)
{
LoadAppointments();
}

private void OnGridViewCellDubleClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1)
Expand Down Expand Up @@ -95,7 +102,7 @@ private void Search_btn_Click(object sender, EventArgs e)
string patientID = Search_patient_input.SelectedValue.ToString();
string date = Search_date_input.Value.ToString("yyyy-MM-dd");

string query = selectQuery + "WHERE CONVERT(varchar(30),sch.start_date,126) LIKE @start_date";
string query = selectQuery + " WHERE CONVERT(varchar(30),sch.start_date,126) LIKE @start_date";

if (doctorID != "0")
query += " AND Users.id = @doctor_id";
Expand Down
6 changes: 3 additions & 3 deletions Forms/Dashboard/Common/ScheduleForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Models/Schedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public DateTime EndDateTime
+ "room = @room, "
+ "start_date = @start_date, "
+ "end_date = @end_date "
+ "updated_at = @updated_at "
+ "WHERE id = @id";
private string deleteQuery = "DELETE FROM Schedules WHERE id = @id";

Expand Down Expand Up @@ -91,7 +90,6 @@ public SqlCommand GetUpdateCmd(SqlConnection connection, Int64 id)
sqlCommand.Parameters.AddWithValue("@room", roomNo);
sqlCommand.Parameters.AddWithValue("@start_date", startDateTime);
sqlCommand.Parameters.AddWithValue("@end_date", endDateTime);
sqlCommand.Parameters.AddWithValue("@updated_at", timeNow);
sqlCommand.Parameters.AddWithValue("@id", id);
return sqlCommand;
}
Expand Down

0 comments on commit 0560edf

Please sign in to comment.