Esempio n. 1
0
        private void FillElectIDs(long electIDSelect)
        {
            ElectIDs.RefreshCache();
            _listElectIDs = ElectIDs.GetDeepCopy();
            gridElectIDs.BeginUpdate();
            gridElectIDs.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableApptProcs", "Carrier"), 320);

            gridElectIDs.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableApptProcs", "Payer ID"), 80);
            gridElectIDs.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableApptProcs", "Is Medicaid"), 70, HorizontalAlignment.Center);
            gridElectIDs.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableApptProcs", "Comments"), 390);
            gridElectIDs.Columns.Add(col);
            gridElectIDs.Rows.Clear();
            ODGridRow row;
            int       selectedIndex = -1;

            for (int i = 0; i < _listElectIDs.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_listElectIDs[i].CarrierName);
                row.Cells.Add(_listElectIDs[i].PayorID);
                row.Cells.Add(_listElectIDs[i].IsMedicaid?"X":"");
                row.Cells.Add(_listElectIDs[i].Comments);
                gridElectIDs.Rows.Add(row);
                if (_listElectIDs[i].ElectIDNum == electIDSelect)
                {
                    selectedIndex = i;
                }
            }
            gridElectIDs.EndUpdate();
            gridElectIDs.SetSelected(selectedIndex, true);
        }
Esempio n. 2
0
 private void butUp_Click(object sender, EventArgs e)
 {
     if (gridMain.SelectedIndices.Length == 0)
     {
         MsgBox.Show(this, "Please select an item in the grid first.");
         return;
     }
     int[] selected = new int[gridMain.SelectedIndices.Length];
     Array.Copy(gridMain.SelectedIndices, selected, gridMain.SelectedIndices.Length);
     if (selected[0] == 0)
     {
         return;
     }
     for (int i = 0; i < selected.Length; i++)
     {
         _listPatFieldDefs.Reverse(selected[i] - 1, 2);
     }
     for (int i = 0; i < _listPatFieldDefs.Count; i++)
     {
         _listPatFieldDefs[i].ItemOrder = i;              //change itemOrder to reflect order changes.
     }
     FillGrid();
     for (int i = 0; i < selected.Length; i++)
     {
         gridMain.SetSelected(selected[i] - 1, true);
     }
     _hasChanged = true;
 }
Esempio n. 3
0
        private void FillGrid(bool refreshList = true, bool isScrollToSelection = true)
        {
            if (refreshList)
            {
                _listQueries = UserQueries.GetDeepCopy();
            }
            string[] strSearchTerms = Regex.Split(textSearch.Text, @"\W");           //matches any non-word character
            //get all queries that contain ALL of the search terms entered, either in the query text or the query description.
            List <UserQuery> listDisplayQueries = _listQueries
                                                  .Where(x => strSearchTerms.All(y =>
                                                                                 x.QueryText.ToLowerInvariant().Contains(y.ToLowerInvariant()) || x.Description.ToLowerInvariant().Contains(y.ToLowerInvariant())
                                                                                 )).ToList();
            //attempt to preserve the currently selected query.
            long selectedQueryNum = 0;

            if (gridMain.GetSelectedIndex() != -1)
            {
                selectedQueryNum = gridMain.SelectedTag <UserQuery>().QueryNum;
            }
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g(gridMain.TranslationName, "Query"), 350));
            if (Security.IsAuthorized(Permissions.UserQueryAdmin, true))
            {
                gridMain.ListGridColumns.Add(new GridColumn(Lan.g(gridMain.TranslationName, "Released"), 55, HorizontalAlignment.Center));
            }
            gridMain.ListGridRows.Clear();
            foreach (UserQuery queryCur in listDisplayQueries)
            {
                if (!Security.IsAuthorized(Permissions.UserQueryAdmin, true) && !queryCur.IsReleased)
                {
                    continue;                     //non-released queries only appear for people with UserQueryAdmin permission.
                }
                GridRow row = new GridRow();
                row.Cells.Add(queryCur.Description);
                if (Security.IsAuthorized(Permissions.UserQueryAdmin, true))
                {
                    row.Cells.Add(queryCur.IsReleased ? "X" : "");
                }
                row.Tag = queryCur;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
            int selectedIdx = gridMain.ListGridRows.Select(x => (UserQuery)x.Tag).ToList().FindIndex(y => y.QueryNum == selectedQueryNum);

            if (selectedIdx > -1)
            {
                gridMain.SetSelected(selectedIdx, true);
            }
            if (gridMain.GetSelectedIndex() == -1)
            {
                gridMain.SetSelected(0, true);                //can handle values outside of the row count (so if there are no rows, this will not fail)
            }
            if (isScrollToSelection)
            {
                gridMain.ScrollToIndex(gridMain.GetSelectedIndex());                 //can handle values outside of the row count
            }
            RefreshQueryCur();
        }
 private void FillAttachments()
 {
     gridAttachments.BeginUpdate();
     gridAttachments.Rows.Clear();
     gridAttachments.Columns.Clear();
     gridAttachments.Columns.Add(new OpenDental.UI.ODGridColumn("", 0));           //No name column, since there is only one column.
     foreach (EmailAttach attachment in _listEmailAttachDisplayed)
     {
         ODGridRow row = new ODGridRow();
         row.Cells.Add(attachment.DisplayedFileName);
         gridAttachments.Rows.Add(row);
     }
     gridAttachments.EndUpdate();
     if (gridAttachments.Rows.Count > 0)
     {
         gridAttachments.SetSelected(0, true);
     }
 }
