Пример #1
0
        private void detailsButton_Click(object sender, EventArgs e)
        {
            switch (tabControl.SelectedIndex)
            {
            case 0:
                Appointment appointment = GetAppointmentFromGrid();

                if (appointment != null)
                {
                    OpenForm(new DetailedAppointmentForm(appointment, false));
                }

                break;

            case 1:
                PhysicalExamination examination = GetExaminationFromGrid();

                if (examination != null)
                {
                    OpenForm(new ExaminationForm(examination));
                }

                break;

            case 2:
                LaboratoryExamination laboratory = GetLaboratoryExaminationFromGrid();

                if (laboratory != null)
                {
                    OpenForm(new DetailedLaboratoryForm(laboratory, false));
                }

                break;
            }
        }
Пример #2
0
        public static int InsertLaboratoryExamination(LaboratoryExamination examination)
        {
            int result = 0;

            examination.Examinations = null;
            db.LaboratoryExamination.Add(examination);
            //result = db.SaveChanges();

            try
            {
                db.SaveChanges();
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                    }
                }
                return(1);
            }
            catch (System.Data.Entity.Infrastructure.DbUpdateException exc)
            {
                System.Console.WriteLine("Error: {1}", exc.Message);
                return(1);
            }

            return(result);
        }
Пример #3
0
        public static LaboratoryExamination GetLaboratoryExaminationById(int id)
        {
            LaboratoryExamination retVal = (from examination in db.LaboratoryExamination
                                            where examination.Id == id
                                            select examination).FirstOrDefault();

            return(retVal);
        }
Пример #4
0
 public ExaminationListForm(ref LaboratoryExamination examination)
 {
     InitializeComponent();
     this.laboratoryExamination = examination;
     this.laboratoryExamination.Examinations = new Examinations();
     ifPhysical = false;
     InitializeGrids();
 }
Пример #5
0
        private void showButton_Click(object sender, EventArgs e)
        {
            LaboratoryExamination examination = GetLaboratoryExaminationFromGrid();

            if (examination != null)
            {
                OpenForm(new DetailedLaboratoryForm(examination, false));
            }
        }
Пример #6
0
        public static LaboratoryExamination GetLaboratoryExaminationByName(string name)
        {
            LaboratoryExamination retVal = (from examination in db.Examinations
                                            join labEx in db.LaboratoryExamination on examination.Code equals labEx.ExaminationCode
                                            where examination.Name == name
                                            select labEx).FirstOrDefault();

            return(retVal);
        }
Пример #7
0
        public static LaboratoryExamination GetLaboratoryExaminationByCodeAndName(int code, string name)
        {
            LaboratoryExamination retVal = (from examination in db.Examinations
                                            join physEx in db.LaboratoryExamination on examination.Code equals physEx.ExaminationCode
                                            where examination.Name == name && physEx.ExaminationCode == code.ToString()
                                            select physEx).FirstOrDefault();

            return(retVal);
        }
Пример #8
0
        private void laboratoryDetailsButton_Click(object sender, EventArgs e)
        {
            LaboratoryExamination laboratory = GetSelectedLaboratoryExamination();

            if (laboratory != null)
            {
                DetailedLaboratoryForm detailedLabForm = new DetailedLaboratoryForm(laboratory, false);
                detailedLabForm.ShowDialog(this);
            }
        }
Пример #9
0
        private void assignLaboratoryExamination(LaboratoryExamination newExamination)
        {
            if (newExamination == null)
            {
                return;
            }

            laboratoryExamination.ExaminationCode   = newExamination.ExaminationCode;
            laboratoryExamination.Examinations.Name = newExamination.Examinations.Name;
            laboratoryExamination.Examinations.Type = newExamination.Examinations.Type;
            laboratoryExamination.Id = newExamination.Id;
        }
