コード例 #1
0
        private void FillCombo()
        {
            cbxStatus.DataSource   = Enum.GetValues(typeof(Enums.Status));
            cbxStatus.SelectedItem = Enums.Status.Active;

            var accountLedgerTypes = applicationFacade.GetAccountLedgerTypes();

            cbAccountLedgerType.DataSource    = accountLedgerTypes;
            cbAccountLedgerType.ValueMember   = "AccountLedgerTypeID";
            cbAccountLedgerType.DisplayMember = "AccountLedgerTypeName";

            cbAccountType.DataSource    = applicationFacade.GetAccountTypes();
            cbAccountType.ValueMember   = "AccountTypeID";
            cbAccountType.DisplayMember = "AccountTypeDisplayName";

            cbDebitCredit.SelectedItem = "C";

            if (accountLedgerTypes.FirstOrDefault().AccountLedgerTypeSystemName != Constants.AccountLedgerType.ControlCodes)
            {
                var debitControlCodes  = applicationFacade.GetAccountLedgerBySystemName(Constants.AccountLedgerType.ControlCodes);
                var creditControlCodes = applicationFacade.GetAccountLedgerBySystemName(Constants.AccountLedgerType.ControlCodes);

                cbDebitControlCode.DataSource  = debitControlCodes;
                cbCreditControlCode.DataSource = creditControlCodes;

                cbDebitControlCode.ValueMember   = "AccountLedgerID";
                cbDebitControlCode.DisplayMember = "AccountLedgerName";

                cbCreditControlCode.ValueMember   = "AccountLedgerID";
                cbCreditControlCode.DisplayMember = "AccountLedgerName";

                gbBalanceSheet.Visible = true;
            }
            else
            {
                cbDebitControlCode.DataSource  = null;
                cbCreditControlCode.DataSource = null;
                gbBalanceSheet.Visible         = false;
            }

            cbAccountLedgerType.SelectedIndexChanged += CbAccountLedgerType_SelectedIndexChanged;
        }