Example #1
0
        private ScannerFlight CheckIsLane(DataSeed ds, int userId, int laneId, ScannerFlight lane2FlightObj)
        {
            if (lane2FlightObj == null)
            {
                CreateNewFlight(ds, userId);
                lane2FlightObj = ScannerFlights.FirstOrDefault(sf => sf.LaneId == laneId);
            }

            return(lane2FlightObj);
        }
Example #2
0
 //need change this method
 private bool CountCarInLane(DataSeed ds, int userId, ScannerFlight lane2FlightObj, string DriverLicense)
 {
     if (ds.GetDismissalCountInLane(lane2FlightObj.Flight2LaneId, DriverLicense) >= CarPerLane)
     {
         CloseLane(lane2FlightObj.LaneId);
         // check if scannerFlight has lane with same Id, if not create new Flight
         /*******************************************/
         if (ScannerFlights.FirstOrDefault(p => p.LaneId == lane2FlightObj.LaneId) == null)
         {
             CreateNewFlight(ds, userId);
         }
         return(true);
     }
     return(false);
 }
Example #3
0
        public void CloseLane(int laneId)
        {
            ScannerFlight l2fObj = null;

            using (var ds = new DataSeed()) {
                l2fObj = ScannerFlights.FirstOrDefault(p => p.LaneId == laneId);
                if (l2fObj == null)
                {
                    return;
                }
                ds.CloseLane(l2fObj.Flight2LaneId);
                ScannerFlights.Remove(l2fObj);
                if (ScannerFlights.Where(s => s.FlightId == l2fObj.FlightId).Count() == 0)
                {
                    ds.ChangeFlightStatus(l2fObj.FlightId, (int)Enums.FlightStatus.Closed);
                    CloseFlightId = l2fObj.FlightId;
                    Flights.FirstOrDefault(f => f.Id == l2fObj.FlightId).StatusId = 2;
                }
                CloseLaneStatus = "The " + Lanes.FirstOrDefault(p => p.Id == laneId)?.Color + " Lane from Flight " + l2fObj.FlightNumber + " was closed.";
            }
        }