private void SaveAMIFund() { if (string.IsNullOrEmpty(txtTotalAsset.Text.Trim())) { DXMessage.ShowTips("请输入总资产!"); txtTotalAsset.Focus(); return; } if (string.IsNullOrEmpty(txtAvailableFund.Text.Trim())) { DXMessage.ShowTips("请输入可用资金!"); txtAvailableFund.Focus(); return; } if (string.IsNullOrEmpty(txtPositionValue.Text.Trim())) { DXMessage.ShowTips("请输入持仓市值!"); txtPositionValue.Focus(); return; } if (string.IsNullOrEmpty(txtFinancingLimit.Text.Trim())) { DXMessage.ShowTips("请输入可融资额!"); txtFinancingLimit.Focus(); return; } if (string.IsNullOrEmpty(txtFinancedAmount.Text.Trim())) { DXMessage.ShowTips("请输入已融资额!"); txtFinancedAmount.Focus(); return; } var fundInfo = new MIAccountFund { AccountCode = _currentAccountCode, AccountId = _currentAccountId, YearMonth = _currentYear * 100 + _currentMonth, AvailableFund = Convert.ToDecimal(this.txtAvailableFund.Text.Trim()), FinancedAmount = Convert.ToDecimal(this.txtFinancedAmount.Text.Trim()), FinancingLimit = Convert.ToDecimal(this.txtFinancingLimit.Text.Trim()), PositionValue = Convert.ToDecimal(this.txtPositionValue.Text.Trim()), TotalAsset = Convert.ToDecimal(this.txtTotalAsset.Text.Trim()), }; _statementService.SaveMIAccountFund(fundInfo); DXMessage.ShowTips("保存成功!"); BindAMIFund(); }
public virtual void SaveMIAccountFund(MIAccountFund entity) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } var fundInfo = _MIFundRepo.Table.FirstOrDefault(x => x.AccountId == entity.AccountId && x.YearMonth == entity.YearMonth); if (fundInfo == null) { _MIFundRepo.Insert(entity); } else { fundInfo.AvailableFund = entity.AvailableFund; fundInfo.FinancedAmount = entity.FinancedAmount; fundInfo.FinancingLimit = entity.FinancingLimit; fundInfo.PositionValue = entity.PositionValue; fundInfo.TotalAsset = entity.TotalAsset; _MIFundRepo.Update(fundInfo); } }