Esempio n. 1
0
 void setFlights(PostponeApplyformView postponeApplyformView)
 {
     if (postponeApplyformView.Items != null)
     {
         var pnrInfo = this.Order.PNRInfos.First(item => item.IsSamePNR(postponeApplyformView.PNR));
         foreach (var item in postponeApplyformView.Items)
         {
             if (item != null)
             {
                 var originalFlight = pnrInfo.Flights.FirstOrDefault(flight => flight.Id == item.Voyage);
                 if (originalFlight == null)
                 {
                     throw new NotFoundException("原编码中不存在航段信息。" + item.Voyage);
                 }
                 var postponeFlight = new PostponeFlight()
                 {
                     OriginalFlight = originalFlight,
                     NewFlight      = originalFlight.Copy()
                 };
                 postponeFlight.NewFlight.FlightNo    = item.NewFlightNo;
                 postponeFlight.NewFlight.TakeoffTime = item.NewFlightDate;
                 this.AddFlight(postponeFlight);
             }
         }
     }
     if (!this.Flights.Any())
     {
         throw new CustomException("缺少航段信息");
     }
 }
Esempio n. 2
0
 internal void AddFlight(PostponeFlight flight)
 {
     if (flight == null)
     {
         throw new ArgumentNullException("flight");
     }
     if (flight.OriginalFlight == null)
     {
         throw new ArgumentNullException("flight.OriginalFlight");
     }
     if (_flights.Exists(item => item.OriginalFlight.Id == flight.OriginalFlight.Id || Flight.IsSameFlight(flight.OriginalFlight, item.OriginalFlight)))
     {
         throw new RepeatedItemException("不能重复添加相同航段");
     }
     _flights.Add(flight);
 }