コード例 #1
0
ファイル: PNRInfo.cs プロジェクト: 842549829/Pool
        private void reviseAirportFee(decimal totalAirportFee)
        {
            decimal airportFeeTotalBalance = Flights.Sum(item => item.AirportFee) - totalAirportFee;

            if (airportFeeTotalBalance == 0)
            {
                return;
            }
            int     flightCount = Flights.Count();
            decimal average     = Calculator.Round(totalAirportFee / flightCount, 0);
            int     flightIndex = 0;
            decimal apportioned = 0;

            foreach (Flight flight in Flights)
            {
                flightIndex++;
                if (flightIndex == flightCount)
                {
                    flight.AirportFee = totalAirportFee - apportioned;
                }
                else
                {
                    flight.AirportFee = average;
                }
                apportioned += average;
            }
        }
コード例 #2
0
ファイル: PNRInfo.cs プロジェクト: 842549829/Pool
        private void reviseFare(decimal totalFare)
        {
            decimal fareTotalBalance = Flights.Sum(item => item.Bunk.Fare) - totalFare;

            if (fareTotalBalance == 0)
            {
                return;
            }
            int     flightCount    = Flights.Count();
            decimal averageBalance = Calculator.Round(fareTotalBalance / flightCount, 1);
            int     flightIndex    = 0;
            decimal apportioned    = 0;

            foreach (Flight flight in Flights)
            {
                flightIndex++;
                if (flightIndex == flightCount)
                {
                    flight.ReviseFare(flight.Price.Fare - (fareTotalBalance - apportioned));
                }
                else
                {
                    flight.ReviseFare(flight.Bunk.Fare - averageBalance);
                }
                apportioned += averageBalance;
            }
        }
コード例 #3
0
 private void SetCurrentFlight(DataSeed ds, int userId)
 {
     if (Flights == null || Flights.Count() == 0)
     {
         FlightNumber = ds.GetLastFlightNumberFromArchive(SchoolId) + 1;
         return;
         //CreateNewFlight(1, ds, userId);
     }
     else
     {
         var openFlights = Flights.Where(p => p.StatusId == (int)Enums.FlightStatus.Open).ToList();
         if (openFlights != null)
         {
             foreach (var item in openFlights)
             {
                 var lanes2Fights = ds.GetLanes2FlightsByFlightId(SchoolId, item.Id, userId);
                 for (int i = 0; i < lanes2Fights.Count(); i++)
                 {
                     var l2fObj = lanes2Fights.ElementAt(i);
                     if (l2fObj.StatusId == (int)Enums.LaneStatus.Closed)
                     {
                         lanes2Fights.Remove(l2fObj);
                         i--;
                     }
                     else
                     {
                         ScannerFlights.Add(new ScannerFlight
                         {
                             FlightId        = item.Id,
                             FlightNumber    = item.Number,
                             Flight2LaneId   = l2fObj.Id,
                             LaneId          = l2fObj.LaneId,
                             LaneStatusId    = l2fObj.StatusId,
                             CountCarsInLane = ds.GetCountCardsByLane2FlightId(l2fObj.Id)
                         });
                     }
                 }
             }
         }
         FlightNumber = ds.GetFlightNumber(SchoolId) + 1;
     }
 }