Пример #10
0
        public DetailedLaboratoryForm(LaboratoryExamination examination, bool editable)
        {
            InitializeComponent();
            this.examination = examination;

            examinationLabel.Text         = examination.Examinations.Name;
            codeLabel.Text                = examination.ExaminationCode;
            label1.Text                   = examination.Id.ToString();
            doctorLabel.Text              = examination.Appointment.Doctor.Employee.Person.First_Name + " " + examination.Appointment.Doctor.Employee.Person.Last_Name;
            patientLabel.Text             = examination.Appointment.Patient.Person.First_Name + " " + examination.Appointment.Patient.Person.Last_Name;
            requestDateLabel.Text         = examination.dt_Request.ToString();
            doctorCommentTextBox.Text     = examination.Doctor_Note;
            laboratorianLabel.Text        = examination.LaboratoryPerson.Employee.Person.First_Name + " " + examination.LaboratoryPerson.Employee.Person.Last_Name;
            executionDateLlabel.Text      = examination.dt_Complete_Cancel.ToString();
            resultsTextBox.Text           = examination.Result;
            supervisorLabel.Text          = examination.LaboratorySupervisor.Employee.Person.First_Name + " " + examination.LaboratorySupervisor.Employee.Person.Last_Name;
            confirmationDateLabel.Text    = examination.dt_Confirmation.ToString();
            supervisorCommentTextBox.Text = examination.Supervisor_Note;

            doctorPanel.Enabled       = false;
            supervisorPanel.Enabled   = false;
            laboratorianPanel.Enabled = false;
            if (Program.CurrentUser.Position == "LaboratoryPerson")
            {
                laboratorianPanel.Enabled = true;
                if (!editable)
                {
                    executeButton.Enabled   = false;
                    cancelButton1.Enabled   = false;
                    resultsTextBox.ReadOnly = true;
                }
            }
            else if (Program.CurrentUser.Position == "LaboratorySupervisor")
            {
                supervisorPanel.Enabled = true;
                if (!editable)
                {
                    confirmButton.Enabled             = false;
                    cancelButton2.Enabled             = false;
                    supervisorCommentTextBox.ReadOnly = true;
                }
            }
            else
            {
                doctorPanel.Enabled = true;
                if (!editable)
                {
                    requestButton.Enabled         = false;
                    searchButton.Enabled          = false;
                    doctorCommentTextBox.ReadOnly = true;
                }
            }
        }
 /// <summary>
 /// Log examination results
 /// </summary>
 /// <param name="lab">Laboratory examination type</param>
 internal void LogTestResult(LaboratoryExamination lab)
 {
     try
     {
         StreamWriter sw = File.AppendText(loc);
         sw.WriteLine(lab.GetResults());
         sw.Close();
     }
     catch (FileNotFoundException ex)
     {
         Console.WriteLine(ex.Message.ToString());
     }
 }
 /// <summary>
 /// Log schedule examination
 /// </summary>
 /// <param name="lab">Laboratiory examination for logging</param>
 internal void LogScheduleExamination(LaboratoryExamination lab)
 {
     try
     {
         StreamWriter sw = File.AppendText(loc);
         sw.WriteLine(@"[{0}] Doctor '{1}' has scheduled examination '{2}' for patient '{3}'", lab.DateAndTime, lab.Patient.Doctor.Name, lab.Name, lab.Patient.Name);
         sw.Close();
     }
     catch (FileNotFoundException ex)
     {
         Console.WriteLine(ex.Message.ToString());
     }
 }
Пример #13
0
        private void executeButton_Click(object sender, EventArgs e)
        {
            LaboratoryExamination examination = GetLaboratoryExaminationFromGrid();

            if (examination != null)
            {
                OpenForm(new DetailedLaboratoryForm(examination, true));
            }
            else
            {
                MessageBox.Show("Nierozpoznane ID badania.");
            }
        }
 /// <summary>
 /// Log permorming examination
 /// </summary>
 /// <param name="lab">Performed laboratory examination</param>
 internal void LogPerform(LaboratoryExamination lab)
 {
     try
     {
         StreamWriter sw = File.AppendText(loc);
         sw.WriteLine(@"[{0}] Patient '{1}' performed examination '{2}'", lab.DateAndTime, lab.Patient.Name, lab.Name);
         sw.Close();
     }
     catch (FileNotFoundException ex)
     {
         Console.WriteLine(ex.Message.ToString());
     }
 }