Esempio n. 5
0
 private void FormClinics_Load(object sender, System.EventArgs e)
 {
     if (ListClinics == null)
     {
         ListClinics = Clinics.GetAllForUserod(Security.CurUser);
     }
     if (_listClinicDefLinksAll == null)
     {
         _listClinicDefLinksAll = DefLinks.GetDefLinksByType(DefLinkType.Clinic);
     }
     ListClinicsOld                 = ListClinics.Select(x => x.Copy()).ToList();
     _listClinicDefLinksAllOld      = _listClinicDefLinksAll.Select(x => x.Copy()).ToList();
     _listDefLinkClinicSpecialties  = GetDefLinkClinicList();
     _listClinicSpecialtyDefs       = Defs.GetDefsForCategory(DefCat.ClinicSpecialty);
     checkOrderAlphabetical.Checked = PrefC.GetBool(PrefName.ClinicListIsAlphabetical);
     _dictClinicalCounts            = Clinics.GetClinicalPatientCount();
     if (IsSelectionMode)
     {
         butAdd.Visible           = false;
         butOK.Visible            = true;
         groupClinicOrder.Visible = false;
         groupMovePats.Visible    = false;
         int widthDiff = (groupClinicOrder.Width - butOK.Width);
         this.MinimumSize        = new Size(this.MinimumSize.Width - widthDiff, this.MinimumSize.Height);
         this.Width             -= widthDiff;
         gridMain.Width         += widthDiff;
         checkShowHidden.Visible = false;
         checkShowHidden.Checked = false;
     }
     else
     {
         if (checkOrderAlphabetical.Checked)
         {
             butUp.Enabled   = false;
             butDown.Enabled = false;
         }
         else
         {
             butUp.Enabled   = true;
             butDown.Enabled = true;
         }
     }
     if (IsMultiSelect)
     {
         butSelectAll.Visible   = true;
         butSelectNone.Visible  = true;
         gridMain.SelectionMode = GridSelectionMode.MultiExtended;
     }
     FillGrid();
     for (int i = 0; i < gridMain.Rows.Count; i++)
     {
         if (ListSelectedClinicNums.Contains(((Clinic)gridMain.Rows[i].Tag).ClinicNum))
         {
             gridMain.SetSelected(i, true);
         }
     }
 }
