Example #1
0
        public void AddKeyWorker(Common.PatientsEmployee employee)
        {
            Common.Patient            pat = new Common.Patient();
            DataLayer.PatientsHandler dap = new DataLayer.PatientsHandler();

            employee.PatientDate = DateTime.Today;
            this.AddKeyWorkerToDatabase(employee);
        }
Example #2
0
        /// <summary>
        /// Registers a new user.
        /// </summary>
        /// <param name="User">User to be added.</param>
        public void RegisterPatient(Common.Patient patient)
        {
            DataLayer.PatientsHandler dap = new DataLayer.PatientsHandler();

            if (CheckRegister(patient))
            {
                this.AddPatientToDatabase(patient);
            }
        }
Example #3
0
        public void AddDiagnosis(Common.DiagnosisPatient diagnosis)
        {
            Common.Patient            pat = new Common.Patient();
            DataLayer.PatientsHandler dap = new DataLayer.PatientsHandler();
            diagnosis.DiagnosisId = Guid.NewGuid();
            diagnosis.LogDate     = DateTime.Today;
            this.AddDiagnosisToDatabase(diagnosis);

            pat = GetPatient(diagnosis.PatientId_fk);
            pat.Diagnosis_fk = diagnosis.DiagnosisId;
            this.UpdatePatient(pat);
        }
Example #4
0
 public Boolean CheckRegister(Common.Patient patient)
 {
     Common.Patient p = this.GetPatient(patient.FileNumber);
     if (p == null)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #5
0
 public void UpdatePatient(Common.Patient patient)
 {
     Common.Patient ExistingUser = this.GetPatient(patient.FileNumber);
     this.Entities.Entry(ExistingUser).CurrentValues.SetValues(patient);
     this.Entities.SaveChanges();
 }
Example #6
0
 /// <summary>
 /// Adds a new to the database.
 /// </summary>
 /// <param name="Patient">user instance to be added.</param>
 public void AddPatient(Common.Patient Patient)
 {
     this.Entities.Patients.Add(Patient);
     this.Entities.SaveChanges();
 }
Example #7
0
        public void AddDoctor(Common.Doctor doctor, string txtCon, string txtOnc, string txtFD, Guid?ddCon, Guid?ddFD, Guid?ddOnc)
        {
            DataLayer.PatientsHandler dap = new DataLayer.PatientsHandler();
            BusinessLayer.UsersBL     emp = new UsersBL();
            int tempPId = (int)doctor.PatientId_FK;

            Common.Patient pat = new Common.Patient();
            if (txtOnc != "" || ddOnc != null)
            {
                if (txtOnc != "")
                {
                    Common.Doctor d = new Common.Doctor();
                    d.PatientId_FK  = tempPId;
                    d.DoctorType_FK = emp.GetDoctorType("Oncologist").DoctorTypeId;
                    d.DoctorName    = txtOnc;
                    d.DoctorDate    = DateTime.Today;
                    d.DoctorID      = Guid.NewGuid();
                    this.AddDoctorToDatabase(d);

                    pat = GetPatient((int)d.PatientId_FK);
                    pat.Oncologist_fk = d.DoctorID;
                    this.UpdatePatient(pat);
                }
                else
                {
                    Common.Doctor d = new Common.Doctor();
                    d.PatientId_FK   = tempPId;
                    d.DoctorType_FK  = emp.GetDoctorType("Oncologist").DoctorTypeId;
                    d.DEmployeeId_FK = ddOnc;
                    d.DoctorDate     = DateTime.Today;
                    d.DoctorID       = Guid.NewGuid();
                    this.AddDoctorToDatabase(d);

                    pat = GetPatient((int)d.PatientId_FK);
                    pat.Oncologist_fk = d.DoctorID;
                    this.UpdatePatient(pat);
                }
            }
            if (txtCon != "" || ddCon != null)
            {
                if (txtCon != "")
                {
                    Common.Doctor d = new Common.Doctor();
                    d.PatientId_FK  = tempPId;
                    d.DoctorType_FK = emp.GetDoctorType("Consultant").DoctorTypeId;
                    d.DoctorName    = txtCon;
                    d.DoctorDate    = DateTime.Today;
                    d.DoctorID      = Guid.NewGuid();
                    this.AddDoctorToDatabase(d);

                    pat = GetPatient((int)d.PatientId_FK);
                    pat.Consultant_fk = d.DoctorID;
                    this.UpdatePatient(pat);
                }
                else
                {
                    Common.Doctor d = new Common.Doctor();
                    d.PatientId_FK   = tempPId;
                    d.DoctorType_FK  = emp.GetDoctorType("Consultant").DoctorTypeId;
                    d.DEmployeeId_FK = ddCon;
                    d.DoctorDate     = DateTime.Today;
                    d.DoctorID       = Guid.NewGuid();
                    this.AddDoctorToDatabase(d);

                    pat = GetPatient((int)d.PatientId_FK);
                    pat.Consultant_fk = d.DoctorID;
                    this.UpdatePatient(pat);
                }
            }
            if (txtFD != "" || ddFD != null)
            {
                if (txtFD != "")
                {
                    Common.Doctor d = new Common.Doctor();
                    d.PatientId_FK  = tempPId;
                    d.DoctorType_FK = emp.GetDoctorType("FamilyDoctor").DoctorTypeId;
                    d.DoctorName    = txtFD;
                    d.DoctorDate    = DateTime.Today;
                    d.DoctorID      = Guid.NewGuid();
                    this.AddDoctorToDatabase(d);

                    pat = GetPatient((int)d.PatientId_FK);
                    pat.FamilyDoctor_fk = d.DoctorID;
                    this.UpdatePatient(pat);
                }
                else
                {
                    Common.Doctor d = new Common.Doctor();
                    d.PatientId_FK   = tempPId;
                    d.DoctorType_FK  = emp.GetDoctorType("FamilyDoctor").DoctorTypeId;
                    d.DEmployeeId_FK = ddFD;
                    d.DoctorDate     = DateTime.Today;
                    d.DoctorID       = Guid.NewGuid();
                    this.AddDoctorToDatabase(d);

                    pat = GetPatient((int)d.PatientId_FK);
                    pat.FamilyDoctor_fk = d.DoctorID;
                    this.UpdatePatient(pat);
                }
            }
        }
Example #8
0
 public void UpdatePatient(Common.Patient patient)
 {
     new DataLayer.PatientsHandler().UpdatePatient(patient);
 }
Example #9
0
 /// <summary>
 /// Adds a new to the database.
 /// </summary>
 /// <param name="User">user instance to be added.</param>
 private void AddPatientToDatabase(Common.Patient Patient)
 {
     new DataLayer.PatientsHandler().AddPatient(Patient);
 }