private void bindProcessInfo(RefundOrScrapApplyform applyform)
        {
            var passenagerCount = applyform.Passengers.Count();

            hdPassengerCount.Value = passenagerCount.ToString();
            ChinaPay.B3B.Service.Order.Domain.Order order = applyform.Order;
            decimal CommissionRate = applyform.Order.Bill.PayBill.Provider.Source.Fare == 0
                                         ? 0
                                         : Math.Abs(applyform.Order.Bill.PayBill.Provider.Source.Commission) / applyform.Order.Bill.PayBill.Provider.Source.Fare;
            var flightsPassengerRelation = applyform.Flights.OrderBy(f => f.OriginalFlight.Serial)
                                           .Select(flightInfo =>
            {
                var bill         = applyform.RefundBill.Purchaser.Source.Details.First(f => f.Flight.Id == flightInfo.OriginalFlight.ReservateFlight);
                var maxRufundFee = bill != null ? bill.Anticipation : short.MaxValue;
                return
                (new
                {
                    Refunded = bill.Amount,
                    RefundFee = Math.Abs(bill.RefundFee),
                    RefundReate = (bill.RefundRate * 100).ToString("0.00"),
                    Flight = flightInfo,
                    flightId = flightInfo.OriginalFlight.Id,
                    Departure = flightInfo.OriginalFlight.Departure.Name,
                    Arrival = flightInfo.OriginalFlight.Arrival.Name,
                    Carrier = flightInfo.OriginalFlight.Carrier.Code,
                    flightInfo.OriginalFlight.FlightNo,
                    TicketPrice = flightInfo.OriginalFlight.Price.Fare,
                    flightInfo.OriginalFlight.Id,
                    Bunk = flightInfo.OriginalFlight.Bunk.Code,
                    TakeoffTime =
                        flightInfo.OriginalFlight.TakeoffTime.ToString("yyyy-MM-dd"),
                    Rate = string.Empty,
                    Fee = string.Empty,
                    Total = string.Empty,
                    PassengerCount = passenagerCount,
                    EI = getEI(flightInfo.OriginalFlight, applyform.Order),
                    TripType = order.TripType.GetDescription(),
                    RenderServiceCharge = IsSpeical && !order.IsThirdRelation,
                    Seaial = CNIndex[flightInfo.OriginalFlight.Serial],
                    Passengers = from p in applyform.Passengers
                                 let serviceCharge = getServiceCharge(p)
                                                     let ticket = p.Tickets.First(
                        t => t.Flights
                        .Any(f => f.ReservateFlight == flightInfo.OriginalFlight.ReservateFlight))
                                                                  select new
                    {
                        first = bill.Anticipation,
                        p.Name,
                        No = ticket == null ? string.Empty : ticket.SettleCode + "-" + ticket.No,
                        PassengerType =
                            p.PassengerType.GetDescription(),
                        flightInfo.OriginalFlight.Price.AirportFee,
                        flightInfo.OriginalFlight.Price.BAF,
                        TicketPrice =
                            flightInfo.OriginalFlight.Price.Fare,
                        YingShou =
                            flightInfo.OriginalFlight.Price.Total -
                            (CommissionRate *
                             flightInfo.OriginalFlight.Price.Fare),
                        Rate = string.Empty,
                        Fee = string.Empty,
                        AirportPair = string.Format("{0}-{1}",
                                                    flightInfo.OriginalFlight.Departure.Code,
                                                    flightInfo.OriginalFlight.Arrival.Code),
                        TotalRefund = string.Empty,
                        RenderServiceCharge =
                            IsSpeical && !order.IsThirdRelation,
                        p.CredentialsType,
                        RefundServiceCharge =
                            flightInfo.RefundServiceCharge == 0
                                             ? string.Format("{0}(不退)", serviceCharge)
                                             : serviceCharge ==
                            flightInfo.RefundServiceCharge
                                                   ? string.Format("{0}(全退)",
                                                                   flightInfo.RefundServiceCharge ?? 0)
                                                   : string.Format("{0}(退{1})",
                                                                   serviceCharge,
                                                                   flightInfo.
                                                                   RefundServiceCharge ?? 0),
                        Commission =
                            IsSpeical
                                             ? "0"
                                             : (CommissionRate *
                                                flightInfo.OriginalFlight.Price.Fare).
                            TrimInvaidZero(),
                        //是否是特殊票,民航基金,燃油,佣金
                        StrFee =
                            string.Format(
                                "parameters={{IsSpeical:{0},AirportFee:{1},BAF:{2},Commission:{3},Price:{4},ServiceCharge:{5},maxRufundFee:{6}}}",
                                IsSpeical ? 1 : 0,
                                flightInfo.OriginalFlight.Price.AirportFee,
                                flightInfo.OriginalFlight.Price.BAF,
                                (IsSpeical
                                                  ? 0
                                                  : CommissionRate *
                                 flightInfo.OriginalFlight.Price.Fare).
                                TrimInvaidZero(),
                                flightInfo.OriginalFlight.Price.Fare,
                                0,
                                maxRufundFee
                                )
                    }
                });
            }
                                                   );

            RefundInfos.DataSource = flightsPassengerRelation;
            RefundInfos.DataBind();
        }