Esempio n. 6
0
 private void FormPayPlanSelect_Load(object sender, System.EventArgs e)
 {
     if (_includeNone)
     {
         this.Text         = Lan.g(this, "Attach to payment plan?");
         labelExpl.Visible = true;
         butNone.Visible   = true;
     }
     _listPayPlanCharges = PayPlanCharges.GetForPayPlans(_listValidPayPlans.Select(x => x.PayPlanNum).ToList());
     FillGrid();
     gridMain.SetSelected(0, true);
 }
Esempio n. 7
0
        private void FillMain()
        {
            int selectedIdx = gridMain.GetSelectedIndex();

            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            gridMain.ListGridColumns.Add(new GridColumn("Abbr", 75));
            gridMain.ListGridColumns.Add(new GridColumn("Note", 600));
            gridMain.ListGridRows.Clear();
            if (listCat.SelectedIndex == -1)
            {
                gridMain.EndUpdate();
                return;
            }
            GridRow row;

            _listNotes = _listNotes.OrderBy(x => x.ItemOrder).ToList();
            foreach (QuickPasteNote note in _listNotes)
            {
                if (note.QuickPasteCatNum != _listCats[listCat.SelectedIndex].QuickPasteCatNum)
                {
                    continue;
                }
                row = new GridRow();
                row.Cells.Add(string.IsNullOrWhiteSpace(note.Abbreviation)?"":"?" + note.Abbreviation);
                row.Cells.Add(note.Note.Replace("\r", "").Replace("\n", "").Left(120, true));
                row.Tag = note;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
            if (selectedIdx == -1)           //Select the last option.
            {
                gridMain.SetSelected(gridMain.ListGridRows.Count - 1, true);
                gridMain.ScrollToEnd();
            }
            else if (selectedIdx < gridMain.ListGridRows.Count)           //Select the previously selected position.
            {
                gridMain.SetSelected(selectedIdx, true);
            }
        }
Esempio n. 8
0
        private void FillGrid()
        {
            long previousSelectedStateAbbrNum = -1;
            int  newSelectedIdx = -1;

            if (gridMain.GetSelectedIndex() != -1)
            {
                previousSelectedStateAbbrNum = ((StateAbbr)gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag).StateAbbrNum;
            }
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn(Lan.g("FormStateAbbrs", "Description"), 175);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("FormStateAbbrs", "Abbr"), 70);
            gridMain.ListGridColumns.Add(col);
            if (PrefC.GetBool(PrefName.EnforceMedicaidIDLength))
            {
                col = new GridColumn(Lan.g("FormStateAbbrs", "Medicaid ID Length"), 200);
                gridMain.ListGridColumns.Add(col);
            }
            gridMain.ListGridRows.Clear();
            GridRow          row;
            List <StateAbbr> stateAbbrs = StateAbbrs.GetDeepCopy();

            for (int i = 0; i < stateAbbrs.Count; i++)
            {
                row = new GridRow();
                row.Cells.Add(stateAbbrs[i].Description);
                row.Cells.Add(stateAbbrs[i].Abbr);
                if (PrefC.GetBool(PrefName.EnforceMedicaidIDLength))
                {
                    if (stateAbbrs[i].MedicaidIDLength == 0)
                    {
                        row.Cells.Add("");
                    }
                    else
                    {
                        row.Cells.Add(stateAbbrs[i].MedicaidIDLength.ToString());
                    }
                }
                row.Tag = stateAbbrs[i];
                gridMain.ListGridRows.Add(row);
                if (stateAbbrs[i].StateAbbrNum == previousSelectedStateAbbrNum)
                {
                    newSelectedIdx = i;
                }
            }
            gridMain.EndUpdate();
            gridMain.SetSelected(newSelectedIdx, true);
        }
