コード例 #1
0
        private void Manp_Cards_Shown(object sender, EventArgs e)
        {
            dataHolder.LoadEnumData();
            lookUpCardType.Properties.DataSource = dataHolder.CardTypes;


            lookUpCurrency.Properties.DataSource = dataHolder.Currencies;

            if (Id == 0)
            {
                card = new Card();
                chkActive.Checked = true;
            }
            else
            {
                // GET DATA
                Operation <Card> op_card = OperationHandler.GetCardById(Id);
                if (!op_card.Successful)
                {
                    OnLoadError(op_card.Fail);
                    return;
                }
                card = op_card.Value;
                lookUpCardType.Enabled = false;
                lookUpCurrency.Enabled = false;
            }

            bindTool.BindControl(lookUpCardType, nameof(card.CardTypeId));
            bindTool.BindControl(txtCardCode, nameof(card.CardNumber));
            bindTool.BindControl(txtCardName, nameof(card.CardName));
            bindTool.BindControl(lookUpCurrency, nameof(card.CurrencyId));
            bindTool.BindControl(txtTel1, nameof(card.Phone1));
            bindTool.BindControl(txtTel2, nameof(card.Phone2));
            bindTool.BindControl(txtTel3, nameof(card.Phone3));
            bindTool.BindControl(txtTaxCode, nameof(card.TaxCode));
            bindTool.BindControl(txtCountry, nameof(card.Country));
            bindTool.BindControl(txtCity, nameof(card.City));
            bindTool.BindControl(txtTown, nameof(card.Town));
            bindTool.BindControl(txtDistrict, nameof(card.District));
            bindTool.BindControl(txtLocationAddress, nameof(card.LocationAddress));
            bindTool.BindControl(spDebtLimit, nameof(card.DebtLimit));
            bindTool.BindControl(chkActive, nameof(card.IsActive));

            bindTool.DataObject = card;
        }