private List<SpecialService> GetSpecialService(FlightRequest objFlightRequest, PaxWiseFareIdResult objPaxWiseFareIdResult, Person person)
        {
            List<SpecialService> colSpecialService = new List<SpecialService>();
            if (person.PTCID != 5)
            {
                //Baggage
                var BaggageRequested = objPaxWiseFareIdResult.EnumFlightType == FlightType.Inbound ? objFlightRequest.InboundBaggage : objFlightRequest.OutboundBaggage;

                if (!String.IsNullOrEmpty(BaggageRequested) && objPaxWiseFareIdResult.Cabin == EnumCabin.Economy.ToString())
                {
                    colSpecialService.Add(new SpecialService()
                    {
                        CodeType = BaggageRequested,
                        ServiceID = -2147483648,
                        SSRCategory = 99,
                        LogicalFlightID = objPaxWiseFareIdResult.LFID,
                        DepartureDate = objPaxWiseFareIdResult.DepartureDate.Date,
                        Amount = (BaggageRequested == "BAGB" ? 50 : (BaggageRequested == "BAGL" ? 100 : 200)),
                        OverrideAmount = false,
                        CurrencyCode = ReservationService.EnumerationsCurrencyCodeTypes.AED,
                        PersonOrgID = person.PersonOrgID,
                        ChargeComment = string.Empty

                    });
                }

                //Meal
                var MealRequested = objPaxWiseFareIdResult.EnumFlightType == FlightType.Inbound ? objFlightRequest.InboundMeal : objFlightRequest.OutboundMeal;
                if (!String.IsNullOrEmpty(MealRequested))
                {

                    colSpecialService.Add(new SpecialService()
                    {
                        CodeType = MealRequested,
                        ServiceID = -2147483648,
                        SSRCategory = 162,
                        LogicalFlightID = objPaxWiseFareIdResult.LFID,
                        DepartureDate = objPaxWiseFareIdResult.DepartureDate.Date,
                        Amount = 50,
                        OverrideAmount = false,
                        CurrencyCode = ReservationService.EnumerationsCurrencyCodeTypes.AED,
                        PersonOrgID = person.PersonOrgID,
                        ChargeComment = string.Empty

                    });
                }

                //IFE
                if (objFlightRequest.IFE && objPaxWiseFareIdResult.Cabin == EnumCabin.Economy.ToString())
                {
                    colSpecialService.Add(new SpecialService()
                    {
                        CodeType = "IFPP",
                        ServiceID = -2147483648,
                        SSRCategory = 141,
                        LogicalFlightID = objPaxWiseFareIdResult.LFID,
                        DepartureDate = objPaxWiseFareIdResult.DepartureDate.Date,
                        Amount = 30,
                        OverrideAmount = false,
                        CurrencyCode = ReservationService.EnumerationsCurrencyCodeTypes.AED,
                        PersonOrgID = person.PersonOrgID,
                        ChargeComment = string.Empty

                    });
                }

            }
            return colSpecialService;
        }
        private List<SpacialServiceAndSeat> GetAvailableSeatForAllLegs(List<SeatsInfo> objSeatsInfo, PaxWiseFareIdResult item, Person person, ref List<AlreadyTakenSeat> AlreadyTakenSeat)
        {
            AlreadyTakenSeat previousSeat = new CreatePNR_AutomationApp.AlreadyTakenSeat();
            List<SpacialServiceAndSeat> colSpecialService = new List<SpacialServiceAndSeat>();
            foreach (var seatinfo in objSeatsInfo.ToArray())
            {
                if (seatinfo.IsCircular && previousSeat != null && previousSeat.PhysicalFlightID > 0 && seatinfo.PhysicalFlightID > 0)
                {
                    SeatCharge seata = new SeatCharge();
                    if (seatinfo.Seat_Charges != null)
                    {
                        seata = (from p in seatinfo.Seat_Charges
                                 where previousSeat.Row == p.RowNumber && previousSeat.SeatNumber == p.Seat
                                 select p).FirstOrDefault();
                    }
                    if (seata != null && seata.RowNumber != 0 && seata.Seat != string.Empty)
                    {
                        colSpecialService.Add(new SpacialServiceAndSeat()
                        {
                            Special_Service = new SpecialService()
                            {
                                CodeType = seata.ServiceCode.Trim(),
                                ServiceID = -2147483648,
                                SSRCategory = 21,
                                LogicalFlightID = item.LFID,
                                DepartureDate = item.DepartureDate.Date,
                                Amount = seata.Amount,
                                OverrideAmount = false,
                                CurrencyCode = ReservationService.EnumerationsCurrencyCodeTypes.AED,
                                PersonOrgID = person.PersonOrgID,
                                ChargeComment = string.Empty
                            },
                            Seat_Charges = seata,
                            PhysicalFlightID = seatinfo.PhysicalFlightID
                        });
                        AlreadyTakenSeat.Add(new AlreadyTakenSeat()
                        {
                            PhysicalFlightID = seatinfo.PhysicalFlightID,
                            Row = seata.RowNumber,
                            SeatNumber = seata.Seat
                        });
                    }
                    else
                    {
                        colSpecialService.Add(new SpacialServiceAndSeat()
                        {
                            Special_Service = new SpecialService()
                            {
                                CodeType = previousSeat.ServiceCode.Trim(),
                                ServiceID = -2147483648,
                                SSRCategory = 21,
                                LogicalFlightID = item.LFID,
                                DepartureDate = item.DepartureDate.Date,
                                Amount = previousSeat.Amount,
                                OverrideAmount = false,
                                CurrencyCode = ReservationService.EnumerationsCurrencyCodeTypes.AED,
                                PersonOrgID = person.PersonOrgID,
                                ChargeComment = string.Empty
                            },
                            Seat_Charges = previousSeat.Seat_Charges,
                            PhysicalFlightID = seatinfo.PhysicalFlightID
                        });
                        AlreadyTakenSeat.Add(new AlreadyTakenSeat()
                        {
                            PhysicalFlightID = seatinfo.PhysicalFlightID,
                            Row = previousSeat.Row,
                            SeatNumber = previousSeat.SeatNumber
                        });
                    }
                }
                else
                {
                    SeatCharge seat = new SeatCharge();
                    List<CreatePNR_AutomationApp.FlightService.SeatAssignment> assignedSeats = seatinfo.Seat_Assignment;
                    if (assignedSeats == null)
                        assignedSeats = new List<FlightService.SeatAssignment>();
                    if (AlreadyTakenSeat != null && AlreadyTakenSeat.Count > 0)
                    {
                        var seatForPhysicalFlight = (from p in AlreadyTakenSeat
                                                     where p.PhysicalFlightID == seatinfo.PhysicalFlightID
                                                     select p).ToList();
                        foreach (var takenitem in seatForPhysicalFlight)
                        {

                            assignedSeats.Add(new FlightService.SeatAssignment()
                            {
                                Seat = takenitem.SeatNumber,
                                RowNumber = takenitem.Row
                            });

                        }

                    }
                    if (assignedSeats != null && assignedSeats.Count > 0)
                    {
                        //seat = (from p in seatinfo.Seat_Charges
                        //        join
                        //            c in assignedSeats on
                        //            new { p.Seat, p.RowNumber } equals new { c.Seat, c.RowNumber }
                        //        where (c.RowNumber != p.RowNumber && c.Seat != p.Seat)
                        //        select p).FirstOrDefault();
                        if (seatinfo.Seat_Charges != null)
                            seat = (from p in seatinfo.Seat_Charges
                                    where !assignedSeats.Any(x => x.RowNumber == p.RowNumber && x.Seat == p.Seat)
                                    select p).FirstOrDefault();

                    }
                    else
                    {
                        if (seatinfo.Seat_Charges != null)
                            seat = (from p in seatinfo.Seat_Charges
                                    select p).FirstOrDefault();
                    }
                    if (seat != null && seat.RowNumber != 0 && seat.Seat != string.Empty)
                    {

                        colSpecialService.Add(new SpacialServiceAndSeat()
                        {
                            Special_Service = new SpecialService()
                            {
                                CodeType = seat.ServiceCode.Trim(),
                                ServiceID = -2147483648,
                                SSRCategory = 21,
                                LogicalFlightID = item.LFID,
                                DepartureDate = item.DepartureDate.Date,
                                Amount = seat.Amount,
                                OverrideAmount = false,
                                CurrencyCode = ReservationService.EnumerationsCurrencyCodeTypes.AED,
                                PersonOrgID = person.PersonOrgID,
                                ChargeComment = string.Empty
                            },
                            Seat_Charges = seat,
                            PhysicalFlightID = seatinfo.PhysicalFlightID
                        });
                        AlreadyTakenSeat.Add(new AlreadyTakenSeat()
                        {
                            PhysicalFlightID = seatinfo.PhysicalFlightID,
                            Row = seat.RowNumber,
                            SeatNumber = seat.Seat
                        });
                        previousSeat.Seat_Charges = seat;
                        previousSeat.ServiceCode = seat.ServiceCode;
                        previousSeat.Amount = seat.Amount;
                        previousSeat.PhysicalFlightID = seatinfo.PhysicalFlightID;
                        previousSeat.Row = seat.RowNumber;
                        previousSeat.SeatNumber = seat.Seat;

                    }
                }
            }
            return colSpecialService;
        }