Exemple #2
0
        private void bindPassengers(RefundApplyform applyform)
        {
            int   passenagerCount     = applyform.Passengers.Count();
            Order order               = applyform.Order;
            bool  returnServiceCharge = IsSpeical && !order.IsThirdRelation &&
                                        (applyform.RefundType == RefundType.Involuntary || (order.IsSpecial && applyform.RefundType == RefundType.SpecialReason));

            MutilFlightTip.Visible = order.TripType != ItineraryType.OneWay; //多段航程显示价格修改提示
            decimal CommissionRate = applyform.Order.Bill.PayBill.Provider.Source.Fare == 0
                                         ? 0
                                         : Math.Abs(applyform.Order.Bill.PayBill.Provider.Source.Commission) / applyform.Order.Bill.PayBill.Provider.Source.Fare;
            var flightsPassengerRelation = applyform.Flights.OrderBy(f => f.OriginalFlight.Serial)
                                           .Select(flightInfo =>
            {
                var bill         = applyform.Order.Bill.PayBill.Provider.Source.Details.First(f => f.Flight.Id == flightInfo.OriginalFlight.ReservateFlight);
                var maxRufundFee = bill != null?bill.Anticipation:short.MaxValue;
                return
                (new
                {
                    Flight = flightInfo,
                    Departure = flightInfo.OriginalFlight.Departure.Name,
                    Arrival = flightInfo.OriginalFlight.Arrival.Name,
                    Carrier = flightInfo.OriginalFlight.Carrier.Code,
                    flightInfo.OriginalFlight.FlightNo,
                    TicketPrice = flightInfo.OriginalFlight.Price.Fare,
                    flightInfo.OriginalFlight.Id,
                    Bunk = flightInfo.OriginalFlight.Bunk.Code,
                    TakeoffTime =
                        flightInfo.OriginalFlight.TakeoffTime.ToString("yyyy-MM-dd"),
                    Rate = string.Empty,
                    RefundFee = string.Empty,
                    Fee = string.Empty,
                    Total = string.Empty,
                    PassengerCount = passenagerCount,
                    EI = getEI(flightInfo.OriginalFlight, applyform.Order),
                    TripType = order.TripType.GetDescription(),
                    RenderServiceCharge = IsSpeical && !order.IsThirdRelation,
                    Seaial = CNIndex[flightInfo.OriginalFlight.Serial],
                    Passengers = from p in applyform.Passengers
                                 let serviceCharge = getServiceCharge(p)
                                                     let ticket = p.Tickets.First(
                        t => t.Flights
                        .Any(f => f.ReservateFlight == flightInfo.OriginalFlight.ReservateFlight))
                                                                  select new
                    {
                        p.Name,
                        No = ticket == null?string.Empty:ticket.SettleCode + "-" + ticket.No,
                        PassengerType =
                            p.PassengerType.GetDescription(),
                        flightInfo.OriginalFlight.Price.AirportFee,
                        flightInfo.OriginalFlight.Price.BAF,
                        TicketPrice =
                            flightInfo.OriginalFlight.Price.Fare,
                        YingShou =
                            flightInfo.OriginalFlight.Price.Total -
                            (CommissionRate *
                             flightInfo.OriginalFlight.Price.Fare),
                        Rate = string.Empty,
                        Fee = string.Empty,
                        AirportPair = string.Format("{0}-{1}",
                                                    flightInfo.OriginalFlight.Departure.Code,
                                                    flightInfo.OriginalFlight.Arrival.Code),
                        TotalRefund = string.Empty,
                        RenderServiceCharge =
                            IsSpeical && !order.IsThirdRelation,
                        p.CredentialsType,
                        RefundServiceCharge =
                            flightInfo.RefundServiceCharge == 0
                                                                 ? string.Format("{0}(不退)", serviceCharge)
                                                                 : serviceCharge ==
                            flightInfo.RefundServiceCharge
                                                                       ? string.Format("{0}(全退)",
                                                                                       flightInfo.RefundServiceCharge ?? 0)
                                                                       : string.Format("{0}(退{1})",
                                                                                       serviceCharge,
                                                                                       flightInfo.
                                                                                       RefundServiceCharge ?? 0),
                        Commission =
                            IsSpeical
                                                                 ? "0"
                                                                 : (CommissionRate *
                                                                    flightInfo.OriginalFlight.Price.Fare).
                            TrimInvaidZero(),
                        returnServiceCharge,
                        //是否是特殊票,民航基金,燃油,佣金
                        StrFee =
                            string.Format(
                                "parameters={{IsSpeical:{0},AirportFee:{1},BAF:{2},Commission:{3},Price:{4},ServiceCharge:{5},maxRufundFee:{6}}}",
                                IsSpeical ? 1 : 0,
                                flightInfo.OriginalFlight.Price.AirportFee,
                                flightInfo.OriginalFlight.Price.BAF,
                                (IsSpeical
                                                                      ? 0
                                                                      : CommissionRate *
                                 flightInfo.OriginalFlight.Price.Fare).
                                TrimInvaidZero(),
                                flightInfo.OriginalFlight.Price.Fare,
                                returnServiceCharge
                                                                     ? flightInfo.RefundServiceCharge ?? 0
                                                                     : 0, maxRufundFee)
                    }
                });
            }
                                                   );


            RefundInfos.DataSource = flightsPassengerRelation;
            RefundInfos.DataBind();
            FeeInputEnabled        = applyform.RefundType != RefundType.Involuntary && applyform.RefundType != RefundType.Upgrade;
            this.hfdTradeFee.Value = order.Bill.PayBill.Provider.Owner.Rate.ToString();
        }