Beispiel #1
0
        /// <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>
        /// 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
                AFFInstance.DataSource = FAccountTable.Copy().DefaultView;
                //AFFInstance.DataSource = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.AccountList, FLedgerNumber).DefaultView;
            }
            else if (AClonedFromComboBox.Name.Contains("CostCentre"))
            {
                // This is quicker than getting the cached table again
                AFFInstance.DataSource = FCostCentreTable.Copy().DefaultView;
                //AFFInstance.DataSource = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.CostCentreList, FLedgerNumber).DefaultView;
            }
            else
            {
                throw new Exception("Unexpected ComboBox name");
            }

            AFFInstance.DrawMode  = DrawMode.OwnerDrawFixed;
            AFFInstance.DrawItem += new DrawItemEventHandler(DrawComboBoxItem);
        }