コード例 #1
0
 public void ODtextBox_SpellCheck_WavyLinesEnd()
 {
     //Make a tiny text box (100 pixels wide and 50 pixels tall) and put a decent amount of misspelled text inside.
     using (ODtextBox textBox = GetTextBox(LoremIpsum, 100, 50)) {
         //Make sure that the end of the text box has focus.
         textBox.Select((LoremIpsum.Length - 1), 0);
         textBox.ScrollToCaret();
         ODtextBox.SpellCheckResult spellCheckResult = textBox.SpellCheck();
         //This particular test should always have 7 misspelled words, 9 visible words, 4 visible line heights, 4 wavy line rects, 4 wavy lines
         Assert.AreEqual(spellCheckResult.ListMisspelledWords.Count, 7);
         //The misspelled words should be exactly "culpa", "qui", "officia", "deserunt", "mollit", "anim", "laborum"
         List <ODtextBox.MatchOD> listMisspelledWords = new List <ODtextBox.MatchOD>()
         {
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 391, Value = "culpa"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 397, Value = "qui"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 401, Value = "officia"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 409, Value = "deserunt"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 418, Value = "mollit"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 425, Value = "anim"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 437, Value = "laborum"
             },
         };
         for (int i = 0; i < listMisspelledWords.Count; i++)
         {
             Assert.AreEqual(spellCheckResult.ListMisspelledWords[i].Value, listMisspelledWords[i].Value);
             Assert.AreEqual(spellCheckResult.ListMisspelledWords[i].StartCharIndex, listMisspelledWords[i].StartCharIndex);
         }
         Assert.AreEqual(spellCheckResult.ListVisibleWords.Count, 9);
         Assert.AreEqual(spellCheckResult.ListVisibleLineHeights.Count, 4);
         Assert.AreEqual(spellCheckResult.WavyLineArea.ListWavyLineRects.Count, 4);
         Assert.AreEqual(spellCheckResult.WavyLineArea.ListWavyLines.Count, 4);
         Assert.AreEqual(spellCheckResult.WavyLineArea.endCharIndex, 444);
         Assert.AreEqual(spellCheckResult.WavyLineArea.startCharIndex, 391);
         Assert.AreEqual(spellCheckResult.WavyLineArea.startLineIndex, 28);
     }
 }
コード例 #2
0
 public void ODtextBox_SpellCheck_WavyLinesBeginning()
 {
     //Make a tiny text box (100 pixels wide and 50 pixels tall) and put a decent amount of misspelled text inside.
     using (ODtextBox textBox = GetTextBox(LoremIpsum, 100, 50)) {
         //Make sure that the beginning of the text box has focus.
         textBox.Select(0, 0);
         textBox.ScrollToCaret();
         ODtextBox.SpellCheckResult spellCheckResult = textBox.SpellCheck();
         //This particular test should always have 6 misspelled words, 8 visible words, 5 visible line heights, 3 wavy line rects, 4 wavy lines
         Assert.AreEqual(spellCheckResult.ListMisspelledWords.Count, 6);
         //The misspelled words should be exactly "Lorem", "ipsum", "amet", "consectetur", "adipiscing", "elit"
         List <ODtextBox.MatchOD> listMisspelledWords = new List <ODtextBox.MatchOD>()
         {
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 0, Value = "Lorem"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 6, Value = "ipsum"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 22, Value = "amet"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 28, Value = "consectetur"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 40, Value = "adipiscing"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 51, Value = "elit"
             },
         };
         for (int i = 0; i < listMisspelledWords.Count; i++)
         {
             Assert.AreEqual(spellCheckResult.ListMisspelledWords[i].Value, listMisspelledWords[i].Value);
             Assert.AreEqual(spellCheckResult.ListMisspelledWords[i].StartCharIndex, listMisspelledWords[i].StartCharIndex);
         }
         Assert.AreEqual(spellCheckResult.ListVisibleWords.Count, 8);
         Assert.AreEqual(spellCheckResult.ListVisibleLineHeights.Count, 5);
         Assert.AreEqual(spellCheckResult.WavyLineArea.ListWavyLineRects.Count, 3);
         Assert.AreEqual(spellCheckResult.WavyLineArea.ListWavyLines.Count, 4);
         Assert.AreEqual(spellCheckResult.WavyLineArea.endCharIndex, 57);
         Assert.AreEqual(spellCheckResult.WavyLineArea.startCharIndex, 0);
         Assert.AreEqual(spellCheckResult.WavyLineArea.startLineIndex, 0);
     }
 }
