Example #1
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     if (!MsgBox.Show(this, true, "Delete this entire Laboratory?"))
     {
         return;
     }
     try{
         Laboratories.Delete(LabCur.LaboratoryNum);
         DialogResult = DialogResult.OK;
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
     }
 }
Example #2
0
        private void FillGrid()
        {
            labCaseList = LabCases.GetForPat(PatNum, IsPlanned);
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn(Lan.g("TableLabCaseSelect", "Date Created"), 80);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableLabCaseSelect", "Lab"), 100);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableLabCaseSelect", "Phone"), 100);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableLabCaseSelect", "Instructions"), 200);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow    row;
            DateTime   dateCreated;
            Laboratory lab;

            foreach (LabCase labCase in labCaseList)
            {
                row         = new GridRow();
                dateCreated = labCase.DateTimeCreated;
                row.Cells.Add(dateCreated.ToString("ddd") + " " + dateCreated.ToShortDateString() + " " + dateCreated.ToShortTimeString());
                lab = Laboratories.GetOne(labCase.LaboratoryNum);
                if (lab == null)               //Lab wasn't found in the db, but we only require the LabCaseNum later.
                {
                    row.Cells.Add(Lan.g(this, "Lab Not Found"));
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(lab.Description);
                    row.Cells.Add(lab.Phone);
                }
                row.Cells.Add(labCase.Instructions);
                row.Tag = labCase;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDescription.Text == "")
     {
         MsgBox.Show(this, "Description cannot be blank.");
         return;
     }
     LabCur.Description   = textDescription.Text;
     LabCur.Phone         = textPhone.Text;
     LabCur.WirelessPhone = textWirelessPhone.Text;
     LabCur.Address       = textAddress.Text;
     LabCur.City          = textCity.Text;
     LabCur.State         = textState.Text;
     LabCur.Zip           = textZip.Text;
     LabCur.Email         = textEmail.Text;
     LabCur.Notes         = textNotes.Text;
     LabCur.Slip          = 0;
     LabCur.IsHidden      = checkIsHidden.Checked;
     if (comboSlip.SelectedIndex > 0)
     {
         LabCur.Slip = SlipList[comboSlip.SelectedIndex - 1].SheetDefNum;
     }
     try{
         if (IsNew)
         {
             Laboratories.Insert(LabCur);
         }
         else
         {
             Laboratories.Update(LabCur);
         }
         LabTurnarounds.SetForLab(LabCur.LaboratoryNum, turnaroundList);
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
Example #4
0
        private void FormLabCaseEdit_Load(object sender, System.EventArgs e)
        {
            textPatient.Text = Patients.GetPat(CaseCur.PatNum).GetNameFL();
            ListLabs         = Laboratories.Refresh();
            for (int i = 0; i < ListLabs.Count; i++)
            {
                listLab.Items.Add(ListLabs[i].Description + " " + ListLabs[i].Phone);
                if (ListLabs[i].LaboratoryNum == CaseCur.LaboratoryNum)
                {
                    listLab.SelectedIndex = i;
                }
            }
            for (int i = 0; i < Providers.List.Length; i++)
            {
                comboProv.Items.Add(Providers.List[i].Abbr);
                if (Providers.List[i].ProvNum == CaseCur.ProvNum)
                {
                    comboProv.SelectedIndex = i;
                }
            }
            Appointment apt = Appointments.GetOneApt(CaseCur.AptNum);

            if (apt != null)
            {
                if (apt.AptStatus == ApptStatus.UnschedList)
                {
                    textAppointment.Text = Lan.g(this, "Unscheduled");
                }
                else
                {
                    textAppointment.Text = apt.AptDateTime.ToShortDateString() + " " + apt.AptDateTime.ToShortTimeString();
                }
                textAppointment.Text += ", " + apt.ProcDescript;
            }
            apt = Appointments.GetOneApt(CaseCur.PlannedAptNum);
            if (apt != null)
            {
                textPlanned.Text = apt.ProcDescript;
                if (textPlanned.Text == "")
                {
                    textPlanned.Text = Lan.g(this, "Attached");
                }
            }
            if (CaseCur.DateTimeCreated.Year > 1880)
            {
                textDateCreated.Text = CaseCur.DateTimeCreated.ToString();
            }
            if (CaseCur.DateTimeSent.Year > 1880)
            {
                textDateSent.Text = CaseCur.DateTimeSent.ToString();
            }
            if (CaseCur.DateTimeRecd.Year > 1880)
            {
                textDateRecd.Text = CaseCur.DateTimeRecd.ToString();
            }
            if (CaseCur.DateTimeChecked.Year > 1880)
            {
                textDateChecked.Text = CaseCur.DateTimeChecked.ToString();
            }
            if (CaseCur.DateTimeDue.Year > 1880)
            {
                textDateDue.Text = CaseCur.DateTimeDue.ToShortDateString() + " " + CaseCur.DateTimeDue.ToShortTimeString();
            }
            textInstructions.Text = CaseCur.Instructions;
        }
Example #5
0
        private void FormLabCaseEdit_Load(object sender, System.EventArgs e)
        {
            if (Plugins.HookMethod(this, "FormLabCaseEdit.Load_start", CaseCur, IsNew))
            {
                return;
            }
            textPatient.Text = Patients.GetPat(CaseCur.PatNum).GetNameFL();
            ListLabs         = Laboratories.Refresh();
            for (int i = 0; i < ListLabs.Count; i++)
            {
                listLab.Items.Add(ListLabs[i].Description + " " + ListLabs[i].Phone);
                if (ListLabs[i].LaboratoryNum == CaseCur.LaboratoryNum)
                {
                    listLab.SelectedIndex = i;
                }
            }
            _listProviders = Providers.GetDeepCopy(true);
            for (int i = 0; i < _listProviders.Count; i++)
            {
                comboProv.Items.Add(_listProviders[i].Abbr);
                if (_listProviders[i].ProvNum == CaseCur.ProvNum)
                {
                    comboProv.SelectedIndex = i;
                }
            }
            Appointment apt = Appointments.GetOneApt(CaseCur.AptNum);

            if (apt != null)
            {
                if (apt.AptStatus == ApptStatus.UnschedList)
                {
                    textAppointment.Text = Lan.g(this, "Unscheduled");
                }
                else
                {
                    textAppointment.Text = apt.AptDateTime.ToShortDateString() + " " + apt.AptDateTime.ToShortTimeString();
                }
                textAppointment.Text += ", " + apt.ProcDescript;
            }
            apt = Appointments.GetOneApt(CaseCur.PlannedAptNum);
            if (apt != null)
            {
                textPlanned.Text = apt.ProcDescript;
                if (textPlanned.Text == "")
                {
                    textPlanned.Text = Lan.g(this, "Attached");
                }
            }
            if (CaseCur.DateTimeCreated.Year > 1880)
            {
                textDateCreated.Text = CaseCur.DateTimeCreated.ToString();
            }
            if (CaseCur.DateTimeSent.Year > 1880)
            {
                textDateSent.Text = CaseCur.DateTimeSent.ToString();
            }
            if (CaseCur.DateTimeRecd.Year > 1880)
            {
                textDateRecd.Text = CaseCur.DateTimeRecd.ToString();
            }
            if (CaseCur.DateTimeChecked.Year > 1880)
            {
                textDateChecked.Text = CaseCur.DateTimeChecked.ToString();
            }
            if (CaseCur.DateTimeDue.Year > 1880)
            {
                textDateDue.Text = CaseCur.DateTimeDue.ToShortDateString() + " " + CaseCur.DateTimeDue.ToShortTimeString();
            }
            textInstructions.Text = CaseCur.Instructions;
            textLabFee.Text       = CaseCur.LabFee.ToString("n");
            sheet = Sheets.GetLabSlip(CaseCur.PatNum, CaseCur.LabCaseNum);
            if (sheet == null)
            {
                butSlip.Text = Lan.g(this, "New Slip");
            }
            else
            {
                butSlip.Text = Lan.g(this, "Edit Slip");
            }
            Plugins.HookAddCode(this, "FormLabCaseEdit.Load_end", CaseCur, IsNew);
        }
Example #6
0
        private void FormLabCaseEdit_Load(object sender, System.EventArgs e)
        {
            if (Plugins.HookMethod(this, "FormLabCaseEdit.Load_start", CaseCur, IsNew))
            {
                return;
            }
            if (CaseCur == null)
            {
                MsgBox.Show(this, "Lab case no longer exists.");
                DialogResult = DialogResult.Abort;              //Results in form closing logic
                return;
            }
            Patient pat = Patients.GetPat(CaseCur.PatNum);

            //If pat is null, this can trickle down and allow the user to create a lab sheet with a FK to an invalid Patient.
            if (pat == null)
            {
                MsgBox.Show(this, "There is no valid Patient attached to this Labcase.");
                DialogResult = DialogResult.Abort;              //Results in form closing logic
                return;
            }
            textPatient.Text = pat.GetNameFL();
            ListLabs         = Laboratories.Refresh();
            //Include the current lab, even if it is hidden.
            ListLabs = ListLabs.Where(x => x.LaboratoryNum == CaseCur.LaboratoryNum || !x.IsHidden).ToList();
            for (int i = 0; i < ListLabs.Count; i++)
            {
                listLab.Items.Add(ListLabs[i].Description + " " + ListLabs[i].Phone);
                if (ListLabs[i].LaboratoryNum == CaseCur.LaboratoryNum)
                {
                    listLab.SelectedIndex = i;
                }
            }
            _listProviders = Providers.GetDeepCopy(true);
            for (int i = 0; i < _listProviders.Count; i++)
            {
                comboProv.Items.Add(_listProviders[i].Abbr);
                if (_listProviders[i].ProvNum == CaseCur.ProvNum)
                {
                    comboProv.SelectedIndex = i;
                }
            }
            Appointment apt = Appointments.GetOneApt(CaseCur.AptNum);

            if (apt != null)
            {
                if (apt.AptStatus == ApptStatus.UnschedList)
                {
                    textAppointment.Text = Lan.g(this, "Unscheduled");
                }
                else
                {
                    textAppointment.Text = apt.AptDateTime.ToShortDateString() + " " + apt.AptDateTime.ToShortTimeString();
                }
                textAppointment.Text += ", " + apt.ProcDescript;
            }
            apt = Appointments.GetOneApt(CaseCur.PlannedAptNum);
            if (apt != null)
            {
                textPlanned.Text = apt.ProcDescript;
                if (textPlanned.Text == "")
                {
                    textPlanned.Text = Lan.g(this, "Attached");
                }
            }
            if (CaseCur.DateTimeCreated.Year > 1880)
            {
                textDateCreated.Text = CaseCur.DateTimeCreated.ToString();
            }
            if (CaseCur.DateTimeSent.Year > 1880)
            {
                textDateSent.Text = CaseCur.DateTimeSent.ToString();
            }
            if (CaseCur.DateTimeRecd.Year > 1880)
            {
                textDateRecd.Text = CaseCur.DateTimeRecd.ToString();
            }
            if (CaseCur.DateTimeChecked.Year > 1880)
            {
                textDateChecked.Text = CaseCur.DateTimeChecked.ToString();
            }
            if (CaseCur.DateTimeDue.Year > 1880)
            {
                textDateDue.Text = CaseCur.DateTimeDue.ToShortDateString() + " " + CaseCur.DateTimeDue.ToShortTimeString();
            }
            textInstructions.Text = CaseCur.Instructions;
            textLabFee.Text       = CaseCur.LabFee.ToString("n");
            sheet = Sheets.GetLabSlip(CaseCur.PatNum, CaseCur.LabCaseNum);
            if (sheet == null)
            {
                butSlip.Text = Lan.g(this, "New Slip");
            }
            else
            {
                butSlip.Text = Lan.g(this, "Edit Slip");
            }
            textInvoiceNumber.Text = CaseCur.InvoiceNum;
            Plugins.HookAddCode(this, "FormLabCaseEdit.Load_end", CaseCur, IsNew);
        }