private void TransferProcess() { var holderAccountId = _record.AccountId; var holderAccountInfo = _record.AccountName + "-" + _record.SecurityCompanyName + "-" + _record.AttributeName; var holder = _record.DealerCode; var holderName = _record.DealerName; var holderTradeType = CTMHelper.GetTradeTypeByDepartment(_record.DepartmentId); var receiver = this.luReceiver.GetSelectedDataRow() as UserInfo; if (receiver == null) { return; } var receiverTradeType = CTMHelper.GetTradeTypeByDepartment(receiver.DepartmentId); var transferVolume = int.Parse(this.txtTransferVolume.Text.Trim()); var transferPrice = decimal.Parse(this.txtTransferPrice.Text.Trim()); var stockFullCode = this.txtStockCode.Text.Trim(); var stockName = this.txtStockName.Text.Trim(); var receivedAccountId = int.Parse(this.luReceivedAccount.SelectedValue()); var receivedAccountInfo = (this.luReceivedAccount.GetSelectedDataRow() as AccountEntity).DisplayMember; var now = _commonService.GetCurrentServerTime(); var tradeDate = CommonHelper.GetPreviousWorkDay(now); var stockTransferInfo = new StockTransferInfo() { HolderAccountId = holderAccountId, HolderAccountInfo = holderAccountInfo, ReceivedAccountId = receivedAccountId, ReceivedAccountInfo = receivedAccountInfo, StockFullCode = stockFullCode, StockName = stockName, Holder = holder, HolderName = holderName, Receiver = receiver.Code, ReceiverName = receiver.Name, OperatorCode = LoginInfo.CurrentUser.UserCode, OperatorName = LoginInfo.CurrentUser.UserName, TransferVolume = transferVolume, TransferPrice = transferPrice, TransferTime = now, }; var holderRecord = new DailyRecord() { DataType = (int)EnumLibrary.DataType.StockTransfer, AccountId = holderAccountId, ActualAmount = transferPrice * transferVolume, Beneficiary = holder, DealAmount = Math.Abs(transferPrice * transferVolume), DealFlag = transferVolume > 0 ? false : true, DealPrice = transferPrice, DealVolume = -transferVolume, ImportTime = now, ImportUser = LoginInfo.CurrentUser.UserCode, OperatorCode = holder, StockCode = stockFullCode, StockName = stockName, TradeDate = tradeDate, TradeTime = now.ToString("HH:mm:ss"), TradeType = (int)holderTradeType, UpdateTime = now, UpdateUser = LoginInfo.CurrentUser.UserCode, }; var receiverRecord = new DailyRecord() { DataType = (int)EnumLibrary.DataType.StockTransfer, AccountId = receivedAccountId, ActualAmount = transferPrice * (-transferVolume), Beneficiary = receiver.Code, DealAmount = Math.Abs(transferPrice * transferVolume), DealFlag = transferVolume < 0 ? false : true, DealPrice = transferPrice, DealVolume = transferVolume, ImportTime = now, ImportUser = LoginInfo.CurrentUser.UserCode, OperatorCode = receiver.Code, StockCode = stockFullCode, StockName = stockName, TradeDate = tradeDate, TradeTime = now.ToString("HH:mm:ss"), TradeType = (int)receiverTradeType, UpdateTime = now, UpdateUser = LoginInfo.CurrentUser.UserCode, }; _stockService.AddStockTransferInfo(stockTransferInfo); _tradeRecordService.InsertDailyRecords(new List <DailyRecord> { holderRecord, receiverRecord }); var stockTransferRecords = new List <StockTransferRecord> { new StockTransferRecord { TransferId = stockTransferInfo.Id, RecordId = holderRecord.Id }, new StockTransferRecord { TransferId = stockTransferInfo.Id, RecordId = receiverRecord.Id } }; _stockService.AddStockTransferRecord(stockTransferRecords); }