コード例 #3
0
 public void ODtextBox_SpellCheck_WavyLinesMiddle()
 {
     //Make a tiny text box (100 pixels wide and 50 pixels tall) and put a decent amount of misspelled text inside.
     using (ODtextBox textBox = GetTextBox(LoremIpsum, 100, 50)) {
         //Make sure that the middle of the text box has focus.
         textBox.Select((LoremIpsum.Length / 2), 0);
         textBox.ScrollToCaret();
         ODtextBox.SpellCheckResult spellCheckResult = textBox.SpellCheck();
         //This particular test should always have 6 misspelled words, 10 visible words, 6 visible line heights, 4 wavy line rects, 4 wavy lines
         Assert.AreEqual(spellCheckResult.ListMisspelledWords.Count, 6);
         //The misspelled words should be exactly "commodo", "consequat", "Duis", "aute", "irure", "reprehenderit"
         List <ODtextBox.MatchOD> listMisspelledWords = new List <ODtextBox.MatchOD>()
         {
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 213, Value = "commodo"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 221, Value = "consequat"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 232, Value = "Duis"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 237, Value = "aute"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 242, Value = "irure"
             },
             new ODtextBox.MatchOD()
             {
                 StartCharIndex = 257, Value = "reprehenderit"
             },
         };
         for (int i = 0; i < listMisspelledWords.Count; i++)
         {
             Assert.AreEqual(spellCheckResult.ListMisspelledWords[i].Value, listMisspelledWords[i].Value);
             Assert.AreEqual(spellCheckResult.ListMisspelledWords[i].StartCharIndex, listMisspelledWords[i].StartCharIndex);
         }
         Assert.AreEqual(spellCheckResult.ListVisibleWords.Count, 10);
         Assert.AreEqual(spellCheckResult.ListVisibleLineHeights.Count, 6);
         Assert.AreEqual(spellCheckResult.WavyLineArea.ListWavyLineRects.Count, 4);
         Assert.AreEqual(spellCheckResult.WavyLineArea.ListWavyLines.Count, 4);
         Assert.AreEqual(spellCheckResult.WavyLineArea.endCharIndex, 274);
         Assert.AreEqual(spellCheckResult.WavyLineArea.startCharIndex, 210);
         Assert.AreEqual(spellCheckResult.WavyLineArea.startLineIndex, 15);
     }
 }
コード例 #4
0
ファイル: ContrChartP.cs プロジェクト: royedwards/DRDNet
        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];
            ODtextBox  textTreatmentNotes = (ODtextBox)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(Defs.GetName(DefCat.BillingTypes, PatCur.BillingType));
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //Referrals
            List <RefAttach> RefAttachList = RefAttaches.Refresh(PatCur.PatNum);

            for (int i = 0; i < RefAttachList.Count; i++)
            {
                row            = new ODGridRow();
                row.ColorBackG = Color.Aquamarine;
                if (RefAttachList[i].RefType == ReferralType.RefFrom)
                {
                    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(InsSubs.GetOne(PatPlanList[0].InsSubNum).PlanNum, 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(InsSubs.GetOne(PatPlanList[1].InsSubNum).PlanNum, 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)
            {
                //Get the Chart Module Medical color from the MiscColors category.
                Color colorChartModuleMedical = Defs.GetDefsForCategory(DefCat.MiscColors)[3].ItemColor;
                //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 = colorChartModuleMedical;
                    row.Tag        = "med";
                    gridPtInfo.Rows.Add(row);
                }
                //diseases
                List <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.Count > 0)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(Lan.g("TableChartPtInfo", "none"));
                }
                row.ColorBackG = colorChartModuleMedical;
                row.Tag        = "med";
                gridPtInfo.Rows.Add(row);
                for (int i = 0; i < DiseaseList.Count; 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 = colorChartModuleMedical;
                    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 = colorChartModuleMedical;
                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 = colorChartModuleMedical;
                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 = colorChartModuleMedical;
                row.Tag        = "med";
                gridPtInfo.Rows.Add(row);
                //medications
                Medications.RefreshCache();
                List <MedicationPat> medList = MedicationPats.Refresh(PatCur.PatNum, false);
                row       = new ODGridRow();
                cell      = new ODGridCell(Lan.g("TableChartPtInfo", "Medications"));
                cell.Bold = YN.Yes;
                row.Cells.Add(cell);
                if (medList.Count > 0)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(Lan.g("TableChartPtInfo", "none"));
                }
                row.ColorBackG = colorChartModuleMedical;
                row.Tag        = "med";
                gridPtInfo.Rows.Add(row);
                string     text;
                Medication med;
                for (int i = 0; i < medList.Count; i++)
                {
                    row  = new ODGridRow();
                    med  = Medications.GetMedication(medList[i].MedicationNum);
                    text = med.MedName;
                    if (med.MedicationNum != med.GenericNum)
                    {
                        text += "(" + Medications.GetMedication(med.GenericNum).MedName + ")";
                    }
                    row.Cells.Add(text);
                    text = medList[i].PatNote
                           + "(" + Medications.GetGeneric(medList[i].MedicationNum).Notes + ")";
                    row.Cells.Add(text);
                    row.ColorBackG = colorChartModuleMedical;
                    row.Tag        = "med";
                    gridPtInfo.Rows.Add(row);
                }
            }            //if !eCW.enabled
            gridPtInfo.EndUpdate();
        }