Esempio n. 9
0
        private void FillTable()
        {
            Referrals.RefreshCache();
            listRef = Referrals.GetDeepCopy();
            if (!checkHidden.Checked)
            {
                listRef.RemoveAll(x => x.IsHidden);
            }
            if (!checkShowPat.Checked)
            {
                listRef.RemoveAll(x => x.PatNum > 0);
            }
            if (!checkShowDoctor.Checked)
            {
                listRef.RemoveAll(x => x.IsDoctor);
            }
            if (!checkShowOther.Checked)
            {
                listRef.RemoveAll(x => x.PatNum == 0 && !x.IsDoctor);
            }
            if (checkPreferred.Checked)
            {
                listRef.RemoveAll(x => !x.IsPreferred);
            }
            if (!string.IsNullOrWhiteSpace(textSearch.Text))
            {
                string[] searchTokens = textSearch.Text.ToLower().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                listRef.RemoveAll(x => searchTokens.Any(y => !x.FName.ToLower().Contains(y) && !x.LName.ToLower().Contains(y)));
            }
            int  scrollValue    = gridMain.ScrollValue;
            long selectedRefNum = -1;

            if (gridMain.GetSelectedIndex() > -1)
            {
                selectedRefNum = ((Referral)gridMain.Rows[gridMain.GetSelectedIndex()].Tag).ReferralNum;
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "LastName"), 150));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "FirstName"), 80));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "MI"), 30));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "Title"), 70));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "Specialty"), 60));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "Patient"), 45));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "Note"), 250));
            gridMain.Rows.Clear();
            ODGridRow row;
            int       indexSelectedRef = -1;

            foreach (Referral refCur in listRef)
            {
                row = new ODGridRow();
                row.Cells.Add(refCur.LName);
                row.Cells.Add(refCur.FName);
                row.Cells.Add(refCur.MName.Left(1).ToUpper());                //Left(1) will return empty string if MName is null or empty string, so ToUpper is null safe
                row.Cells.Add(refCur.Title);
                row.Cells.Add(refCur.IsDoctor?Lan.g("enumDentalSpecialty", Defs.GetName(DefCat.ProviderSpecialties, refCur.Specialty)):"");
                row.Cells.Add(refCur.PatNum > 0?"X":"");
                row.Cells.Add(refCur.Note);
                if (refCur.IsHidden)
                {
                    row.ColorText = Color.Gray;
                }
                row.Tag = refCur;
                gridMain.Rows.Add(row);
                if (refCur.ReferralNum == selectedRefNum)
                {
                    indexSelectedRef = gridMain.Rows.Count - 1;
                }
            }
            gridMain.EndUpdate();
            if (indexSelectedRef > -1)
            {
                gridMain.SetSelected(indexSelectedRef, true);
            }
            gridMain.ScrollValue  = scrollValue;
            labelResultCount.Text = gridMain.Rows.Count.ToString() + Lan.g(this, " results found");
        }
Esempio n. 10
0
 private void butSelectAll_Click(object sender, EventArgs e)
 {
     gridMain.SetSelected(true);
 }
