コード例 #1
0
 private void FillGrids(bool isRefreshNeeded = true)
 {
     if (_patCur == null || gridBugsFixed == null)         //Just in case.
     {
         return;
     }
     gridBugsInProgress.BeginUpdate();
     gridBugsFixed.BeginUpdate();
     gridBugSubmissions.BeginUpdate();
     #region Init Columns
     if (gridBugsFixed.ListGridColumns.Count == 0)
     {
         gridBugsInProgress.ListGridColumns.Add(new GridColumn("Description", -1));
         gridBugsInProgress.ListGridColumns.Add(new GridColumn("Expert", 55, HorizontalAlignment.Center));
         gridBugsInProgress.ListGridColumns.Add(new GridColumn("Has Job", 55, HorizontalAlignment.Center));
         gridBugsFixed.ListGridColumns.Add(new GridColumn("Description", -1));
         gridBugsFixed.ListGridColumns.Add(new GridColumn("Vers.", 55, HorizontalAlignment.Center));
         gridBugsFixed.ListGridColumns.Add(new GridColumn("Has Job", 55, HorizontalAlignment.Center));
         gridBugSubmissions.ListGridColumns.Add(new GridColumn("Description", -1));
         gridBugSubmissions.ListGridColumns.Add(new GridColumn("Vers.", 55, HorizontalAlignment.Center));
         gridBugSubmissions.ListGridColumns.Add(new GridColumn("Has Job", 55, HorizontalAlignment.Center));
     }
     #endregion
     if (isRefreshNeeded)
     {
         List <string> listKeys = RegistrationKeys.GetForPatient(_patCur.PatNum).Select(x => x.RegKey).ToList();
         try {
             _listBugSubs = BugSubmissions.GetBugSubsForRegKeys(listKeys, datePickerHqBugSub.GetDateTimeFrom(), datePickerHqBugSub.GetDateTimeTo());
         }
         catch (Exception ex) {               //Should only occur if running in debug at HQ and no bugs database on local machine.
             ex.DoNothing();
             label1.Text = "NO BUGS DB";      //Inform dev of issue.
         }
         _listJobLinks = JobLinks.GetManyForType(JobLinkType.Bug, _listBugSubs.Select(x => x.BugId).ToList());
         List <long> listNewBugUserIds = _listBugSubs.Where(x => x.BugObj != null && !_dictHqBugSubNames.ContainsKey(x.BugObj.Submitter))
                                         .Select(x => x.BugObj.Submitter).ToList();
         if (listNewBugUserIds.Count > 0)
         {
             Bugs.GetDictSubmitterNames(listNewBugUserIds).ToList()
             .ForEach(x => _dictHqBugSubNames[x.Key] = x.Value);
         }
     }
     gridBugsInProgress.ListGridRows.Clear();
     gridBugsFixed.ListGridRows.Clear();
     gridBugSubmissions.ListGridRows.Clear();
     List <long> listBugNums = new List <long>();        //Keep track of BubIds so that we do not show duplicates.
     foreach (BugSubmission sub in _listBugSubs)
     {
         bool   hasJob     = (_listJobLinks.Any(x => x.FKey == sub.BugObj?.BugId));
         string expertName = (sub.BugObj == null ? "" : _dictHqBugSubNames[sub.BugObj.Submitter].ToUpperFirstOnly());
         if (sub.BugObj != null && !listBugNums.Contains(sub.BugObj.BugId))          //BugSubmission has an associated bug and it is not a duplicate.
         {
             if (string.IsNullOrEmpty(sub.BugObj.VersionsFixed))                     //Bug is not fixed
             {
                 #region In Progress grid
                 listBugNums.Add(sub.BugObj.BugId);
                 GridRow rowBug = new GridRow(sub.BugObj.Description,
                                              expertName,
                                              (hasJob?"X":"")
                                              );
                 rowBug.Tag = sub.BugObj;
                 gridBugsInProgress.ListGridRows.Add(rowBug);
                 #endregion
             }
             else                      //Bug is fixed
             {
                 #region Fixed grid
                 listBugNums.Add(sub.BugObj.BugId);
                 GridRow rowBug = new GridRow(sub.BugObj.Description + "\r\nEXPERT: " + expertName,
                                              sub.BugObj.VersionsFixed.Replace(';', '\n'),
                                              (hasJob?"X":"")
                                              );
                 rowBug.Tag = sub.BugObj;
                 gridBugsFixed.ListGridRows.Add(rowBug);
                 #endregion
             }
         }
         #region All grid
         GridRow rowSub = new GridRow(sub.ExceptionMessageText + "\r\n"
                                      + sub.SubmissionDateTime.ToString("MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture)
                                      + "\r\nEXPERT: " + expertName,
                                      sub.TryGetPrefValue(PrefName.ProgramVersion, "0.0.0.0"),
                                      (hasJob?"X":"")
                                      );
         rowSub.Tag = sub;
         gridBugSubmissions.ListGridRows.Add(rowSub);
         #endregion
     }
     gridBugsInProgress.EndUpdate();
     gridBugsFixed.EndUpdate();
     gridBugSubmissions.EndUpdate();
 }
コード例 #2
0
        public static void FillPtInfo(OpenDental.ContrChart sender, Patient PatCur)
        {
            //first, get all the objects we need. Because they are by ref, the original gets altered.
            ODGrid     gridPtInfo         = (ODGrid)sender.Controls.Find("gridPtInfo", true)[0];
            TabControl tabControlImages   = (TabControl)sender.Controls.Find("tabControlImages", true)[0];
            TextBox    textTreatmentNotes = (TextBox)sender.Controls.Find("textTreatmentNotes", true)[0];
            //bool TreatmentNoteChanged=sender.TreatmentNoteChanged;//might have to do a by ref here?
            //Then get some data that we need
            Family         fam            = null;
            PatientNote    PatientNoteCur = null;
            List <PatPlan> PatPlanList    = null;
            List <InsSub>  SubList        = null;
            List <InsPlan> PlanList       = null;

            if (PatCur != null)
            {
                fam            = Patients.GetFamily(PatCur.PatNum);
                PatientNoteCur = PatientNotes.Refresh(PatCur.PatNum, PatCur.Guarantor);
                PatPlanList    = PatPlans.Refresh(PatCur.PatNum);
                SubList        = InsSubs.RefreshForFam(fam);
                PlanList       = InsPlans.RefreshForSubList(SubList);
            }
            //Then, continue with the slightly altered original method.
            gridPtInfo.Height       = tabControlImages.Top - gridPtInfo.Top;
            textTreatmentNotes.Text = "";
            if (PatCur != null)
            {
                textTreatmentNotes.Text    = PatientNoteCur.Treatment;
                textTreatmentNotes.Enabled = true;
                textTreatmentNotes.Select(textTreatmentNotes.Text.Length + 2, 1);
                textTreatmentNotes.ScrollToCaret();
                sender.TreatmentNoteChanged = false;
            }
            gridPtInfo.BeginUpdate();
            gridPtInfo.Columns.Clear();
            ODGridColumn col = new ODGridColumn("", 100);         //Lan.g("TableChartPtInfo",""),);

            gridPtInfo.Columns.Add(col);
            col = new ODGridColumn("", 300);
            gridPtInfo.Columns.Add(col);
            gridPtInfo.Rows.Clear();
            if (PatCur == null)
            {
                gridPtInfo.EndUpdate();
                return;
            }
            ODGridRow row;

            //Age
            row = new ODGridRow();
            row.Cells.Add("Age");
            row.Cells.Add(PatientLogic.DateToAgeString(PatCur.Birthdate));
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //Credit type
            row = new ODGridRow();
            row.Cells.Add(Lan.g("TableChartPtInfo", "ABC0"));
            row.Cells.Add(PatCur.CreditType);
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //Billing type
            row = new ODGridRow();
            row.Cells.Add(Lan.g("TableChartPtInfo", "Billing Type"));
            row.Cells.Add(DefC.GetName(DefCat.BillingTypes, PatCur.BillingType));
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //Referrals
            RefAttach[] RefAttachList = RefAttaches.Refresh(PatCur.PatNum);
            for (int i = 0; i < RefAttachList.Length; i++)
            {
                row            = new ODGridRow();
                row.ColorBackG = Color.Aquamarine;
                if (RefAttachList[i].IsFrom)
                {
                    row.Cells.Add("Referred From");
                }
                else
                {
                    row.Cells.Add("Referred To");
                }
                row.Cells.Add(Referrals.GetNameLF(RefAttachList[i].ReferralNum));
                row.Tag = null;
                gridPtInfo.Rows.Add(row);
            }
            //Date First Visit
            row = new ODGridRow();
            row.Cells.Add(Lan.g("TableChartPtInfo", "Date First Visit"));
            if (PatCur.DateFirstVisit.Year < 1880)
            {
                row.Cells.Add("??");
            }
            else if (PatCur.DateFirstVisit == DateTime.Today)
            {
                row.Cells.Add(Lan.g("TableChartPtInfo", "NEW PAT"));
            }
            else
            {
                row.Cells.Add(PatCur.DateFirstVisit.ToShortDateString());
            }
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //Prov - Pri & Sec
            row = new ODGridRow();
            row.Cells.Add(Lan.g("TableChartPtInfo", "Prov. (Pri, Sec)"));
            if (PatCur.SecProv != 0)
            {
                row.Cells.Add(Providers.GetAbbr(PatCur.PriProv) + ", " + Providers.GetAbbr(PatCur.SecProv));
            }
            else
            {
                row.Cells.Add(Providers.GetAbbr(PatCur.PriProv) + ", " + "None");
            }
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //PriIns
            row = new ODGridRow();
            row.Cells.Add(Lan.g("TableChartPtInfo", "Pri Ins"));
            string name;

            if (PatPlanList.Count > 0)
            {
                name = InsPlans.GetCarrierName(PatPlans.GetPlanNum(PatPlanList, 1), PlanList);
                if (PatPlanList[0].IsPending)
                {
                    name += Lan.g("TableChartPtInfo", " (pending)");
                }
                row.Cells.Add(name);
            }
            else
            {
                row.Cells.Add("");
            }
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //SecIns
            row = new ODGridRow();
            row.Cells.Add(Lan.g("TableChartPtInfo", "Sec Ins"));
            if (PatPlanList.Count > 1)
            {
                name = InsPlans.GetCarrierName(PatPlans.GetPlanNum(PatPlanList, 2), PlanList);
                if (PatPlanList[1].IsPending)
                {
                    name += Lan.g("TableChartPtInfo", " (pending)");
                }
                row.Cells.Add(name);
            }
            else
            {
                row.Cells.Add("");
            }
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //Registration keys-------------------------------------------------------------------------------------------
            if (PrefC.GetBool(PrefName.DistributorKey))
            {
                RegistrationKey[] keys = RegistrationKeys.GetForPatient(PatCur.PatNum);
                for (int i = 0; i < keys.Length; i++)
                {
                    row = new ODGridRow();
                    row.Cells.Add(Lan.g("TableChartPtInfo", "Registration Key"));
                    string str = keys[i].RegKey.Substring(0, 4) + "-" + keys[i].RegKey.Substring(4, 4) + "-" +
                                 keys[i].RegKey.Substring(8, 4) + "-" + keys[i].RegKey.Substring(12, 4);
                    if (keys[i].IsForeign)
                    {
                        str += "\r\nForeign";
                    }
                    else
                    {
                        str += "\r\nUSA";
                    }
                    str += "\r\nStarted: " + keys[i].DateStarted.ToShortDateString();
                    if (keys[i].DateDisabled.Year > 1880)
                    {
                        str += "\r\nDisabled: " + keys[i].DateDisabled.ToShortDateString();
                    }
                    if (keys[i].DateEnded.Year > 1880)
                    {
                        str += "\r\nEnded: " + keys[i].DateEnded.ToShortDateString();
                    }
                    if (keys[i].Note != "")
                    {
                        str += keys[i].Note;
                    }
                    row.Cells.Add(str);
                    row.Tag = keys[i].Copy();
                    gridPtInfo.Rows.Add(row);
                }
            }
            ODGridCell cell;
            //medical fields-----------------------------------------------------------------
            bool showMed = true;

            if (Programs.IsEnabled(ProgramName.eClinicalWorks) && ProgramProperties.GetPropVal(ProgramName.eClinicalWorks, "IsStandalone") == "0")
            {
                showMed = false;
            }
            if (showMed)
            {
                //premed flag.
                if (PatCur.Premed)
                {
                    row = new ODGridRow();
                    row.Cells.Add("");
                    cell           = new ODGridCell();
                    cell.Text      = Lan.g("TableChartPtInfo", "Premedicate");
                    cell.ColorText = Color.Red;
                    cell.Bold      = YN.Yes;
                    row.Cells.Add(cell);
                    row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                    row.Tag        = "med";
                    gridPtInfo.Rows.Add(row);
                }
                //diseases
                Disease[] DiseaseList = Diseases.Refresh(PatCur.PatNum);
                row       = new ODGridRow();
                cell      = new ODGridCell(Lan.g("TableChartPtInfo", "Diseases"));
                cell.Bold = YN.Yes;
                row.Cells.Add(cell);
                if (DiseaseList.Length > 0)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(Lan.g("TableChartPtInfo", "none"));
                }
                row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                row.Tag        = "med";
                gridPtInfo.Rows.Add(row);
                for (int i = 0; i < DiseaseList.Length; i++)
                {
                    row            = new ODGridRow();
                    cell           = new ODGridCell(DiseaseDefs.GetName(DiseaseList[i].DiseaseDefNum));
                    cell.ColorText = Color.Red;
                    cell.Bold      = YN.Yes;
                    row.Cells.Add(cell);
                    row.Cells.Add(DiseaseList[i].PatNote);
                    row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                    row.Tag        = "med";
                    gridPtInfo.Rows.Add(row);
                }
                //MedUrgNote
                row = new ODGridRow();
                row.Cells.Add(Lan.g("TableChartPtInfo", "Med Urgent"));
                cell           = new ODGridCell();
                cell.Text      = PatCur.MedUrgNote;
                cell.ColorText = Color.Red;
                cell.Bold      = YN.Yes;
                row.Cells.Add(cell);
                row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                row.Tag        = "med";
                gridPtInfo.Rows.Add(row);
                //Medical
                row = new ODGridRow();
                row.Cells.Add(Lan.g("TableChartPtInfo", "Medical Summary"));
                row.Cells.Add(PatientNoteCur.Medical);
                row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                row.Tag        = "med";
                gridPtInfo.Rows.Add(row);
                //Service
                row = new ODGridRow();
                row.Cells.Add(Lan.g("TableChartPtInfo", "Service Notes"));
                row.Cells.Add(PatientNoteCur.Service);
                row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                row.Tag        = "med";
                gridPtInfo.Rows.Add(row);
                //medications
                Medications.Refresh();
                MedicationPats.Refresh(PatCur.PatNum);
                row       = new ODGridRow();
                cell      = new ODGridCell(Lan.g("TableChartPtInfo", "Medications"));
                cell.Bold = YN.Yes;
                row.Cells.Add(cell);
                if (MedicationPats.List.Length > 0)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(Lan.g("TableChartPtInfo", "none"));
                }
                row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                row.Tag        = "med";
                gridPtInfo.Rows.Add(row);
                string     text;
                Medication med;
                for (int i = 0; i < MedicationPats.List.Length; i++)
                {
                    row  = new ODGridRow();
                    med  = Medications.GetMedication(MedicationPats.List[i].MedicationNum);
                    text = med.MedName;
                    if (med.MedicationNum != med.GenericNum)
                    {
                        text += "(" + Medications.GetMedication(med.GenericNum).MedName + ")";
                    }
                    row.Cells.Add(text);
                    text = MedicationPats.List[i].PatNote
                           + "(" + Medications.GetGeneric(MedicationPats.List[i].MedicationNum).Notes + ")";
                    row.Cells.Add(text);
                    row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                    row.Tag        = "med";
                    gridPtInfo.Rows.Add(row);
                }
            }            //if !eCW.enabled
            gridPtInfo.EndUpdate();
        }