private void FillGrid() { if (IsSelectionMode) { DList = Deposits.GetUnattached(); } else { DList = Deposits.Refresh(); } grid.BeginUpdate(); grid.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableDepositSlips", "Date"), 80); grid.Columns.Add(col); col = new ODGridColumn(Lan.g("TableDepositSlips", "Amount"), 90); grid.Columns.Add(col); grid.Rows.Clear(); OpenDental.UI.ODGridRow row; for (int i = 0; i < DList.Length; i++) { row = new OpenDental.UI.ODGridRow(); row.Cells.Add(DList[i].DateDeposit.ToShortDateString()); row.Cells.Add(DList[i].Amount.ToString("F")); grid.Rows.Add(row); } grid.EndUpdate(); grid.ScrollToEnd(); }
private void FillGrid() { if (!PrefC.HasClinicsEnabled) { if (IsSelectionMode) { DList = Deposits.GetUnattached(); } else { DList = Deposits.Refresh(); } } else { //GetForClinics uses an empty list to indicate "all", which is a loophole if user doesn't select an item. So: if (comboClinics.ListSelectedClinicNums.Count == 0) { DList = Deposits.GetForClinics(new List <long>() { Clinics.ClinicNum }, IsSelectionMode); //restrict to current clinic } else { DList = Deposits.GetForClinics(comboClinics.ListSelectedClinicNums, IsSelectionMode); } } grid.BeginUpdate(); grid.ListGridColumns.Clear(); GridColumn col = new GridColumn(Lan.g("TableDepositSlips", "Date"), 80); grid.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableDepositSlips", "Amount"), 90, HorizontalAlignment.Right); grid.ListGridColumns.Add(col); if (PrefC.HasClinicsEnabled) { col = new GridColumn(Lan.g("TableDepositSlips", "Clinic"), 150); grid.ListGridColumns.Add(col); } grid.ListGridRows.Clear(); OpenDental.UI.GridRow row; for (int i = 0; i < DList.Length; i++) { row = new OpenDental.UI.GridRow(); row.Cells.Add(DList[i].DateDeposit.ToShortDateString()); row.Cells.Add(DList[i].Amount.ToString("F")); if (PrefC.HasClinicsEnabled) { row.Cells.Add(" " + DList[i].ClinicAbbr); //padding left with space to add separation between amount and clinic abbr } grid.ListGridRows.Add(row); } grid.EndUpdate(); grid.ScrollToEnd(); }
private void FillGrid() { if (!PrefC.HasClinicsEnabled) { if (IsSelectionMode) { DList = Deposits.GetUnattached(); } else { DList = Deposits.Refresh(); } } else { List <long> listSelectedClinicNums = new List <long>(); if (!Security.CurUser.ClinicIsRestricted && comboClinic.SelectedIndices.Contains(0)) //All is an option in comboClinic and is selected. //Blank by design for Deposits.GetForClinics(...). { } else { int listStep = (Security.CurUser.ClinicIsRestricted?0:1); //If the All option is available, then all indices are offset by 1. comboClinic.ListSelectedIndices.ForEach(x => listSelectedClinicNums.Add(_listClinics[x - listStep].ClinicNum)); } DList = Deposits.GetForClinics(listSelectedClinicNums, IsSelectionMode); } grid.BeginUpdate(); grid.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableDepositSlips", "Date"), 80); grid.Columns.Add(col); col = new ODGridColumn(Lan.g("TableDepositSlips", "Amount"), 90, HorizontalAlignment.Right); grid.Columns.Add(col); if (PrefC.HasClinicsEnabled) { col = new ODGridColumn(Lan.g("TableDepositSlips", "Clinic"), 150); grid.Columns.Add(col); } grid.Rows.Clear(); OpenDental.UI.ODGridRow row; for (int i = 0; i < DList.Length; i++) { row = new OpenDental.UI.ODGridRow(); row.Cells.Add(DList[i].DateDeposit.ToShortDateString()); row.Cells.Add(DList[i].Amount.ToString("F")); if (PrefC.HasClinicsEnabled) { row.Cells.Add(" " + DList[i].ClinicAbbr); //padding left with space to add separation between amount and clinic abbr } grid.Rows.Add(row); } grid.EndUpdate(); grid.ScrollToEnd(); }