Дипломная работа: Автоматизация учета пациентов на примере ООО «АРХИДЕНТ»

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
107
выберите его из списка слева.");
}
}
private void ButtonNewReception_Click(object sender, RoutedEventArgs e)
{
if (SelectionObj != null)
{
NewReception newReception = new NewReception(SelectionObj,
connection);
newReception.Show();
}
else
{
MessageBox.Show("Что бы создаь новую запись расписания
выберите пацента из списка слева.");
}
}
private void PatientDataGrid_SelectionChanged(object sender,
SelectionChangedEventArgs e)
{
Patient patient = PatientDataGrid.SelectedItem as Patient;
if (patient != null)
{
SelectionObj = patient;
ReceptionDataGrid.Items.Clear();
//загрузкарасписаниядляконкретногопацента
sqlExpression = "SELECT [Reception].[Id_Reception],
[Reception].[doctor], [Doctor].[nameDoctor], [Doctor].[surname],
108
[Doctor].[patronymic], [Reception].[patient], [Patient].[namePatient],
[Patient].[surname], [Patient].[patronymic], [Reception].[procedure],
[Procedure].[nameProcedure], [Reception].[begin_reception], [Reception].[status],
[Reception].[price] FROM (([Reception] LEFT JOIN [Doctor] ON
[Reception].[doctor] = [Doctor].[Id_doc]) LEFT JOIN [Patient] ON
[Reception].[patient] = [Patient].[Id_patient]) LEFT JOIN [Procedure] ON
[Reception].[procedure] = [Procedure].[Id_Procedure] WHERE
[Reception].[patient] = " + patient.Id;
command = new SqlCommand(sqlExpression, connection);
reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
Reception_ temp = new Reception_();
temp.Id = reader.GetInt32(0);
temp.doctor_id = reader.GetInt32(1);
temp.nameDoctor = reader.GetString(2);
temp.surnameDoctor = reader.GetString(3);
temp.patronymicDoctor = reader.GetString(4);
temp.patient_id = reader.GetInt32(5);
temp.namePatient = reader.GetString(6);
temp.surnamePatient = reader.GetString(7);
temp.patronymicPatient = reader.GetString(8);
temp.procedure = reader.GetInt32(9);
temp.nameProcedure = reader.GetString(10);
109
temp.begin_reception = reader.GetDateTime(11);
temp.status = reader.GetBoolean(12);
temp.price = reader.GetInt32(13);
ReceptionDataGrid.Items.Add(temp);
}
}
}
}
private void ProcedureDataGrid_SelectionChanged(object sender,
SelectionChangedEventArgs e)
{
Procedure procedure = ProcedureDataGrid.SelectedItem as
Procedure;
if (procedure != null)
{
ReceptionDataGrid.Items.Clear();
//загрузкарасписаниядляконкретнойуслуги
sqlExpression = "SELECT [Reception].[Id_Reception],
[Reception].[doctor], [Doctor].[nameDoctor], [Doctor].[surname],
[Doctor].[patronymic], [Reception].[patient], [Patient].[namePatient],
[Patient].[surname], [Patient].[patronymic], [Reception].[procedure],
[Procedure].[nameProcedure], [Reception].[begin_reception], [Reception].[status],
[Reception].[price] FROM (([Reception] LEFT JOIN [Doctor] ON
[Reception].[doctor] = [Doctor].[Id_doc]) LEFT JOIN [Patient] ON
[Reception].[patient] = [Patient].[Id_patient]) LEFT JOIN [Procedure] ON
[Reception].[procedure] = [Procedure].[Id_Procedure] WHERE
[Reception].[procedure] = " + procedure.Id;
110
command = new SqlCommand(sqlExpression, connection);
reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
Reception_ temp = new Reception_();
temp.Id = reader.GetInt32(0);
temp.doctor_id = reader.GetInt32(1);
temp.nameDoctor = reader.GetString(2);
temp.surnameDoctor = reader.GetString(3);
temp.patronymicDoctor = reader.GetString(4);
temp.patient_id = reader.GetInt32(5);
temp.namePatient = reader.GetString(6);
temp.surnamePatient = reader.GetString(7);
temp.patronymicPatient = reader.GetString(8);
temp.procedure = reader.GetInt32(9);
temp.nameProcedure = reader.GetString(10);
temp.begin_reception = reader.GetDateTime(11);
temp.status = reader.GetBoolean(12);
temp.price = reader.GetInt32(13);
ReceptionDataGrid.Items.Add(temp);
}
}
111
}
}
private void ReceptionDataGrid_SelectionChanged(object sender,
SelectionChangedEventArgs e)
{
Reception_ reception_ = ReceptionDataGrid.SelectedItem as
Reception_;
if (reception_ != null)
{
Patient targetpatient = new Patient();
sqlExpression = "SELECT [Patient].[Id_patient], [Patient].[namePatient],
[Patient].[surname], [Patient].[age], [Patient].[patronymic], [Patient].[passport],
[Patient].[phone] FROM Patient WHERE [Patient].[Id_patient] = " +
reception_.patient_id;
command = new SqlCommand(sqlExpression, connection);
reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
targetpatient.Id = reader.GetInt32(0);
targetpatient.namePatient = reader.GetString(1);
targetpatient.surname = reader.GetString(2);
targetpatient.age = reader.GetInt32(3);
targetpatient.patronymic = reader.GetString(4);
targetpatient.passport = reader.GetString(5);
targetpatient.phone = reader.GetString(6);
}
Источник: https://baza.diplomsite.ru/previewfile/286