public PatientsView() { InitializeComponent(); dbContext = new Clinic_DatabaseEntities(); dbContext.Patients.Load(); var bindingList = dbContext.Patients.Local.ToBindingList(); tableModel = new ObservableCollection <PatientModel>(); for (int i = 0; i < bindingList.Count; i++) { PatientModel patientModel = new PatientModel(); patientModel.Patient_Object = bindingList[i]; // Преобразование гендеров if (bindingList[i].Gender.Equals("m")) { patientModel.Gender = "Мужской"; } else if (bindingList[i].Gender.Equals("f")) { patientModel.Gender = "Женский"; } patientModel.Row_Number = (i + 1); tableModel.Add(patientModel); } mPatientsTable.ItemsSource = tableModel; }
public DoctorsView() { InitializeComponent(); isRequest = false; dbContext = new Clinic_DatabaseEntities(); dbContext.Doctors.Load(); var bindingList = dbContext.Doctors.Local.ToBindingList(); tableModel = new ObservableCollection <DoctorModel>(); for (int i = 0; i < bindingList.Count; i++) { DoctorModel doctorModel = new DoctorModel(); doctorModel.Row_Number = (i + 1); doctorModel.Doctor_Object = bindingList[i]; tableModel.Add(doctorModel); } mDoctorsTable.ItemsSource = tableModel; }
public EditPatient(ObservableCollection <PatientModel> tableModel, int index) { InitializeComponent(); this.tableModel = tableModel; this.index = index; mFieldSurname.Text = tableModel[index].Patient_Object.Surname; mFieldName.Text = tableModel[index].Patient_Object.Name; mFieldLastname.Text = tableModel[index].Patient_Object.Lastname; string gender = tableModel[index].Gender; if (gender.Equals("Мужской")) { mListGender.SelectedIndex = 0; } else if (gender.Equals("Женский")) { mListGender.SelectedIndex = 1; } mFieldBirthday.Text = tableModel[index].Patient_Object.Birthday.ToString("dd.MM.yyyy"); mFieldAddress.Text = tableModel[index].Patient_Object.Address; mFieldPhone.Text = tableModel[index].Patient_Object.Phone; dbContext = new Clinic_DatabaseEntities(); dbContext.Patients.Load(); }
public RequestPatient(DataGrid mDataGrid, Button mButton) { InitializeComponent(); this.mDataGrid = mDataGrid; this.mButton = mButton; dbContext = new Clinic_DatabaseEntities(); dbContext.Patients.Load(); patients = dbContext.Patients.Local.ToBindingList(); for (int i = 0; i < patients.Count; i++) { // Добавление короткого имени пациента string Surname = patients[i].Surname; string Name = patients[i].Name; string Lastname = patients[i].Lastname; string shortName; if (Lastname == null || Lastname.Equals("")) { shortName = Surname + " " + Name.Substring(0, 1) + "."; } else { shortName = Surname + " " + Name.Substring(0, 1) + "." + Lastname.Substring(0, 1) + "."; } mListPatient.Items.Add(shortName); } }
public AddDoctor(ObservableCollection <DoctorModel> tableModel) { InitializeComponent(); this.tableModel = tableModel; dbContext = new Clinic_DatabaseEntities(); dbContext.Doctors.Load(); }
public RequestReception(DataGrid mDataGrid, Button mButton) { InitializeComponent(); this.mDataGrid = mDataGrid; this.mButton = mButton; dbContext = new Clinic_DatabaseEntities(); dbContext.Receptions.Load(); }
public AddPatient(ObservableCollection <PatientModel> tableModel) { InitializeComponent(); this.tableModel = tableModel; dbContext = new Clinic_DatabaseEntities(); dbContext.Patients.Load(); }
public EditSpecialty(ObservableCollection <SpecialtyModel> tableModel, int index) { InitializeComponent(); this.tableModel = tableModel; this.index = index; mFieldTitle.Text = tableModel[index].Specialty_Object.Title; dbContext = new Clinic_DatabaseEntities(); dbContext.Doctors.Load(); }
public EditDoctor(ObservableCollection <DoctorModel> tableModel, int index) { InitializeComponent(); this.tableModel = tableModel; this.index = index; mFieldSurname.Text = tableModel[index].Doctor_Object.Surname; mFieldName.Text = tableModel[index].Doctor_Object.Name; mFieldLastname.Text = tableModel[index].Doctor_Object.Lastname; dbContext = new Clinic_DatabaseEntities(); dbContext.Doctors.Load(); }
public RequestDoctor(DataGrid mDataGrid, Button mButton) { InitializeComponent(); this.mDataGrid = mDataGrid; this.mButton = mButton; dbContext = new Clinic_DatabaseEntities(); dbContext.Specialties.Load(); specialtyes = dbContext.Specialties.Local.ToBindingList(); for (int i = 0; i < specialtyes.Count; i++) { mChangeList.Items.Add(specialtyes[i].Title); } dbContext.Doctors.Load(); doctors = dbContext.Doctors.Local.ToBindingList(); }
public SpecialtyesView() { InitializeComponent(); dbContext = new Clinic_DatabaseEntities(); dbContext.Specialties.Load(); var bindingList = dbContext.Specialties.Local.ToBindingList(); tableModel = new ObservableCollection <SpecialtyModel>(); for (int i = 0; i < bindingList.Count; i++) { SpecialtyModel specialtyModel = new SpecialtyModel(); specialtyModel.Row_Number = (i + 1); specialtyModel.Specialty_Object = bindingList[i]; tableModel.Add(specialtyModel); } mSpecialtyesTable.ItemsSource = tableModel; }
public EditReception(ObservableCollection <ReceptionModel> tableModel, int index) { InitializeComponent(); this.tableModel = tableModel; this.index = index; dbContext = new Clinic_DatabaseEntities(); dbContext.Specialties.Load(); specialtyes = dbContext.Specialties.Local.ToBindingList(); for (int i = 0; i < specialtyes.Count; i++) { mListSpecialty.Items.Add(specialtyes[i].Title); } dbContext.Patients.Load(); patients = dbContext.Patients.Local.ToBindingList(); for (int i = 0; i < patients.Count; i++) { // Добавление короткого имени пациента string Surname = patients[i].Surname; string Name = patients[i].Name; string Lastname = patients[i].Lastname; string shortName; if (Lastname == null || Lastname.Equals("")) { shortName = Surname + " " + Name.Substring(0, 1) + "."; } else { shortName = Surname + " " + Name.Substring(0, 1) + "." + Lastname.Substring(0, 1) + "."; } mListPatient.Items.Add(shortName); } dbContext.Doctors.Load(); doctors = dbContext.Doctors.Local.ToBindingList(); for (int i = 0; i < doctors.Count; i++) { // Добавление короткого имени врача string Surname = doctors[i].Surname; string Name = doctors[i].Name; string Lastname = doctors[i].Lastname; string shortName; if (Lastname == null || Lastname.Equals("")) { shortName = Surname + " " + Name.Substring(0, 1) + "."; } else { shortName = Surname + " " + Name.Substring(0, 1) + "." + Lastname.Substring(0, 1) + "."; } mListDoctor.Items.Add(shortName); } dbContext.Receptions.Load(); int specialtyIndex = -1; for (int i = 0; i < specialtyes.Count; i++) { if (specialtyes[i].Specialty_Id == tableModel[index].Reception_Object.Specialty_Id) { specialtyIndex = i; break; } } if (specialtyIndex == -1) { MessageBox.Show("Критическая ошибка! Специальность не найдена!", "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error); return; } int doctorIndex = -1; for (int i = 0; i < doctors.Count; i++) { if (doctors[i].Doctor_Id == tableModel[index].Reception_Object.Doctor_Id) { doctorIndex = i; break; } } if (doctorIndex == -1) { MessageBox.Show("Критическая ошибка! Доктор не найден!", "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error); return; } int patientIndex = -1; for (int i = 0; i < patients.Count; i++) { if (patients[i].Patient_Id == tableModel[index].Reception_Object.Patient_Id) { patientIndex = i; break; } } if (patientIndex == -1) { MessageBox.Show("Критическая ошибка! Пациент не найден!", "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error); return; } mListSpecialty.SelectedIndex = specialtyIndex; mListDoctor.SelectedIndex = doctorIndex; mListPatient.SelectedIndex = patientIndex; mFieldDate.Text = tableModel[index].Reception_Object.Date.ToString("dd.MM.yyyy"); mFieldTime.Text = tableModel[index].Reception_Object.Time.ToString(@"hh\:mm"); mFieldType.Text = tableModel[index].ReceptionType; }
public ReceptionsView() { InitializeComponent(); dbContext = new Clinic_DatabaseEntities(); dbContext.Receptions.Load(); var bindingList = dbContext.Receptions.Local.ToBindingList(); tableModel = new ObservableCollection <ReceptionModel>(); for (int i = 0; i < bindingList.Count; i++) { ReceptionModel reception = new ReceptionModel(); reception.Reception_Object = bindingList[i]; // Преобразование типов if (bindingList[i].Type.Equals("p")) { reception.ReceptionType = "Первичный"; } else if (bindingList[i].Type.Equals("s")) { reception.ReceptionType = "Вторичный"; } // Дата и время reception.Reception_Object.Date = bindingList[i].Date; reception.Reception_Object.Time = bindingList[i].Time; // Название специальность reception.Reception_Object.Specialty.Title = bindingList[i].Specialty.Title; // Номер по порядку reception.Row_Number = (i + 1); // Добавление короткого имени врача string Surname = bindingList[i].Doctor.Surname; string Name = bindingList[i].Doctor.Name; string Lastname = bindingList[i].Doctor.Lastname; if (Lastname == null || Lastname.Equals("")) { reception.DoctorShortName = Surname + " " + Name.Substring(0, 1) + "."; } else { reception.DoctorShortName = Surname + " " + Name.Substring(0, 1) + "." + Lastname.Substring(0, 1) + "."; } // Добавление короткого имени пациента Surname = bindingList[i].Patient.Surname; Name = bindingList[i].Patient.Name; Lastname = bindingList[i].Patient.Lastname; if (Lastname != null) { reception.PatientShortName = Surname + " " + Name.Substring(0, 1) + "." + Lastname.Substring(0, 1) + "."; } else { reception.PatientShortName = Surname + " " + Name.Substring(0, 1) + "."; } // Добавление объекта в список tableModel.Add(reception); } mReceptionsTable.ItemsSource = tableModel; }