Example #1
0
        private void txtCurrencyCode_Leave(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtCurrencyCode.Text.Trim()))
            {
                BaseMaster baseMaster = bCommon.GetBaseMaster("CURRENCY", txtCurrencyCode.Text.Trim());
                if (baseMaster != null)
                {
                    txtCurrencyCode.Text = baseMaster.Code;
                    txtCurrencyName.Text = baseMaster.Name;
                }
                else
                {
                    MessageBox.Show("货币不存在.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtCurrencyCode.Text = "";
                    txtCurrencyName.Text = "";
                    txtCurrencyCode.Focus();
                }
            }
            else
            {
                txtCurrencyName.Text = "";
            }

            if (!string.IsNullOrEmpty(this.txtCurrencyCode.Text.Trim()) && ExchangeDate.Value != null)
            {
                BaseExchangeTable exchange = new BaseExchangeTable();
                exchange = bExchange.GetModel(CConvert.ToDateTime(ExchangeDate.Value.ToString("yyyy-MM")), txtCurrencyCode.Text);
                if (exchange != null)
                {
                    ExchangeDate.Value   = DateTime.Now;
                    txtCurrencyCode.Text = "";
                    ExchangeDate.Focus();
                    MessageBox.Show("当月此货币汇率已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Example #2
0
        /// <summary>
        /// 获得当前选中的数据
        /// </summary>
        private void GetCurrentSelectedTable()
        {
            try
            {
                DateTime date     = CConvert.ToDateTime(CConvert.ToDateTime(dgvData.SelectedRows[0].Cells["EXCHANGE_DATE"].Value).ToString("yyyy-MM"));
                string   currency = CConvert.ToString(dgvData.SelectedRows[0].Cells["FROM_CURRENCY_CODE"].Value);
                if (date != null && !string.IsNullOrEmpty(currency))
                {
                    _currentExchangeTable = bExchange.GetModel(date, currency);
                }
            }
            catch (Exception ex) { }

            if (_currentExchangeTable == null || _currentExchangeTable.FROM_CURRENCY_CODE == null || "".Equals(_currentExchangeTable.FROM_CURRENCY_CODE))
            {
                _currentExchangeTable = null;
            }
        }