public TradeOperation(double time, string shipId, string fullLogEntry, string shipName, int quantity, string product, string soldToId, string soldToName, string faction, int money)
        {
            if ("Please load the XML".Equals(shipId))
            {
                return;
            }
            this.Time = time;
            Ship ourShip = Ship.GetShip(shipId);

            //this is to ensure the last name of the ship sticks
            OurShip.ShipName = shipName;

            this.OurShip      = ourShip;
            this.FullLogEntry = fullLogEntry;
            this.Quantity     = quantity;

            Ware itemSold = Ware.GetWare(product);

            this.ItemSold = itemSold;

            this.SoldTo          = Ship.GetSoldTo(soldToId);
            this.SoldTo.ShipName = soldToName;
            this.Faction         = faction;
            this.Money           = money;
            ourShip.AddTradeOperation(this);
            PartialSumByShip = OurShip.GetListOfTradeOperations().Sum(x => x.Money);
            PartialSumByWare = 0;


            itemSold.AddTradeOperation(this);
        }
Esempio n. 2
0
        public static void AddTradeOperationToWareList(TradeOperation tradeOp)
        {
            Ware ware = GlobalWares.Where(x => x.Name.Equals(tradeOp.ItemSold.Name)).FirstOrDefault();

            //if (ware == null)
            //{
            //    ware = tradeOp.ItemSold;
            //    ShipsWithTradeOperations.Add(ship);
            //}
            ware.AddTradeOperation(tradeOp);
        }