Beispiel #1
0
        protected virtual void ProcessRow(SafeReader sr)
        {
            LastRowType = null;

            RowType nRowType;

            string sRowType = sr.ContainsField("DatumType", "RowType") ? sr["DatumType"] : sr["RowType"];

            if (!Enum.TryParse(sRowType, out nRowType))
            {
                Log.Alert("Unsupported row type encountered: '{0}'.", sRowType);
                return;
            }             // if

            LastRowType = nRowType;

            Log.Debug("Auto approve agent, processing input row of type {0}.", sRowType);

            switch (nRowType)
            {
            case RowType.MetaData:
                sr.Fill(MetaData);
                break;

            case RowType.Payment:
                Payments.Add(sr.Fill <Payment>());
                break;

            case RowType.OriginationTime:
                OriginationTime.Process(sr);
                break;

            case RowType.Turnover:
                Turnover.Add(sr.Fill <TurnoverDbRow>());
                break;

            case RowType.DirectorName:
                DirectorNames.Add(new Name(sr["FirstName"], sr["LastName"]));
                break;

            case RowType.HmrcBusinessName:
                if (sr["BelongsToCustomer"])
                {
                    HmrcBusinessNames.Add(new NameForComparison(sr["Name"]));
                }
                break;

            case RowType.ExperianConsumerDataCais:
                this.caisAccounts.Add(sr.Fill <ExperianConsumerDataCaisAccounts>());
                break;

            case RowType.CompanyDissolutionDate:
                MetaData.CompanyDissolutionDate = sr["CompanyDissolutionDate"];
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }     // switch
        }         // ProcessRow
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (SecurityCode != null
                                 ? SecurityCode.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ (OptionNumber != null
                                 ? OptionNumber.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ (OptionCode != null
                                 ? OptionCode.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ Bid.GetHashCode();
         hashCode = (hashCode * 397) ^ BidVolume.GetHashCode();
         hashCode = (hashCode * 397) ^ Ask.GetHashCode();
         hashCode = (hashCode * 397) ^ AskVolume.GetHashCode();
         hashCode = (hashCode * 397) ^ Volume.GetHashCode();
         hashCode = (hashCode * 397) ^ Bid2.GetHashCode();
         hashCode = (hashCode * 397) ^ BidVolume2.GetHashCode();
         hashCode = (hashCode * 397) ^ Ask2.GetHashCode();
         hashCode = (hashCode * 397) ^ AskVolume2.GetHashCode();
         hashCode = (hashCode * 397) ^ Bid3.GetHashCode();
         hashCode = (hashCode * 397) ^ BidVolume3.GetHashCode();
         hashCode = (hashCode * 397) ^ Ask3.GetHashCode();
         hashCode = (hashCode * 397) ^ AskVolume3.GetHashCode();
         hashCode = (hashCode * 397) ^ Bid4.GetHashCode();
         hashCode = (hashCode * 397) ^ BidVolume4.GetHashCode();
         hashCode = (hashCode * 397) ^ Ask4.GetHashCode();
         hashCode = (hashCode * 397) ^ AskVolume4.GetHashCode();
         hashCode = (hashCode * 397) ^ Bid5.GetHashCode();
         hashCode = (hashCode * 397) ^ BidVolume5.GetHashCode();
         hashCode = (hashCode * 397) ^ Ask5.GetHashCode();
         hashCode = (hashCode * 397) ^ AskVolume5.GetHashCode();
         hashCode = (hashCode * 397) ^ (Greeks != null
                                 ? Greeks.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ OpenInterest.GetHashCode();
         hashCode = (hashCode * 397) ^ Turnover.GetHashCode();
         hashCode = (hashCode * 397) ^ UncoveredPositionQuantity.GetHashCode();
         hashCode = (hashCode * 397) ^ PreviousSettlementPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ OpeningPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ AuctionReferencePrice.GetHashCode();
         hashCode = (hashCode * 397) ^ AuctionReferenceQuantity.GetHashCode();
         hashCode = (hashCode * 397) ^ HighestPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ LowestPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ LatestTradedPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ Change.GetHashCode();
         hashCode = (hashCode * 397) ^ ChangePercentage.GetHashCode();
         hashCode = (hashCode * 397) ^ PreviousClose.GetHashCode();
         hashCode = (hashCode * 397) ^ (Name != null
                                 ? Name.GetHashCode()
                                 : 0);
         return(hashCode);
     }
 }
        public async Task <Turnover> Update(Turnover turnover)
        {
            using (var conn = new SqlConnection(AppSettings.ConnectionString))
            {
                var sql = new TurnoversSql();
                await conn.ExecuteAsync(sql.Update(turnover.DirectionId, turnover.Name, turnover.Id));

                return(await ById(turnover.Id));
            }
        }
        public async Task <Turnover> Add(Turnover turnover)
        {
            using (var conn = new SqlConnection(AppSettings.ConnectionString))
            {
                var sql = new TurnoversSql();
                var id  = await conn.QueryFirstOrDefaultAsync <int>(sql.Add(turnover.DirectionId, turnover.Name));

                return(await ById(id));
            }
        }
Beispiel #5
0
 public override string ToString()
 {
     return(code + "," +
            (Direction == TradeDirection.Buy ? "买入" : "卖出") +
            ",委托日期=" + this.entrustDate.ToString("yyyyMMdd") +
            ",委托价格=" + this.entrustPrice.ToString("F2") +
            ",数量=" + this.Amount.ToString() +
            ",交易日期=" + this.TradeDate.ToString("yyyyMMdd") +
            ",交易价格=" + TradePrice.ToString("F2") + ",总金额=" + Turnover.ToString("F2") + (reason == null || reason == ""?"":"," + reason));
 }
Beispiel #6
0
 internal static bool AreEqual(Turnover p1, Turnover p2)
 {
     if (AreEqual((Play)p1, (Play)p2))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        public async Task <JsonResult> AddOrUpdate([FromBody] Turnover input)
        {
            //await CheckPermission();
            //if (input.Days == null || input.Days.Count == 0)
            //    throw new ValidationException("Не заполнены дни циклового графика");

            var sqlR = new TurnoversRepoisitory(_logger);

            if (input.Id != 0)
            {
                return(Json(await sqlR.Update(input)));
            }
            return(Json(await sqlR.Add(input)));
        }
Beispiel #8
0
        private List <Turnover> ReadTables(DataTable dataTable)
        {
            List <Turnover> turnovers = new List <Turnover>();

            foreach (DataRow dr in dataTable.Rows)
            {
                Turnover turnover = new Turnover()
                {
                    Sales     = (int)dr["DrinksSold"],
                    Price     = (int)dr["PriceOfDrinks"],
                    DrinkName = (string)dr["DrinkName"]
                };
                turnovers.Add(turnover);
            }
            return(turnovers);
        }
Beispiel #9
0
        public void Turnover_and_steal_give_proper_plays()
        {
            var bundle = new List <PlayDTO> {
                P0LostTheBall, P2StoleTheBall
            };
            var P2Steal    = new Steal(Guid.NewGuid(), DateTime.Now, true, playerIds[2], gameId);
            var P0Turnover = new Turnover(Guid.NewGuid(), DateTime.Now, false, playerIds[0], gameId);

            try
            {
                Assert.Multiple(() =>
                {
                    Assert.True(Plays.AreEqual((Steal)result.First(), P2Steal));
                    Assert.True(Plays.AreEqual((Turnover)result.Last(), P0Turnover));
                });
            }
            catch (Exception) { }
        }
 protected bool Equals(OptionViewModel other)
 {
     return(string.Equals(OptionNumber, other.OptionNumber) &&
            Bid.Equals(other.Bid) &&
            BidVolume == other.BidVolume &&
            Ask.Equals(other.Ask) &&
            AskVolume == other.AskVolume &&
            Volume == other.Volume &&
            Bid2.Equals(other.Bid2) &&
            BidVolume2 == other.BidVolume2 &&
            Ask2.Equals(other.Ask2) &&
            AskVolume2 == other.AskVolume2 &&
            Bid3.Equals(other.Bid3) &&
            BidVolume3 == other.BidVolume3 &&
            Ask3.Equals(other.Ask3) &&
            AskVolume3 == other.AskVolume3 &&
            Bid4.Equals(other.Bid4) &&
            BidVolume4 == other.BidVolume4 &&
            Ask4.Equals(other.Ask4) &&
            AskVolume4 == other.AskVolume4 &&
            Bid5.Equals(other.Bid5) &&
            BidVolume5 == other.BidVolume5 &&
            Ask5.Equals(other.Ask5) &&
            AskVolume5 == other.AskVolume5 &&
            Equals(Greeks, other.Greeks) &&
            OpenInterest == other.OpenInterest &&
            Turnover.Equals(other.Turnover) &&
            UncoveredPositionQuantity == other.UncoveredPositionQuantity &&
            PreviousSettlementPrice.Equals(other.PreviousSettlementPrice) &&
            OpeningPrice.Equals(other.OpeningPrice) &&
            AuctionReferencePrice.Equals(other.AuctionReferencePrice) &&
            AuctionReferenceQuantity == other.AuctionReferenceQuantity &&
            HighestPrice.Equals(other.HighestPrice) &&
            LowestPrice.Equals(other.LowestPrice) &&
            LatestTradedPrice.Equals(other.LatestTradedPrice) &&
            Change.Equals(other.Change) &&
            ChangePercentage.Equals(other.ChangePercentage) &&
            PreviousClose.Equals(other.PreviousClose) &&
            string.Equals(Name, other.Name));
 }
Beispiel #11
0
 public bool IsInTurnover() => Turnover.Contains(_input[Deflection]);
            public async Task <int> Handle(CreateTurnoverCommand request, CancellationToken cancellationToken)
            {
                var playerMatchTurnover = await _context.PlayerMatch
                                          .Include(x => x.PlayerSeason)
                                          .FirstOrDefaultAsync(x => x.PlayerSeason.PlayerId == request.PlayerId && x.MatchId == request.MatchId, cancellationToken);

                Match match = await _context.Match
                              .Include(x => x.TeamGuest)
                              .Include(x => x.TeamHome)
                              .FirstOrDefaultAsync(x => x.Id == request.MatchId, cancellationToken);

                TeamMatch teamMatchWhoTurnover;
                TeamMatch teamMatchWhoSteal;

                if (request.IsGuest)
                {
                    teamMatchWhoTurnover = match.TeamGuest;
                    teamMatchWhoSteal    = match.TeamHome;
                }
                else
                {
                    teamMatchWhoTurnover = match.TeamHome;
                    teamMatchWhoSteal    = match.TeamGuest;
                }

                if (playerMatchTurnover == null)
                {
                    var playerSeason =
                        await _context.PlayerSeason.FirstOrDefaultAsync(x => x.PlayerId == request.PlayerId,
                                                                        cancellationToken);

                    playerMatchTurnover = new PlayerMatch {
                        PlayerSeasonId = playerSeason.Id, MatchId = request.MatchId
                    };

                    _context.PlayerMatch.Add(playerMatchTurnover);
                }

                playerMatchTurnover.Tov++;
                teamMatchWhoTurnover.Tov++;

                var incident = new Incident
                {
                    MatchId      = request.MatchId,
                    Minutes      = request.Minutes,
                    Seconds      = request.Seconds,
                    IncidentType = IncidentType.TURNOVER,
                    Quater       = request.Quater,
                    Flagged      = request.Flagged,
                    IsGuest      = request.IsGuest
                };

                var turnover = new Turnover
                {
                    PlayerId     = request.PlayerId,
                    TurnoverType = request.TurnoverType,
                    Incident     = incident
                };

                if (request.PlayerStealId.HasValue)
                {
                    var playerMatchSteal = await _context.PlayerMatch
                                           .Include(x => x.PlayerSeason)
                                           .FirstOrDefaultAsync(x => x.PlayerSeason.PlayerId == request.PlayerStealId && x.MatchId == request.MatchId, cancellationToken);

                    if (playerMatchSteal == null)
                    {
                        var playerSeason =
                            await _context.PlayerSeason.FirstOrDefaultAsync(x => x.PlayerId == request.PlayerStealId,
                                                                            cancellationToken);

                        playerMatchSteal = new PlayerMatch {
                            PlayerSeasonId = playerSeason.Id, MatchId = request.MatchId
                        };

                        _context.PlayerMatch.Add(playerMatchSteal);
                    }

                    playerMatchSteal.Stl++;
                    teamMatchWhoSteal.Stl++;

                    var steal = new Steal {
                        PlayerId = request.PlayerStealId.Value, Turnover = turnover
                    };

                    _context.Steal.Add(steal);
                }

                _context.Turnover.Add(turnover);

                var success = await _context.SaveChangesAsync(cancellationToken) > 0;

                if (success)
                {
                    return(incident.Id);
                }

                throw new Exception("Error saving changes");
            }
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (StockExchange != null
                                 ? StockExchange.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ (TradeSector != null
                                 ? TradeSector.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ (SecurityCode != null
                                 ? SecurityCode.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ (SecurityName != null
                                 ? SecurityName.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ (SecurityClass != null
                                 ? SecurityClass.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ HasOptions.GetHashCode();
         hashCode = (hashCode * 397) ^ (SecurityStatus != null
                                 ? SecurityStatus.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ (Currency != null
                                 ? Currency.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ LimitUpPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ LimitDownPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ LotSize.GetHashCode();
         hashCode = (hashCode * 397) ^ (LotFlag != null
                                 ? LotFlag.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ (SuspendedFlag != null
                                 ? SuspendedFlag.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ (SecuritySubClass != null
                                 ? SecuritySubClass.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ (UnderlyinSecurityCode != null
                                 ? UnderlyinSecurityCode.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ (SecurityLevel != null
                                 ? SecurityLevel.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ PreviousClose.GetHashCode();
         hashCode = (hashCode * 397) ^ OpenPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ Turnover.GetHashCode();
         hashCode = (hashCode * 397) ^ HighPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ LowPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ LastPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ CurrentBidPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ CurrentAskPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ Volume.GetHashCode();
         hashCode = (hashCode * 397) ^ PERatio.GetHashCode();
         hashCode = (hashCode * 397) ^ BuyVolume1.GetHashCode();
         hashCode = (hashCode * 397) ^ SellVolume1.GetHashCode();
         hashCode = (hashCode * 397) ^ BuyPrice2.GetHashCode();
         hashCode = (hashCode * 397) ^ BuyVolume2.GetHashCode();
         hashCode = (hashCode * 397) ^ SellPrice2.GetHashCode();
         hashCode = (hashCode * 397) ^ SellVolume2.GetHashCode();
         hashCode = (hashCode * 397) ^ BuyPrice3.GetHashCode();
         hashCode = (hashCode * 397) ^ BuyVolume3.GetHashCode();
         hashCode = (hashCode * 397) ^ SellPrice3.GetHashCode();
         hashCode = (hashCode * 397) ^ SellVolume3.GetHashCode();
         hashCode = (hashCode * 397) ^ BuyPrice4.GetHashCode();
         hashCode = (hashCode * 397) ^ BuyVolume4.GetHashCode();
         hashCode = (hashCode * 397) ^ SellPrice4.GetHashCode();
         hashCode = (hashCode * 397) ^ SellVolume4.GetHashCode();
         hashCode = (hashCode * 397) ^ BuyPrice5.GetHashCode();
         hashCode = (hashCode * 397) ^ BuyVolume5.GetHashCode();
         hashCode = (hashCode * 397) ^ SellPrice5.GetHashCode();
         hashCode = (hashCode * 397) ^ SellVolume5.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #14
0
 public Incomes()
 {
     turnover = new Turnover();
     other    = new Other();
 }