Пример #1
0
        private void vehicleReadytoBuy(Vehicle vehicle, Zone ZoneToInsertVechicle)
        {
            vehicle.zone = ZoneToInsertVechicle;

            var listMovement        = routeZoneService.GetAll();
            var okHistory           = false;
            var MovementArray       = listMovement.ToArray();
            var MovementInZoneArray = vehicle.MovementInZone.ToArray();

            if (listMovement.Count < vehicle.MovementInZone.Count)
            {
                for (int i = 0; i < MovementInZoneArray.Count(); i++)
                {
                    for (int j = 0; j < MovementArray.Count() && (i + j) < MovementInZoneArray.Count(); j++)
                    {
                        if (!(MovementArray[j].ZonesToPass.Equals(MovementInZoneArray[i + j].DestinationZone.Name)))
                        {
                            break;
                        }
                        if (j == MovementArray.Count() - 1)
                        {
                            okHistory = true;
                        }
                    }
                }
            }
            if (okHistory)
            {
                vehicle.readyToBuy = true;
                vehicle.HistoryState.Add(new State {
                    CurrentDate = DateTime.Now, PlaceInMoment = Domain.Enum.Place.Vendido
                });
            }
        }
Пример #2
0
 private void updateGrid()
 {
     dataGridView1.DataSource = _routeZoneService.GetAll().ToList();
 }