/// <summary> /// Helper method that we can call to initialise each of the filter/find comboBoxes /// </summary> private void InitFilterFindComboBox(TCmbAutoPopulated AClonedFromComboBox, TCmbAutoComplete AFFInstance) { AFFInstance.DisplayMember = AClonedFromComboBox.DisplayMember; AFFInstance.ValueMember = AClonedFromComboBox.ValueMember; if (AClonedFromComboBox.Name.Contains("Account")) { // This is quicker than getting the cached table again DataView dv = new DataView(FAccountTable.Copy()); dv.RowFilter = TFinanceControls.PrepareAccountFilter(true, false, false, false, ""); dv.Sort = String.Format("{0}", AAccountTable.GetAccountCodeDBName()); AFFInstance.DataSource = dv; } else if (AClonedFromComboBox.Name.Contains("CostCentre")) { // This is quicker than getting the cached table again DataView dv = new DataView(FCostCentreTable.Copy()); dv.RowFilter = TFinanceControls.PrepareCostCentreFilter(true, false, false, false); dv.Sort = String.Format("{0}", ACostCentreTable.GetCostCentreCodeDBName()); AFFInstance.DataSource = dv; } else { throw new Exception("Unexpected ComboBox name"); } AFFInstance.DrawMode = DrawMode.OwnerDrawFixed; AFFInstance.DrawItem += new DrawItemEventHandler(DrawComboBoxItem); }
/// <summary> /// Refreshes the filters on the combo boxes /// </summary> /// <param name="AActiveOnly"></param> /// <param name="ARow"></param> public void RefreshBankAccountAndCostCentreFilters(bool AActiveOnly, ARecurringGiftBatchRow ARow) { FCmbBankAccountCode.Filter = TFinanceControls.PrepareAccountFilter(true, false, AActiveOnly, true, ""); FCmbCostCentreCode.Filter = TFinanceControls.PrepareCostCentreFilter(true, false, AActiveOnly, true); if (ARow != null) { FCmbCostCentreCode.SetSelectedString(ARow.BankCostCentre, -1); FCmbBankAccountCode.SetSelectedString(ARow.BankAccountCode, -1); } }
private void RefreshBankAccountAndCostCentreFilters(bool AActiveOnly, ARecurringGiftBatchRow ARow = null) { if (FActiveOnly != AActiveOnly) { FActiveOnly = AActiveOnly; cmbDetailBankAccountCode.Filter = TFinanceControls.PrepareAccountFilter(true, false, AActiveOnly, true, ""); cmbDetailBankCostCentre.Filter = TFinanceControls.PrepareCostCentreFilter(true, false, AActiveOnly, true); if (ARow != null) { cmbDetailBankCostCentre.SetSelectedString(ARow.BankCostCentre, -1); cmbDetailBankAccountCode.SetSelectedString(ARow.BankAccountCode, -1); } } }