private List <EntrustFlowItem> GetFlowItems(CallerToken token, List <UFXQueryFuturesEntrustResponse> responseItems) { var entrustFlowItems = new List <EntrustFlowItem>(); if (responseItems == null || responseItems.Count == 0) { return(entrustFlowItems); } Portfolio portfolio = (Portfolio)token.InArgs; string portfolioCode = string.Empty; string portfolioName = string.Empty; string fundCode = string.Empty; string fundName = string.Empty; if (portfolio != null) { portfolioCode = portfolio.PortfolioNo; portfolioName = portfolio.PortfolioName; fundCode = portfolio.FundCode; fundName = portfolio.FundName; } Dictionary <int, Model.UI.TradeInstance> cmdInstMap = new Dictionary <int, Model.UI.TradeInstance>(); foreach (var responseItem in responseItems) { int commandId = 0; int submitId = 0; int requestId = 0; int temp1, temp2, temp3; if (EntrustRequestHelper.TryParseThirdReff(responseItem.ThirdReff, out temp1, out temp2, out temp3)) { commandId = temp1; submitId = temp2; requestId = temp3; } int instanceId = 0; string instanceCode = string.Empty; if (!cmdInstMap.ContainsKey(commandId)) { var tradeInstance = _tradeCommandBLL.GetTradeInstance(commandId); if (tradeInstance != null) { instanceId = tradeInstance.InstanceId; instanceCode = tradeInstance.InstanceCode; cmdInstMap.Add(commandId, tradeInstance); } } else { instanceId = cmdInstMap[commandId].InstanceId; instanceCode = cmdInstMap[commandId].InstanceCode; } var entrustDirection = UFXTypeConverter.GetEntrustDirection(responseItem.EntrustDirection); var futuresDirection = UFXTypeConverter.GetFuturesDirection(responseItem.FuturesDirection); EntrustDirection eDirection = EntrustDirectionConverter.GetFuturesEntrustDirection(entrustDirection, futuresDirection); EntrustFlowItem efItem = new EntrustFlowItem { CommandNo = token.CommandId, SubmitId = token.SubmitId, //Market = responseItem.MarketNo, SecuCode = responseItem.StockCode, //EntrustDirection = responseItem.EntrustDirection, EEntrustPriceType = EntrustPriceTypeConverter.GetPriceType(responseItem.PriceType), EntrustPrice = responseItem.EntrustPrice, EntrustAmount = responseItem.EntrustAmount, //EntrustStatus = responseItem.EntrustState, DealAmount = responseItem.DealAmount, DealMoney = responseItem.DealBalance, DealTimes = responseItem.DealTimes, DEntrustDate = DateUtil.GetDateTimeFromInt(responseItem.EntrustDate, responseItem.EntrustTime), EntrustBatchNo = responseItem.BatchNo, EntrustNo = responseItem.EntrustNo, DeclareSeat = responseItem.ReportSeat, DeclareNo = Convert.ToInt32(responseItem.ReportNo), RequestId = responseItem.ExtSystemId, FundCode = responseItem.AccountCode, FundName = fundName, PortfolioCode = portfolioCode, PortfolioName = portfolioName, EDirection = eDirection, //EEntrustDirection = UFXTypeConverter.GetEntrustDirection(responseItem.EntrustDirection), EMarketCode = UFXTypeConverter.GetMarketCode(responseItem.MarketNo), EEntrustState = UFXTypeConverter.GetEntrustState(responseItem.EntrustState), WithdrawCause = responseItem.WithdrawCause, InstanceId = instanceId, InstanceNo = instanceCode, }; if (responseItem.FirstDealTime > 0) { efItem.DFirstDealDate = DateUtil.GetDateTimeFromInt(responseItem.EntrustDate, responseItem.FirstDealTime); } efItem.ExchangeCode = UFXTypeConverter.GetMarketCode(efItem.EMarketCode); efItem.CommandNo = commandId; efItem.SubmitId = submitId; efItem.RequestId = requestId; entrustFlowItems.Add(efItem); } return(entrustFlowItems); }
private List <DealFlowItem> GetDealItems(CallerToken token, List <UFXQueryDealResponse> responseItems) { List <DealFlowItem> dealItems = new List <DealFlowItem>(); if (responseItems == null || responseItems.Count == 0) { return(dealItems); } Portfolio portfolio = (Portfolio)token.InArgs; string portfolioCode = string.Empty; string portfolioName = string.Empty; string fundCode = string.Empty; string fundName = string.Empty; if (portfolio != null) { portfolioCode = portfolio.PortfolioNo; portfolioName = portfolio.PortfolioName; fundCode = portfolio.FundCode; fundName = portfolio.FundName; } Dictionary <int, Model.UI.TradeInstance> cmdInstMap = new Dictionary <int, Model.UI.TradeInstance>(); foreach (var responseItem in responseItems) { int commandId = 0; int submitId = 0; int requestId = 0; int temp1, temp2, temp3; if (EntrustRequestHelper.TryParseThirdReff(responseItem.ThirdReff, out temp1, out temp2, out temp3)) { commandId = temp1; submitId = temp2; requestId = temp3; } int instanceId = 0; string instanceCode = string.Empty; if (!cmdInstMap.ContainsKey(commandId)) { var tradeInstance = _tradeCommandBLL.GetTradeInstance(commandId); if (tradeInstance != null) { instanceId = tradeInstance.InstanceId; instanceCode = tradeInstance.InstanceCode; cmdInstMap.Add(commandId, tradeInstance); } } else { instanceId = cmdInstMap[commandId].InstanceId; instanceCode = cmdInstMap[commandId].InstanceCode; } var marketCode = UFXTypeConverter.GetMarketCode(responseItem.MarketNo); var entrustDirection = UFXTypeConverter.GetEntrustDirection(responseItem.EntrustDirection); DealFlowItem efItem = new DealFlowItem { CommandNo = commandId, SecuCode = responseItem.StockCode, FundNo = responseItem.AccountCode, FundName = fundName, PortfolioCode = responseItem.CombiNo, PortfolioName = portfolioName, EDirection = EntrustDirectionConverter.GetSecurityEntrustDirection(entrustDirection), DealPrice = responseItem.DealPrice, DealAmount = responseItem.DealAmount, DealMoney = responseItem.DealBalance, DealTime = string.Format("{0}", responseItem.DealTime), ShareHolderCode = responseItem.StockHolderId, EntrustNo = string.Format("{0}", responseItem.EntrustNo), DealNo = string.Format("{0}", responseItem.DealNo), ExchangeCode = UFXTypeConverter.GetMarketCode(marketCode), InstanceId = instanceId.ToString(), InstanceNo = instanceCode, }; dealItems.Add(efItem); } return(dealItems); }