public List <EntrustFlowItem> GetEntrustFlow() { List <EntrustFlowItem> efItems = new List <EntrustFlowItem>(); var allItems = _entrustSecurityBLL.GetAllCombine(); var entrustedNoDealItems = allItems.Where(p => (p.EntrustStatus == EntrustStatus.Completed || p.EntrustStatus == EntrustStatus.CancelFail || p.EntrustStatus == EntrustStatus.CancelSuccess) && (p.DealStatus != DealStatus.Completed) ); foreach (var item in entrustedNoDealItems) { EntrustFlowItem efItem = new EntrustFlowItem { CommandNo = item.CommandId, SecuCode = item.SecuCode, EEntrustPriceType = item.EntrustPriceType, //PriceType = item.PriceType.ToString(), //EntrustStatus = item.EntrustStatus.ToString(), EntrustAmount = item.EntrustAmount, //EntrustedDate = DateFormat.Format(item.EntrustDate, ConstVariable.DateFormat), //EntrustedTime = DateFormat.Format(item.EntrustDate, ConstVariable.TimeFormat1), //EntrustDirection = item.EntrustDirection.ToString(), DEntrustDate = item.EntrustDate, EntrustNo = item.EntrustNo, DealAmount = item.TotalDealAmount, DealTimes = item.DealTimes, InstanceId = item.InstanceId, InstanceNo = item.InstanceCode, EntrustBatchNo = item.BatchNo, PortfolioName = item.PortfolioName, FundName = item.AccountName, }; var secuInfoItem = SecurityInfoManager.Instance.Get(item.SecuCode, item.SecuType); if (secuInfoItem != null) { efItem.SecuName = secuInfoItem.SecuName; //efItem.Market = secuInfoItem.ExchangeCode; } efItems.Add(efItem); } return(efItems); }
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); }