Beispiel #1
0
        public static void GetAvailability1(string source, string destination, string ddate, string returndate, string waytype, string noofPassenger)
        {
            IBookingManager         bookingManager = new BookingManagerClient();
            string                  signature      = Login();
            GetAvailabilityRequest  gar            = new GetAvailabilityRequest();
            TripAvailabilityRequest tar            = new TripAvailabilityRequest();
            AvailabilityRequest     ar             = new AvailabilityRequest();

            ar.DepartureStation = source;      // "DEL";// HttpContext.Current.Session["origin"].ToString();
            ar.ArrivalStation   = destination; // "BOM";// HttpContext.Current.Session["destination"].ToString();
            //string[] date = ddate.Split('/');// HttpContext.Current.Session["ddate"].ToString().Split('/');
            //int year = int.Parse(date[2]), month = int.Parse(date[1]), day = int.Parse(date[0]);
            int year = int.Parse(ddate.Substring(0, 4)), month = int.Parse(ddate.Substring(4, 2)), day = int.Parse(ddate.Substring(6));

            ar.BeginDate  = new DateTime(year, month, day); //Convert.ToDateTime("2015-07-07");
            ar.EndDate    = new DateTime(year, month, day);
            ar.FlightType = FlightType.Direct;
            //ar.FlightNumber = b.FlightNo.Length == 3 ? " " + b.FlightNo : b.FlightNo;
            int pax = Convert.ToInt16(noofPassenger);//+ Convert.ToInt16(page.child);

            ar.PaxCount                 = Convert.ToSByte(pax);
            ar.Dow                      = DOW.Daily;
            ar.CurrencyCode             = "INR";
            ar.AvailabilityType         = AvailabilityType.Default;   //change 15 oct 2015
            ar.MaximumConnectingFlights = 5;
            ar.AvailabilityFilter       = AvailabilityFilter.Default; //change
            ar.FareClassControl         = FareClassControl.LowestFareClass;
            ar.MinimumFarePrice         = 0;
            ar.MaximumFarePrice         = 0;
            ar.SSRCollectionsMode       = SSRCollectionsMode.None;
            ar.InboundOutbound          = InboundOutbound.None;
            ar.NightsStay               = 0;
            ar.IncludeAllotments        = false;
            ar.FareTypes                = new string[1];// change
            ar.FareTypes[0]             = "R";

            //ar.FareTypes = new string[1];// change
            //ar.FareTypes[0] = "BD";
            //ar.ProductClasses = new string[1];
            //ar.ProductClasses[0] = "BD";
            PaxPriceType[] priceTypes = new PaxPriceType[ar.PaxCount];
            for (int i = 0; i < ar.PaxCount; i++)
            {
                priceTypes[i]                 = new PaxPriceType();
                priceTypes[i].PaxType         = "ADT";
                priceTypes[i].PaxDiscountCode = String.Empty;
            }
            ar.PaxPriceTypes       = priceTypes;
            ar.IncludeTaxesAndFees = false;
            ar.FareRuleFilter      = FareRuleFilter.Default;
            ar.LoyaltyFilter       = LoyaltyFilter.MonetaryOnly;
            if (!string.IsNullOrEmpty(returndate))// for round trip
            {
                AvailabilityRequest rar = new AvailabilityRequest();
                rar.DepartureStation = destination; // "DEL";// HttpContext.Current.Session["origin"].ToString();
                rar.ArrivalStation   = source;      // "BOM";// HttpContext.Current.Session["destination"].ToString();
                //string[] date = ddate.Split('/');// HttpContext.Current.Session["ddate"].ToString().Split('/');
                //int year = int.Parse(date[2]), month = int.Parse(date[1]), day = int.Parse(date[0]);
                int ryear = int.Parse(returndate.Substring(0, 4)), rmonth = int.Parse(returndate.Substring(4, 2)), rday = int.Parse(returndate.Substring(6));
                rar.BeginDate  = new DateTime(ryear, rmonth, rday); //Convert.ToDateTime("2015-07-07");
                rar.EndDate    = new DateTime(ryear, rmonth, rday);
                rar.FlightType = FlightType.Direct;
                //ar.FlightNumber = b.FlightNo.Length == 3 ? " " + b.FlightNo : b.FlightNo;
                int rpax = Convert.ToInt16(noofPassenger);//+ Convert.ToInt16(page.child);
                rar.PaxCount                 = Convert.ToSByte(rpax);
                rar.Dow                      = DOW.Daily;
                rar.CurrencyCode             = "INR";
                rar.AvailabilityType         = AvailabilityType.Default;   //change 15 oct 2015
                rar.MaximumConnectingFlights = 5;
                rar.AvailabilityFilter       = AvailabilityFilter.Default; //change
                rar.FareClassControl         = FareClassControl.LowestFareClass;
                rar.MinimumFarePrice         = 0;
                rar.MaximumFarePrice         = 0;
                rar.SSRCollectionsMode       = SSRCollectionsMode.None;
                rar.InboundOutbound          = InboundOutbound.None;
                rar.NightsStay               = 0;
                rar.IncludeAllotments        = false;
                rar.FareTypes                = new string[1];// change
                rar.FareTypes[0]             = "R";

                //ar.FareTypes = new string[1];// change
                //ar.FareTypes[0] = "BD";
                //ar.ProductClasses = new string[1];
                //ar.ProductClasses[0] = "BD";
                PaxPriceType[] rpriceTypes = new PaxPriceType[ar.PaxCount];
                for (int i = 0; i < ar.PaxCount; i++)
                {
                    rpriceTypes[i]                 = new PaxPriceType();
                    rpriceTypes[i].PaxType         = "ADT";
                    rpriceTypes[i].PaxDiscountCode = String.Empty;
                }
                rar.PaxPriceTypes           = rpriceTypes;
                rar.IncludeTaxesAndFees     = false;
                rar.FareRuleFilter          = FareRuleFilter.Default;
                rar.LoyaltyFilter           = LoyaltyFilter.MonetaryOnly;
                tar.AvailabilityRequests    = new AvailabilityRequest[2];
                tar.AvailabilityRequests[0] = ar;
                tar.AvailabilityRequests[1] = rar;
            }
            else
            {
                tar.AvailabilityRequests    = new AvailabilityRequest[1];
                tar.AvailabilityRequests[0] = ar;
            }
            tar.LoyaltyFilter           = LoyaltyFilter.MonetaryOnly;
            gar.TripAvailabilityRequest = tar;
            gar.Signature       = signature;
            gar.ContractVersion = 0;
            GetAvailabilityResponse gare = bookingManager.GetAvailability(gar);

            //if (waytype == "1")
            GetPrice(signature, gare, noofPassenger);
            //if (waytype == "2")
            //    GetPriceReturn(signature, gare,page);
        }
 public async Task <IActionResult> Get([FromQuery] TripAvailabilityRequest request)
 {
     return(new OkObjectResult(await _flightsService.FindFlights(request)));
 }