示例#1
0
        private void FillFormForUpdate()
        {
            cbAccountLedgerType.SelectedIndexChanged -= CbAccountLedgerType_SelectedIndexChanged;

            cbxStatus.DataSource   = Enum.GetValues(typeof(Enums.Status));
            cbxStatus.SelectedItem = Enums.Status.Active;

            var accountLedgerMaster = applicationFacade.GetAccountLedgerById(this.AccountLedgerId);

            cbAccountLedgerType.DataSource    = accountLedgerMaster.AccountLedgerTypeList;
            cbAccountLedgerType.ValueMember   = "AccountLedgerTypeID";
            cbAccountLedgerType.DisplayMember = "AccountLedgerTypeName";

            cbAccountType.DataSource    = accountLedgerMaster.AccountTypeList;
            cbAccountType.ValueMember   = "AccountTypeID";
            cbAccountType.DisplayMember = "AccountTypeDisplayName";

            if (accountLedgerMaster.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";

                cbCreditControlCode.SelectedValue = accountLedgerMaster.CreditControlCodeID;
                cbDebitControlCode.SelectedValue  = accountLedgerMaster.DebitControlCodeID;

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

            cbAccountLedgerType.SelectedValue = accountLedgerMaster.AccountLedgerTypeId;
            cbDebitCredit.SelectedItem        = accountLedgerMaster.CreditDebit;
            cbxStatus.SelectedItem            = accountLedgerMaster.Status ? Enums.Status.Active : Enums.Status.Inactive;

            tbAccountName.Text        = accountLedgerMaster.AccountLedgerName;
            txtAccountLedgerCode.Text = accountLedgerMaster.AccountLedgerCode;
            tbOpeningBalance.Text     = Convert.ToString(accountLedgerMaster.OpeningBalance);
            txtSalePurchaseValue.Text = Convert.ToString(accountLedgerMaster.SalePurchaseTaxValue);

            cbAccountLedgerType.Enabled = false;

            if (accountLedgerMaster.AccountLedgerTypeSystemName == Constants.AccountLedgerType.SaleLedger ||
                accountLedgerMaster.AccountLedgerTypeSystemName == Constants.AccountLedgerType.PurchaseLedger)
            {
                txtSalePurchaseValue.Enabled = true;
            }
            else
            {
                txtSalePurchaseValue.Enabled = false;
                txtSalePurchaseValue.Text    = "0.00";
            }


            tbAccountName.Focus();
        }