Esempio n. 11
0
        private void FillTable()
        {
            Referrals.RefreshCache();
            listRef = new List <Referral>();
            for (int i = 0; i < Referrals.List.Length; i++)
            {
                if (!checkHidden.Checked)                 //don't include hidden
                {
                    if (Referrals.List[i].IsHidden)       //if hidden
                    {
                        continue;
                    }
                }
                if (textSearch.Text != "")
                {
                    if (!Referrals.List[i].LName.ToLower().StartsWith(textSearch.Text.ToLower()))                     //no match
                    {
                        continue;
                    }
                }
                listRef.Add(Referrals.List[i]);
            }
            int  scrollValue    = gridMain.ScrollValue;
            long selectedRefNum = -1;

            if (gridMain.GetSelectedIndex() != -1)
            {
                selectedRefNum = ((Referral)gridMain.Rows[gridMain.GetSelectedIndex()].Tag).ReferralNum;
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lans.g("TableSelectRefferal", "LastName"), 150);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lans.g("TableSelectRefferal", "FirstName"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lans.g("TableSelectRefferal", "MI"), 30);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lans.g("TableSelectRefferal", "Title"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lans.g("TableSelectRefferal", "Specialty"), 60);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lans.g("TableSelectRefferal", "Patient"), 45);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lans.g("TableSelectRefferal", "Note"), 250);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < listRef.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listRef[i].LName);
                row.Cells.Add(listRef[i].FName);
                if (listRef[i].MName != "")
                {
                    row.Cells.Add(listRef[i].MName.Substring(0, 1).ToUpper());
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(listRef[i].Title);
                if (listRef[i].IsDoctor)
                {
                    row.Cells.Add(Lan.g("enumDentalSpecialty", ((DentalSpecialty)(listRef[i].Specialty)).ToString()));
                }
                else
                {
                    row.Cells.Add("");
                }
                if (listRef[i].PatNum > 0)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(listRef[i].Note);
                if (listRef[i].IsHidden)
                {
                    row.ColorText = Color.Gray;
                }
                row.Tag = listRef[i];
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            labelResultCount.Text = gridMain.Rows.Count.ToString() + " results found.";
            gridMain.ScrollValue  = scrollValue;
            for (int i = 0; i < gridMain.Rows.Count; i++)
            {
                if (((Referral)gridMain.Rows[i].Tag).ReferralNum == selectedRefNum)
                {
                    gridMain.SetSelected(i, true);
                    break;
                }
            }
        }
Esempio n. 12
0
 private void FormClinics_Load(object sender, System.EventArgs e)
 {
     checkOrderAlphabetical.Checked = PrefC.GetBool(PrefName.ClinicListIsAlphabetical);
     if (ListClinics == null)
     {
         ListClinics = Clinics.GetAllForUserod(Security.CurUser);
         if (IncludeHQInList)
         {
             ListClinics.Insert(0, new Clinic()
             {
                 ClinicNum = 0, Description = Lan.g(this, "Headquarters"), Abbr = Lan.g(this, "HQ")
             });
         }
         //if alphabetical checkbox is checked/unchecked it triggers a pref cache refresh, but does not refill the clinic cache, so we need to sort here
         //in case the pref was changed since last time this was opened.
         ListClinics.Sort(ClinicSort);
     }
     _listClinicsOld           = ListClinics.Select(x => x.Copy()).ToList();
     _listClinicDefLinksAllOld = DefLinks.GetDefLinksByType(DefLinkType.Clinic);
     _dictClinicalCounts       = new SerializableDictionary <long, int>();
     if (IsSelectionMode)
     {
         butAdd.Visible           = false;
         butOK.Visible            = true;
         groupClinicOrder.Visible = false;
         groupMovePats.Visible    = false;
         int widthDiff = (groupClinicOrder.Width - butOK.Width);
         MinimumSize             = new Size(MinimumSize.Width - widthDiff, MinimumSize.Height);
         Width                  -= widthDiff;
         gridMain.Width         += widthDiff;
         butSelectAll.Location   = new Point(butSelectAll.Location.X + widthDiff, butSelectAll.Location.Y);
         butSelectNone.Location  = new Point(butSelectNone.Location.X + widthDiff, butSelectNone.Location.Y);
         checkShowHidden.Visible = false;
         checkShowHidden.Checked = false;
     }
     else
     {
         if (checkOrderAlphabetical.Checked)
         {
             butUp.Enabled   = false;
             butDown.Enabled = false;
         }
         _dictClinicalCounts = Clinics.GetClinicalPatientCount();
     }
     if (IsMultiSelect)
     {
         butSelectAll.Visible   = true;
         butSelectNone.Visible  = true;
         gridMain.SelectionMode = GridSelectionMode.MultiExtended;
     }
     FillGrid(false);
     if (!ListSelectedClinicNums.IsNullOrEmpty())
     {
         for (int i = 0; i < gridMain.ListGridRows.Count; i++)
         {
             if (ListSelectedClinicNums.Contains(((Clinic)gridMain.ListGridRows[i].Tag).ClinicNum))
             {
                 gridMain.SetSelected(i, true);
             }
         }
     }
 }