예제 #1
0
        public virtual void AddAccuntFundTransfer(AccountFundTransfer entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            _accountFundTransferRepository.Insert(entity);
        }
예제 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                this.btnAdd.Enabled = false;

                if (string.IsNullOrEmpty(this.luAccount.SelectedValue()))
                {
                    DXMessage.ShowTips("请选择账号信息!");
                    return;
                }

                if (this.txtAmount.Text.Trim().Length == 0)
                {
                    DXMessage.ShowTips("请输入操作金额!");
                    this.txtAmount.Focus();
                    return;
                }

                if (decimal.Parse(this.txtAmount.Text.Trim()) <= 0)
                {
                    DXMessage.ShowTips("操作金额应该大于0!");
                    this.txtAmount.Focus();
                    return;
                }

                var transferDate   = CommonHelper.StringToDateTime(this.deTransfer.EditValue.ToString());
                var transferAmount = Math.Abs(decimal.Parse(this.txtAmount.Text.Trim()));
                var account        = this.luAccount.GetSelectedDataRow() as AccountEntity;

                if (account == null)
                {
                    return;
                }

                var info = new AccountFundTransfer
                {
                    AccountCode    = account.Code,
                    AccountId      = account.Id,
                    FlowFlag       = this.chkIn.Checked,
                    OperateTime    = _commonService.GetCurrentServerTime(),
                    Operator       = LoginInfo.CurrentUser.UserCode,
                    TransferAmount = this.chkIn.Checked ? transferAmount : -transferAmount,
                    TransferDate   = transferDate,
                };

                this._accountService.AddAccuntFundTransfer(info);

                BindFundTransferInfo();

                this.txtAmount.Text = null;
                this.chkIn.Checked  = true;
            }
            catch (Exception ex)
            {
                DXMessage.ShowError(ex.Message);
            }
            finally
            {
                this.btnAdd.Enabled = true;
            }
        }