Пример #15
0
 public static LaboratoryExamination GetLaboratoryExaminationByCode(int code)
 {
     try
     {
         LaboratoryExamination retVal = (from examination in db.Examinations
                                         join labEx in db.LaboratoryExamination on examination.Code equals labEx.ExaminationCode
                                         where labEx.ExaminationCode == code.ToString()
                                         select labEx).FirstOrDefault();
         return(retVal);
     }
     catch (InvalidOperationException)
     {
         return(null);
     }
 }
Пример #16
0
        public static int UpdateLaboratoryExamination(LaboratoryExamination examination)
        {
            var res = (from el in db.LaboratoryExamination
                       where el.Id == examination.Id
                       select el).FirstOrDefault();

            if (res == null)
            {
                return(0);
            }

            res.dt_Complete_Cancel = examination.dt_Complete_Cancel;
            res.dt_Confirmation    = examination.dt_Confirmation;
            res.Result             = examination.Result;
            res.Status             = examination.Status;
            res.Supervisor_Note    = res.Supervisor_Note;

            return(db.SaveChanges());
        }
Пример #17
0
        private void selectButton_Click(object sender, EventArgs e)
        {
            string name = "";
            string code = "";

            if (ifPhysical)
            {
                PhysicalExamination ex = GetPhysicalExaminationFromGrid();

                if (ex == null)
                {
                    return;
                }

                assignPhysicalExamination(ex);

                name = ex.Examinations.Name;
                code = ex.ExaminationCode;
            }
            else
            {
                LaboratoryExamination ex = GetLaboratoryExaminationFromGrid();

                if (ex == null)
                {
                    return;
                }

                assignLaboratoryExamination(ex);

                name = ex.Examinations.Name;
                code = ex.ExaminationCode;
            }

            codeTextBox.Text = code;
            nameTextBox.Text = name;

            Return();
        }
Пример #18
0
        public DetailedLaboratoryForm(Appointment appointment)
        {
            InitializeComponent();

            InitializeComponent();
            examination                                      = new LaboratoryExamination();
            examination.Appointment                          = appointment;
            examination.AppointmentId                        = appointment.Id;
            examination.LaboratoryPerson                     = new LaboratoryPerson();
            examination.LaboratorySupervisor                 = new LaboratorySupervisor();
            examination.LaboratoryPerson.Employee            = new Employee();
            examination.LaboratorySupervisor.Employee        = new Employee();
            examination.LaboratoryPerson.Employee.Person     = new Person();
            examination.LaboratorySupervisor.Employee.Person = new Person();


            laboratorianPanel.Enabled = false;
            supervisorPanel.Enabled   = false;

            doctorLabel.Text      = appointment.Doctor.Employee.Person.First_Name + " " + appointment.Doctor.Employee.Person.Last_Name;
            patientLabel.Text     = appointment.Patient.Person.First_Name + " " + appointment.Patient.Person.Last_Name;
            requestDateLabel.Text = DateTime.Today.ToString();
        }
 /// <summary>
 /// Schedule laboratory examination
 /// </summary>
 /// <param name="lab">Laboratory examination</param>
 /// <param name="patient">Patient</param>
 /// <param name="doctor">Doctor</param>
 public void Schedule(LaboratoryExamination lab, Patient patient, Doctor doctor)
 {
     lab.ScheduleLabTest(DateTime.Now, doctor, patient);
 }
 /// <summary>
 /// Add laboratory examination to examination list
 /// </summary>
 /// <param name="lab"></param>
 public void addLab(LaboratoryExamination lab)
 {
     labList.Add(lab);
 }
 /// <summary>
 /// Removes examination from list
 /// </summary>
 /// <param name="lab"></param>
 public void removeLab(LaboratoryExamination lab)
 {
     labList.Remove(lab);
 }
 /// <summary>
 /// Perform laboratory examination
 /// </summary>
 /// <param name="lab">Laboratory examination</param>
 /// <param name="patient">Patient</param>
 /// <param name="doctor">Doctor</param>
 public void PerformExamination(LaboratoryExamination lab, Patient patient)
 {
     lab.PerformLabTest(patient);
 }