コード例 #1
0
        public void EnterCommand()
        {
            Safekeeping safekeeping = new Safekeeping();
            List <Car>  cars        = new List <Car>();

            Console.WriteLine("Enter a command: | count types | count all | average price | average price [type] | exit |");
            String commandString = Console.ReadLine();

            if (commandString == String.Empty)
            {
                Console.WriteLine("Error, you did not enter the command. Try again");
                EnterCommand();
            }
            String[] command = commandString.Split(' ');
            Console.Write(commandString + ": ");
            if (command.Length == 3 && command[0].Equals("average") && command[1].Equals("price"))
            {
                safekeeping.SetCommand(new AverageByBrand());
            }
            switch (commandString)
            {
            case "count types":
                safekeeping.SetCommand(new CountOfBrand());
                safekeeping.WorkCommand(cars);
                break;

            case "count all":
                safekeeping.SetCommand(new AmountCars());
                safekeeping.WorkCommand(cars);
                break;

            case "average price":
                safekeeping.SetCommand(new AveragePrice());
                safekeeping.WorkCommand(cars);
                break;

            case "exit": Environment.Exit(1);
                break;

            default: Console.WriteLine("Unknown command, try again");
                break;
            }
            EnterCommand();
        }
コード例 #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TradeId.Length != 0)
            {
                hash ^= TradeId.GetHashCode();
            }
            if (ExchangeOrderId.Length != 0)
            {
                hash ^= ExchangeOrderId.GetHashCode();
            }
            if (System.Length != 0)
            {
                hash ^= System.GetHashCode();
            }
            if (Counterparty.Length != 0)
            {
                hash ^= Counterparty.GetHashCode();
            }
            if (PortfolioId.Length != 0)
            {
                hash ^= PortfolioId.GetHashCode();
            }
            if (Volume != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Volume);
            }
            if (InstrumentId.Length != 0)
            {
                hash ^= InstrumentId.GetHashCode();
            }
            if (Price != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Price);
            }
            if (Currency.Length != 0)
            {
                hash ^= Currency.GetHashCode();
            }
            if (timestamp_ != null)
            {
                hash ^= Timestamp.GetHashCode();
            }
            hash ^= AdditionalData.GetHashCode();
            if (SystemTradeId.Length != 0)
            {
                hash ^= SystemTradeId.GetHashCode();
            }
            if (UniqueTradeId.Length != 0)
            {
                hash ^= UniqueTradeId.GetHashCode();
            }
            if (Desk.Length != 0)
            {
                hash ^= Desk.GetHashCode();
            }
            if (ExchangeTradeId.Length != 0)
            {
                hash ^= ExchangeTradeId.GetHashCode();
            }
            if (MarketTrade != false)
            {
                hash ^= MarketTrade.GetHashCode();
            }
            if (AlgoId.Length != 0)
            {
                hash ^= AlgoId.GetHashCode();
            }
            if (Strategy.Length != 0)
            {
                hash ^= Strategy.GetHashCode();
            }
            if (Owner.Length != 0)
            {
                hash ^= Owner.GetHashCode();
            }
            if (ClearerAccount.Length != 0)
            {
                hash ^= ClearerAccount.GetHashCode();
            }
            if (Depot.Length != 0)
            {
                hash ^= Depot.GetHashCode();
            }
            if (Safekeeping.Length != 0)
            {
                hash ^= Safekeeping.GetHashCode();
            }
            if (Deleted != false)
            {
                hash ^= Deleted.GetHashCode();
            }
            if (FundingCurrency.Length != 0)
            {
                hash ^= FundingCurrency.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }