public void EditPatient() { try { ClinicUser clinicUser = new ClinicUser(); clinicUser.ClinicUserId = selectedPatient.ClinicUserId; clinicUser.FullName = selectedPatient.FullName; clinicUser.DateOfBirth = selectedPatient.DateOfBirth; clinicUser.IDNumber = selectedPatient.IDNumber; clinicUser.GenderId = selectedPatient.GenderId; clinicUser.Citizenship = selectedPatient.Citizenship; clinicUser.Username = selectedPatient.Username; clinicUser.Password = selectedPatient.Password; ClinicPatient clinicPatient = new ClinicPatient(); clinicPatient.InsuranceNumber = selectedPatient.InsuranceNumber; clinicPatient.InsuranceExpirationDate = selectedPatient.InsuranceExpirationDate; clinicPatient.UniqueDoctorNumber = selectedPatient.UniqueDoctorNumber; AddPatientView addPatientView = new AddPatientView(User, clinicUser, clinicPatient, true); addPatientView.Show(); patientView.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public AddPatientViewModel(ClinicUser userAdmin, ClinicUser user, ClinicPatient patient, AddPatientView addPatientViewOpen, bool isForEdit) { this.userAdmin = userAdmin; this.user = user; this.userPatient = patient; this.isForEdit = isForEdit; addPatientView = addPatientViewOpen; GenderList = new ObservableCollection <Gender>(service.GetAllGender()); SelectedGender = GenderList.FirstOrDefault(p => p.GenderId == user.GenderId); DoctorList = new ObservableCollection <vwDoctor>(service.GetAllDoctors()); SelectedDoctor = DoctorList.FirstOrDefault(p => p.UniqueNumber == patient.UniqueDoctorNumber); }
public int AddNewPatient(ClinicPatient user) { try { using (MedicaClinicEntities2 context = new MedicaClinicEntities2()) { if (user.ClinicPatientId == 0) { ClinicPatient newClinicUser = new ClinicPatient(); newClinicUser.ClinicUserId = user.ClinicUserId; newClinicUser.InsuranceNumber = user.InsuranceNumber; newClinicUser.InsuranceExpirationDate = user.InsuranceExpirationDate; newClinicUser.UniqueDoctorNumber = user.UniqueDoctorNumber; context.ClinicPatients.Add(newClinicUser); context.SaveChanges(); user.ClinicPatientId = newClinicUser.ClinicPatientId; return(user.ClinicPatientId); } else { ClinicPatient editClinicUser = (from p in context.ClinicPatients where p.ClinicPatientId == user.ClinicPatientId select p).First(); editClinicUser.ClinicUserId = user.ClinicUserId; editClinicUser.InsuranceNumber = user.InsuranceNumber; editClinicUser.InsuranceExpirationDate = user.InsuranceExpirationDate; editClinicUser.UniqueDoctorNumber = user.UniqueDoctorNumber; editClinicUser.ClinicPatientId = user.ClinicPatientId; context.SaveChanges(); Logging.LoggAction("AddPatientViewModel", "Info", "Succesfull edited patient"); return(user.ClinicPatientId); } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Exception" + ex.Message.ToString()); Logging.LoggAction("AddPatientIdViweModel", "Error", ex.ToString()); return(0); } }
public bool CheckInsuranceNumber(int insuranceNumber) { try { using (MedicaClinicEntities2 context = new MedicaClinicEntities2()) { ClinicPatient clinicUser = (from d in context.ClinicPatients where d.InsuranceNumber == insuranceNumber select d).FirstOrDefault(); if (clinicUser != null) { return(false); } else { return(true); } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Exception" + ex.Message.ToString()); return(false); } }
public AddPatientView(ClinicUser userAdmin, ClinicUser user, ClinicPatient patient, bool isForEdit) { InitializeComponent(); this.DataContext = new AddPatientViewModel(userAdmin, user, patient, this, isForEdit); }
public void patientCheckIn() { int id = InputHelper.getInteger("Enter the patient's ID number: ", "Please enter a valid ID number."); string name = InputHelper.getString("Enter the patient's name: ", "Please enter a name."); int telephoneNumber = InputHelper.getInteger("Enter the patient's telephone number: ", "Please enter a valid telephone number."); string doctorName = InputHelper.getString("Enter the name of the doctor the patient wishes to see: ", "Please enter a name."); ClinicPatient patient = new ClinicPatient(id, name, telephoneNumber); DoctorQueue doctor = this.findDoctor(doctorName); if (doctor != null) { if (doctor.IsAvailable) { doctor.Enqueue(patient); } else { Console.WriteLine("Dr." + doctor.Name + " is not available right now. " + "The patient must try another doctor or cancel their appointment."); } } else { this.noDoctor(doctorName); } }
/// <summary> /// Finds a patient's doctor. /// </summary> /// <param name="patient">The patient to find the doctor of.</param> public DoctorQueue findPatientDoctor(ClinicPatient patient) { foreach (DoctorQueue doctor in this.doctors) { if (doctor.Contains(patient)) { return doctor; } } return null; }