コード例 #1
0
        private void saveround(object sender, EventArgs e)
        {
        try
        {
            DataSet ds = new DataSet();
            FlightBAL objFlightsBal = new FlightBAL();
            string ReferenceNo = Convert.ToString(Session["Order_Id"]);
            DataSet dtid = objFlightsBal.IGetInternationalFlightDetails(ReferenceNo);

            id1 = dtid.Tables[0].Rows[0]["id"].ToString();
            key = dtid.Tables[0].Rows[0]["Key1"].ToString();
            string[] strfare = dtid.Tables[0].Rows[0]["ActualBasefare"].ToString().Split('.');
            actualBaseFare = strfare[0].ToString();
            string[] strtax = dtid.Tables[0].Rows[0]["Tax"].ToString().Split('.');
            tax = strtax[0].ToString();
            string[] strstax = dtid.Tables[0].Rows[0]["STax"].ToString().Split('.');
            Stax = strstax[0].ToString();
            string[] strscharge = dtid.Tables[0].Rows[0]["Scharge"].ToString().Split('.');
            SCharge = strscharge[0].ToString();
            string[] strtdis = dtid.Tables[0].Rows[0]["TDiscount"].ToString().Split('.');
            TDiscount = strtdis[0].ToString();
            string[] strtcomm = dtid.Tables[0].Rows[0]["TPartnerCommission"].ToString().Split('.');
            TPartnerCommission = strtcomm[0].ToString();
            string[] strtsdis = dtid.Tables[0].Rows[0]["TSDiscount"].ToString().Split('.');
            TSdiscount = strtsdis[0].ToString();

            string[] strmark = dtid.Tables[0].Rows[0]["TMarkUp"].ToString().Split('.');
            TMarkup = strmark[0].ToString();
            string[] strtcharge = dtid.Tables[0].Rows[0]["TCharge"].ToString().Split('.');
            TCharge = strtcharge[0].ToString();

            idRet = dtid.Tables[0].Rows[0]["idRet"].ToString();
            keyRet = dtid.Tables[0].Rows[0]["Key1Ret"].ToString();
            string[] strfareRet = dtid.Tables[0].Rows[0]["ActualBasefareRet"].ToString().Split('.');
            actualBaseFareRet = strfareRet[0].ToString();
            string[] strtaxRet = dtid.Tables[0].Rows[0]["TaxRet"].ToString().Split('.');
            taxRet = strtaxRet[0].ToString();
            string[] strstaxRet = dtid.Tables[0].Rows[0]["STaxRet"].ToString().Split('.');
            StaxRet = strstaxRet[0].ToString();
            string[] strschargeRet = dtid.Tables[0].Rows[0]["SchargeRet"].ToString().Split('.');
            SChargeRet = strschargeRet[0].ToString();
            string[] strtdisRet = dtid.Tables[0].Rows[0]["TDiscountRet"].ToString().Split('.');
            TDiscountRet = strtdisRet[0].ToString();
            string[] strtcommRet = dtid.Tables[0].Rows[0]["TPartnerCommissionRet"].ToString().Split('.');
            TPartnerCommissionRet = strtcommRet[0].ToString();
            string[] strtsdisRet = dtid.Tables[0].Rows[0]["TSDiscountRet"].ToString().Split('.');
            TSdiscountRet = strtsdisRet[0].ToString();

            string[] strmarkRet = dtid.Tables[0].Rows[0]["TMarkUpRet"].ToString().Split('.');
            TMarkupRet = strmarkRet[0].ToString();
            string[] strtchargeRet = dtid.Tables[0].Rows[0]["TChargeRet"].ToString().Split('.');
            TChargeRet = strtchargeRet[0].ToString();

            //   octax = dtid.Tables[0].Rows[0]["Octax"].ToString();
            Customer_Details = dtid.Tables[0].Rows[0]["Customer_Details"].ToString();
            telephone = dtid.Tables[0].Rows[0]["telephone"].ToString();
            emailAddress = dtid.Tables[0].Rows[0]["emailAddress"].ToString();

            adultcnt = Convert.ToInt32(dtid.Tables[0].Rows[0]["AdultPax"]);
            infantCnt = Convert.ToInt32(dtid.Tables[0].Rows[0]["InfantPax"]);
            childCnt = Convert.ToInt32(dtid.Tables[0].Rows[0]["ChildPax"]);
            refNo = dtid.Tables[0].Rows[0]["ReferenceNo"].ToString();

            string ReferenceNo1 = dtid.Tables[0].Rows[0]["Dom_Booking_Id"].ToString();
            DataSet dsdbsave = objFlightsBal.GetInternationalFlightDetailsI1(ReferenceNo1);
            //1st row

            AirEquipType = dsdbsave.Tables[0].Rows[0]["AirEquipType"].ToString();
            ArrivalAirportCode = dsdbsave.Tables[0].Rows[0]["ArrivalAirportCode"].ToString();
            // ArrivalAirportName = dsdbsave.Tables[0].Rows[0]["ArrivalAirportName"].ToString();
            ArrivalDateTime = dsdbsave.Tables[0].Rows[0]["ArrivalDateTime"].ToString();
            DepartureAirportCode = dsdbsave.Tables[0].Rows[0]["DepartureAirportCode"].ToString();
            //  DepartureAirportName = dsdbsave.Tables[0].Rows[0]["DepartureAirportName"].ToString();
            DepartureDateTime = dsdbsave.Tables[0].Rows[0]["DepartureDateTime"].ToString();
            FlightNumber = dsdbsave.Tables[0].Rows[0]["FlightNumber"].ToString();
            // MarketingAirlineCode = dsdbsave.Tables[0].Rows[0]["MarketingAirlineCode"].ToString();
            OperatingAirlineCode = dsdbsave.Tables[0].Rows[0]["OperatingAirlineCode"].ToString();
            airLineName = dsdbsave.Tables[0].Rows[0]["airlineName"].ToString();
            OperatingAirlineFlightNumber = dsdbsave.Tables[0].Rows[0]["OperatingAirlineFlightNumber"].ToString();
            RPH = dsdbsave.Tables[0].Rows[0]["RPH"].ToString();
            StopQuantity = dsdbsave.Tables[0].Rows[0]["StopQuantity"].ToString();
            airportTax = dsdbsave.Tables[0].Rows[0]["airportTax"].ToString();
            imageFileName = dsdbsave.Tables[0].Rows[0]["imageFileName"].ToString();
            string[] strdis = dsdbsave.Tables[0].Rows[0]["Discount"].ToString().Split('.');
            Discount = strdis[0].ToString();
            airportTaxChild = dsdbsave.Tables[0].Rows[0]["airportTaxChild"].ToString();
            airportTaxInfant = dsdbsave.Tables[0].Rows[0]["airportTaxInfant"].ToString();
            airportTaxChild = dsdbsave.Tables[0].Rows[0]["airportTaxChild"].ToString();
            airportTaxInfant = dsdbsave.Tables[0].Rows[0]["airportTaxInfant"].ToString();
            childTaxBreakup = dsdbsave.Tables[0].Rows[0]["ChildTaxBreakUp"].ToString();
            infantTaxBreakup = dsdbsave.Tables[0].Rows[0]["InfantTaxBreakUp"].ToString();
            adultTaxBreakup = dsdbsave.Tables[0].Rows[0]["adultTaxBreakUp"].ToString();
            octax = dsdbsave.Tables[0].Rows[0]["ocTax"].ToString();
            BookingClassResBookDesigCode = dsdbsave.Tables[0].Rows[0]["ResBookingCode"].ToString();
            string[] stradultfare = dsdbsave.Tables[0].Rows[0]["adultFare"].ToString().Split('.');
            adultFare = stradultfare[0].ToString();

            BookingClassAvailability = dsdbsave.Tables[0].Rows[0]["Availability"].ToString();
            string[] strchildfare = dsdbsave.Tables[0].Rows[0]["ChildFare"].ToString().Split('.');
            childFare = strchildfare[0].ToString();
            bookingclass = dsdbsave.Tables[0].Rows[0]["bookingClass"].ToString();
            classType = dsdbsave.Tables[0].Rows[0]["ClassType"].ToString();
            farebasiscode = dsdbsave.Tables[0].Rows[0]["farebasisCode"].ToString();
            string[] strinffare = dsdbsave.Tables[0].Rows[0]["infantFare"].ToString().Split('.');
            infantfare = strinffare[0].ToString();

            Rule = dsdbsave.Tables[0].Rows[0]["Fare_Rule"].ToString();
            string[] stradultcomm = dsdbsave.Tables[0].Rows[0]["adultCommission"].ToString().Split('.');
            adultCommission = stradultcomm[0].ToString();
            string[] strchildcomm = dsdbsave.Tables[0].Rows[0]["childCommission"].ToString().Split('.');
            childCommission = strchildcomm[0].ToString();
            string[] strcommoncharge = dsdbsave.Tables[0].Rows[0]["CommissionOnTCharge"].ToString().Split('.');
            commissionOnTCharge = strcommoncharge[0].ToString();

            //2nd row

            AirEquipTypeRet = dsdbsave.Tables[0].Rows[1]["AirEquipType"].ToString();
            ArrivalAirportCodeRet = dsdbsave.Tables[0].Rows[1]["ArrivalAirportCode"].ToString();
            // ArrivalAirportName = dsdbsave.Tables[0].Rows[0]["ArrivalAirportName"].ToString();
            ArrivalDateTimeRet = dsdbsave.Tables[0].Rows[1]["ArrivalDateTime"].ToString();
            DepartureAirportCodeRet = dsdbsave.Tables[0].Rows[1]["DepartureAirportCode"].ToString();
            //  DepartureAirportName = dsdbsave.Tables[0].Rows[0]["DepartureAirportName"].ToString();
            DepartureDateTimeRet = dsdbsave.Tables[0].Rows[1]["DepartureDateTime"].ToString();
            FlightNumberRet = dsdbsave.Tables[0].Rows[1]["FlightNumber"].ToString();
            // MarketingAirlineCode = dsdbsave.Tables[0].Rows[0]["MarketingAirlineCode"].ToString();
            OperatingAirlineCodeRet = dsdbsave.Tables[0].Rows[1]["OperatingAirlineCode"].ToString();
            airLineNameRet = dsdbsave.Tables[0].Rows[1]["airlineName"].ToString();
            OperatingAirlineFlightNumberRet = dsdbsave.Tables[0].Rows[1]["OperatingAirlineFlightNumber"].ToString();
            RPHRet = dsdbsave.Tables[0].Rows[1]["RPH"].ToString();
            StopQuantityRet = dsdbsave.Tables[0].Rows[1]["StopQuantity"].ToString();
            airportTaxRet = dsdbsave.Tables[0].Rows[1]["airportTax"].ToString();
            imageFileNameRet = dsdbsave.Tables[0].Rows[1]["imageFileName"].ToString();
            string[] strdisRet = dsdbsave.Tables[0].Rows[1]["Discount"].ToString().Split('.');
            DiscountRet = strdisRet[0].ToString();
            airportTaxChildRet = dsdbsave.Tables[0].Rows[1]["airportTaxChild"].ToString();
            airportTaxInfantRet = dsdbsave.Tables[0].Rows[1]["airportTaxInfant"].ToString();
            airportTaxChildRet = dsdbsave.Tables[0].Rows[1]["airportTaxChild"].ToString();
            airportTaxInfantRet = dsdbsave.Tables[0].Rows[1]["airportTaxInfant"].ToString();
            childTaxBreakupRet = dsdbsave.Tables[0].Rows[1]["ChildTaxBreakUp"].ToString();
            infantTaxBreakupRet = dsdbsave.Tables[0].Rows[1]["InfantTaxBreakUp"].ToString();
            adultTaxBreakupRet = dsdbsave.Tables[0].Rows[0]["adultTaxBreakUp"].ToString();
            octaxRet = dsdbsave.Tables[0].Rows[1]["ocTax"].ToString();
            BookingClassResBookDesigCodeRet = dsdbsave.Tables[0].Rows[1]["ResBookingCode"].ToString();
            string[] stradultretfare = dsdbsave.Tables[0].Rows[1]["adultFare"].ToString().Split('.');
            adultFareRet = stradultretfare[0].ToString();

            BookingClassAvailabilityRet = dsdbsave.Tables[0].Rows[1]["Availability"].ToString();
            string[] strchildretfare = dsdbsave.Tables[0].Rows[1]["ChildFare"].ToString().Split('.');
            childFareRet = strchildretfare[0].ToString();
            bookingclassRet = dsdbsave.Tables[0].Rows[1]["bookingClass"].ToString();
            classTypeRet = dsdbsave.Tables[0].Rows[1]["ClassType"].ToString();
            farebasiscodeRet = dsdbsave.Tables[0].Rows[1]["farebasisCode"].ToString();
            string[] strinfantfareret = dsdbsave.Tables[0].Rows[1]["infantFare"].ToString().Split('.');
            infantfareRet = strinfantfareret[0].ToString();

            RuleRet = dsdbsave.Tables[0].Rows[1]["Fare_Rule"].ToString();
            string[] stracr = dsdbsave.Tables[0].Rows[1]["adultCommission"].ToString().Split('.');
            adultCommissionRet = stracr[0].ToString();
            string[] strccr = dsdbsave.Tables[0].Rows[1]["childCommission"].ToString().Split('.');
            childCommissionRet = strccr[0].ToString();
            string[] ctcr = dsdbsave.Tables[0].Rows[1]["CommissionOnTCharge"].ToString().Split('.');
            commissionOnTChargeRet = ctcr[0].ToString();

            //String XMLPricing = "<pricingrequest><onwardFlights><OriginDestinationOption><FareDetails><ChargeableFares><ActualBaseFare>" + actualBaseFare + "</ActualBaseFare><Tax>" + tax + "</Tax> <STax>" + Stax + "</STax><SCharge>" + SCharge + "</SCharge> <TDiscount>" + TDiscount + "</TDiscount><TPartnerCommission>" + TPartnerCommission + "</TPartnerCommission></ChargeableFares> <NonchargeableFares><TCharge>" + TCharge + "</TCharge> <TMarkup>" + TMarkup + "</TMarkup><TSdiscount>" + TDiscount + "</TSdiscount> </NonchargeableFares></FareDetails> <FlightSegments> <FlightSegment><AirEquipType>" + AirEquipType + "</AirEquipType><ArrivalAirportCode>" + ArrivalAirportCode + "</ArrivalAirportCode><ArrivalDateTime>" + ArrivalDateTime + "</ArrivalDateTime><DepartureAirportCode>" + DepartureAirportCode + "</DepartureAirportCode><DepartureDateTime>" + DepartureDateTime + "</DepartureDateTime><FlightNumber>" + FlightNumber + "</FlightNumber><OperatingAirlineCode>" + OperatingAirlineCode + "</OperatingAirlineCode><OperatingAirlineFlightNumber>" + OperatingAirlineFlightNumber + "</OperatingAirlineFlightNumber><RPH>" + RPH + "</RPH> <StopQuantity>" + StopQuantity + "</StopQuantity><airLineName>" + airLineName + "</airLineName><airportTax>" + airportTax + "</airportTax><imageFileName>" + imageFileName + "</imageFileName> <BookingClass><Availability>" + BookingClassAvailability + "</Availability><ResBookDesigCode>" + BookingClassResBookDesigCode + "</ResBookDesigCode> </BookingClass><BookingClassFare> <adultFare>" + adultFare + "</adultFare><bookingclass>" + bookingclass + "</bookingclass> <childFare>" + childFare + "</childFare><classType>" + classType + "</classType><farebasiscode>" + farebasiscode + "</farebasiscode><infantfare>" + infantfare + "</infantfare> <Rule>" + Rule + "</Rule><adultCommission>" + adultCommission + "</adultCommission><childCommission>" + childCommission + "</childCommission><commissionOnTCharge>" + commissionOnTCharge + "</commissionOnTCharge></BookingClassFare> <Discount>" + Discount + "</Discount><airportTaxChild>" + airportTaxChild + "</airportTaxChild><airportTaxInfant>" + airportTaxInfant + "</airportTaxInfant><adultTaxBreakup>" + adultTaxBreakup + "</adultTaxBreakup><childTaxBreakup>" + childTaxBreakup + "</childTaxBreakup><infantTaxBreakup>" + infantTaxBreakup + "</infantTaxBreakup><octax>" + octax + "</octax> </FlightSegment> </FlightSegments><id>" + id + "</id><key>" + key + "</key> </OriginDestinationOption></onwardFlights><returnFlights/> <telePhone>" + txtPhoneNum.Text + "</telePhone><email>" + txtEmailID.Text + "</email> <creditcardno></creditcardno><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooFWS1.1</Clienttype><AdultPax>" + adultcnt + "</AdultPax><ChildPax>" + childCnt + "</ChildPax><InfantPax>" + infantCnt + "</InfantPax></pricingrequest>";
            //DataSet dsFlightPricing = objFlights.GetPricingDetails(XMLPricing);
            #region Pricing

            String XMLPricing = "<pricingrequest><onwardFlights><OriginDestinationOption><FareDetails><ChargeableFares><ActualBaseFare>" + actualBaseFare + "</ActualBaseFare><Tax>" + tax + "</Tax> <STax>" + Stax + "</STax><SCharge>" + SCharge + "</SCharge> <TDiscount>" + TDiscount + "</TDiscount><TPartnerCommission>" + TPartnerCommission + "</TPartnerCommission></ChargeableFares> <NonchargeableFares><TCharge>" + TCharge + "</TCharge> <TMarkup>" + TMarkup + "</TMarkup><TSdiscount>" + TDiscount + "</TSdiscount> </NonchargeableFares></FareDetails> <FlightSegments> <FlightSegment><AirEquipType>" + AirEquipType + "</AirEquipType><ArrivalAirportCode>" + ArrivalAirportCode + "</ArrivalAirportCode><ArrivalDateTime>" + ArrivalDateTime + "</ArrivalDateTime><DepartureAirportCode>" + DepartureAirportCode + "</DepartureAirportCode><DepartureDateTime>" + DepartureDateTime + "</DepartureDateTime><FlightNumber>" + FlightNumber + "</FlightNumber><OperatingAirlineCode>" + OperatingAirlineCode + "</OperatingAirlineCode><OperatingAirlineFlightNumber>" + OperatingAirlineFlightNumber + "</OperatingAirlineFlightNumber><RPH>" + RPH + "</RPH> <StopQuantity>" + StopQuantity + "</StopQuantity><airLineName>" + airLineName + "</airLineName><airportTax>" + airportTax + "</airportTax><imageFileName>" + imageFileName + "</imageFileName> <BookingClass><Availability>" + BookingClassAvailability + "</Availability><ResBookDesigCode>" + BookingClassResBookDesigCode + "</ResBookDesigCode> </BookingClass><BookingClassFare> <adultFare>" + adultFare + "</adultFare><bookingclass>" + bookingclass + "</bookingclass> <childFare>" + childFare + "</childFare><classType>" + classType + "</classType><farebasiscode>" + farebasiscode + "</farebasiscode><infantfare>" + infantfare + "</infantfare> <Rule>" + Rule + "</Rule><adultCommission>" + adultCommission + "</adultCommission><childCommission>" + childCommission + "</childCommission><commissionOnTCharge>" + commissionOnTCharge + "</commissionOnTCharge></BookingClassFare> <Discount>" + Discount + "</Discount><airportTaxChild>" + airportTaxChild + "</airportTaxChild><airportTaxInfant>" + airportTaxInfant + "</airportTaxInfant><adultTaxBreakup>" + adultTaxBreakup + "</adultTaxBreakup><childTaxBreakup>" + childTaxBreakup + "</childTaxBreakup><infantTaxBreakup>" + infantTaxBreakup + "</infantTaxBreakup><octax>" + octax + "</octax> </FlightSegment> </FlightSegments><id>" + id1 + "</id><key>" + key + "</key> </OriginDestinationOption></onwardFlights>";

            XMLPricing = XMLPricing + "<returnFlights><OriginDestinationOption><FareDetails><ChargeableFares><ActualBaseFare>" + actualBaseFareRet + "</ActualBaseFare><Tax>" + taxRet + "</Tax> <STax>" + StaxRet + "</STax><SCharge>" + SChargeRet + "</SCharge> <TDiscount>" + TDiscountRet + "</TDiscount><TPartnerCommission>" + TPartnerCommissionRet + "</TPartnerCommission></ChargeableFares> <NonchargeableFares><TCharge>" + TChargeRet + "</TCharge> <TMarkup>" + TMarkupRet + "</TMarkup><TSdiscount>" + TDiscountRet + "</TSdiscount> </NonchargeableFares></FareDetails> <FlightSegments> <FlightSegment><AirEquipType>" + AirEquipTypeRet + "</AirEquipType><ArrivalAirportCode>" + ArrivalAirportCodeRet + "</ArrivalAirportCode><ArrivalDateTime>" + ArrivalDateTimeRet + "</ArrivalDateTime><DepartureAirportCode>" + DepartureAirportCodeRet + "</DepartureAirportCode><DepartureDateTime>" + DepartureDateTimeRet + "</DepartureDateTime><FlightNumber>" + FlightNumberRet + "</FlightNumber><OperatingAirlineCode>" + OperatingAirlineCodeRet + "</OperatingAirlineCode><OperatingAirlineFlightNumber>" + OperatingAirlineFlightNumberRet + "</OperatingAirlineFlightNumber><RPH>" + RPHRet + "</RPH> <StopQuantity>" + StopQuantityRet + "</StopQuantity><airLineName>" + airLineNameRet + "</airLineName><airportTax>" + airportTaxRet + "</airportTax><imageFileName>" + imageFileNameRet + "</imageFileName> <BookingClass><Availability>" + BookingClassAvailabilityRet + "</Availability><ResBookDesigCode>" + BookingClassResBookDesigCodeRet + "</ResBookDesigCode> </BookingClass><BookingClassFare> <adultFare>" + adultFareRet + "</adultFare><bookingclass>" + bookingclassRet + "</bookingclass> <childFare>" + childFareRet + "</childFare><classType>" + classTypeRet + "</classType><farebasiscode>" + farebasiscodeRet + "</farebasiscode><infantfare>" + infantfareRet + "</infantfare> <Rule>" + RuleRet + "</Rule><adultCommission>" + adultCommissionRet + "</adultCommission><childCommission>" + childCommissionRet + "</childCommission><commissionOnTCharge>" + commissionOnTChargeRet + "</commissionOnTCharge></BookingClassFare> <Discount>" + DiscountRet + "</Discount><airportTaxChild>" + airportTaxChildRet + "</airportTaxChild><airportTaxInfant>" + airportTaxInfantRet + "</airportTaxInfant><adultTaxBreakup>" + adultTaxBreakupRet + "</adultTaxBreakup><childTaxBreakup>" + childTaxBreakupRet + "</childTaxBreakup><infantTaxBreakup>" + infantTaxBreakupRet + "</infantTaxBreakup><octax>" + octaxRet + "</octax> </FlightSegment> </FlightSegments><id>" + idRet + "</id><key>" + keyRet + "</key> </OriginDestinationOption></returnFlights>";

            XMLPricing = XMLPricing + "<telePhone>" + telephone + "</telePhone><email>" + emailAddress + "</email> <creditcardno></creditcardno><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooFWS1.1</Clienttype><AdultPax>" + adultcnt + "</AdultPax><ChildPax>" + childCnt + "</ChildPax><InfantPax>" + infantCnt + "</InfantPax></pricingrequest>";

            DataSet dsFlightPricing = objFlights.GetPricingDetails(XMLPricing);
            if (dsFlightPricing.Tables.Count > 0)
            {

                if (!dsFlightPricing.Tables[0].Columns.Contains("error"))
                {
                    string ReturnFlightId = dsFlightPricing.Tables["returnFlights"].Rows[0]["ReturnFlights_Id"].ToString();

                    DataTable dtchangeFlightSegments = dsFlightPricing.Tables["originDestinationoption"];
                    if (dtchangeFlightSegments.Rows.Count > 0)
                    {
                        DataRow[] rowchangeFilghtSegments = dtchangeFlightSegments.Select("ReturnFlights_Id=" + ReturnFlightId);
                        originDestination_IdRet = rowchangeFilghtSegments[0]["OriginDestinationOption_Id"].ToString();
                    }

                    DataTable dtchangeFareDetails = dsFlightPricing.Tables[3];
                    if (dtchangeFareDetails.Rows.Count > 0)
                    {
                        DataRow[] rowchangeFareDetails = dtchangeFareDetails.Select("OriginDestinationOption_Id=" + originDestination_IdRet);
                        fareDetailsIdRet = rowchangeFareDetails[0]["FareDetails_Id"].ToString();
                    }

                    DataTable dtchangeprice = dsFlightPricing.Tables[4];
                    DataTable dtNonchangeprice = dsFlightPricing.Tables[5];
                    if (dtchangeprice.Rows.Count > 0)
                    {
                        DataRow[] rowchangeprices = dtchangeprice.Select("FareDetails_Id=" + fareDetailsIdRet);
                        DataRow[] rowNonchangeprices = dtNonchangeprice.Select("FareDetails_Id=" + fareDetailsIdRet);
                        TPartnerCommissionRet = rowchangeprices[0]["TPartnerCommission"].ToString();
                        actualBaseFareRet = rowchangeprices[0]["ActualBaseFare"].ToString();
                        taxRet = rowchangeprices[0]["Tax"].ToString();
                        StaxRet = rowchangeprices[0]["Stax"].ToString();
                        SChargeRet = rowchangeprices[0]["SCharge"].ToString();
                        TDiscountRet = rowchangeprices[0]["TDiscount"].ToString();
                        TChargeRet = rowNonchangeprices[0]["TCharge"].ToString();
                        TotalFare = (Convert.ToDecimal(actualBaseFareRet) + Convert.ToDecimal(taxRet) + Convert.ToDecimal(StaxRet) + Convert.ToDecimal(TChargeRet) + Convert.ToDecimal(rowNonchangeprices[0]["TMarkup"])).ToString();//+ Convert.ToDecimal(SChargeRet) + Convert.ToDecimal(TDiscountRet)
                    }
                }
            }

            #endregion

            refNo = Convert.ToString(Session["Order_Id"]);

            String xmlRequestData = "<Bookingrequest><onwardFlights><OriginDestinationOption><FareDetails> <ChargeableFares><ActualBaseFare>" + actualBaseFare + "</ActualBaseFare> <Tax>" + tax + "</Tax><STax>" + Stax + "</STax> <SCharge>" + SCharge + "</SCharge><TDiscount>" + TDiscount + "</TDiscount><TPartnerCommission>" + TPartnerCommission + "</TPartnerCommission></ChargeableFares> <NonchargeableFares><TCharge>" + TCharge + "</TCharge> <TMarkup>" + TMarkup + "</TMarkup><TSdiscount>" + TSdiscount + "</TSdiscount> </NonchargeableFares></FareDetails>";
            xmlRequestData = xmlRequestData + "<FlightSegments> <FlightSegment><AirEquipType>" + AirEquipType + "</AirEquipType><ArrivalAirportCode>" + ArrivalAirportCode + "</ArrivalAirportCode><ArrivalDateTime>" + ArrivalDateTime + "</ArrivalDateTime><DepartureAirportCode>" + DepartureAirportCode + "</DepartureAirportCode><DepartureDateTime>" + DepartureDateTime + "</DepartureDateTime><FlightNumber>" + FlightNumber + "</FlightNumber><OperatingAirlineCode>" + OperatingAirlineCode + "</OperatingAirlineCode><OperatingAirlineFlightNumber>" + OperatingAirlineFlightNumber + "</OperatingAirlineFlightNumber><RPH>" + RPH + "</RPH> <StopQuantity>" + StopQuantity + "</StopQuantity><airLineName>" + airLineName + "</airLineName><airportTax>" + airportTax + "</airportTax><imageFileName>" + imageFileName + "</imageFileName>";
            xmlRequestData = xmlRequestData + "<BookingClass><Availability>" + BookingClassAvailability + "</Availability><ResBookDesigCode>" + BookingClassResBookDesigCode + "</ResBookDesigCode> </BookingClass><BookingClassFare> <adultFare>" + adultFare + "</adultFare><bookingclass>" + bookingclass + "</bookingclass> <childFare>" + childFare + "</childFare><classType>" + classType + "</classType><farebasiscode>" + farebasiscode + "</farebasiscode><infantfare>" + infantfare + "</infantfare> <Rule>" + Rule + "</Rule><adultCommission>" + adultCommission + "</adultCommission><childCommission>" + childCommission + "</childCommission><commissionOnTCharge>" + commissionOnTCharge + "</commissionOnTCharge></BookingClassFare>";
            xmlRequestData = xmlRequestData + "<Discount>" + Discount + "</Discount><airportTaxChild>" + airportTaxChild + "</airportTaxChild><airportTaxInfant>" + airportTaxInfant + "</airportTaxInfant><adultTaxBreakup>" + adultTaxBreakup + "</adultTaxBreakup><childTaxBreakup>" + childTaxBreakup + "</childTaxBreakup><infantTaxBreakup>" + infantTaxBreakup + "</infantTaxBreakup><octax>" + octax + "</octax> </FlightSegment> </FlightSegments>";
            xmlRequestData = xmlRequestData + "<id>" + id1 + "</id><key>" + key + "</key> </OriginDestinationOption></onwardFlights>";

            xmlRequestData = xmlRequestData + "<returnFlights><OriginDestinationOption><FareDetails> <ChargeableFares><ActualBaseFare>" + actualBaseFareRet + "</ActualBaseFare> <Tax>" + taxRet + "</Tax><STax>" + StaxRet + "</STax> <SCharge>" + SChargeRet + "</SCharge><TDiscount>" + TDiscountRet + "</TDiscount><TPartnerCommission>" + TPartnerCommissionRet + "</TPartnerCommission></ChargeableFares> <NonchargeableFares><TCharge>" + TChargeRet + "</TCharge> <TMarkup>" + TMarkupRet + "</TMarkup><TSdiscount>" + TSdiscountRet + "</TSdiscount> </NonchargeableFares></FareDetails>";
            xmlRequestData = xmlRequestData + "<FlightSegments> <FlightSegment><AirEquipType>" + AirEquipTypeRet + "</AirEquipType><ArrivalAirportCode>" + ArrivalAirportCodeRet + "</ArrivalAirportCode><ArrivalDateTime>" + ArrivalDateTimeRet + "</ArrivalDateTime><DepartureAirportCode>" + DepartureAirportCodeRet + "</DepartureAirportCode><DepartureDateTime>" + DepartureDateTimeRet + "</DepartureDateTime><FlightNumber>" + FlightNumberRet + "</FlightNumber><OperatingAirlineCode>" + OperatingAirlineCodeRet + "</OperatingAirlineCode><OperatingAirlineFlightNumber>" + OperatingAirlineFlightNumberRet + "</OperatingAirlineFlightNumber><RPH>" + RPHRet + "</RPH> <StopQuantity>" + StopQuantityRet + "</StopQuantity><airLineName>" + airLineNameRet + "</airLineName><airportTax>" + airportTaxRet + "</airportTax><imageFileName>" + imageFileNameRet + "</imageFileName>";
            xmlRequestData = xmlRequestData + "<BookingClass><Availability>" + BookingClassAvailabilityRet + "</Availability><ResBookDesigCode>" + BookingClassResBookDesigCodeRet + "</ResBookDesigCode> </BookingClass><BookingClassFare> <adultFare>" + adultFareRet + "</adultFare><bookingclass>" + bookingclassRet + "</bookingclass> <childFare>" + childFareRet + "</childFare><classType>" + classTypeRet + "</classType><farebasiscode>" + farebasiscodeRet + "</farebasiscode><infantfare>" + infantfareRet + "</infantfare> <Rule>" + RuleRet + "</Rule><adultCommission>" + adultCommissionRet + "</adultCommission><childCommission>" + childCommissionRet + "</childCommission><commissionOnTCharge>" + commissionOnTChargeRet + "</commissionOnTCharge></BookingClassFare>";
            xmlRequestData = xmlRequestData + "<Discount>" + DiscountRet + "</Discount><airportTaxChild>" + airportTaxChildRet + "</airportTaxChild><airportTaxInfant>" + airportTaxInfantRet + "</airportTaxInfant><adultTaxBreakup>" + adultTaxBreakupRet + "</adultTaxBreakup><childTaxBreakup>" + childTaxBreakupRet + "</childTaxBreakup><infantTaxBreakup>" + infantTaxBreakupRet + "</infantTaxBreakup><octax>" + octaxRet + "</octax> </FlightSegment> </FlightSegments>";
            xmlRequestData = xmlRequestData + "<id>" + idRet + "</id><key>" + keyRet + "</key> </OriginDestinationOption></returnFlights>";

            xmlRequestData = xmlRequestData + "<personName>";
            // Dynamic generation of names of adults, infants , Child
            #region old

            //Table tbladults = (Table)this.UpdatePanel1.FindControl("tblAdults");
            //for (int i = 1; i <= adultcnt; i++)
            //{

            //    TextBox txtFn = (TextBox)tbladults.FindControl("txtFn" + i);
            //    TextBox txtLn = (TextBox)tbladults.FindControl("txtLn" + i);
            //    DropDownList ddlTitle = (DropDownList)tbladults.FindControl("ddlTitle" + i);

            //    xmlRequestData = xmlRequestData + "<CustomerInfo><givenName>" + txtFn.Text + "</givenName><surName>" + txtLn.Text + "</surName><nameReference>" + ddlTitle.SelectedItem.Value + "</nameReference><psgrtype>adt</psgrtype></CustomerInfo>";
            //}

            //Table tblChild = (Table)this.UpdatePanel1.FindControl("tblChild");
            //for (int i = 1; i <= childCnt; i++)
            //{
            //    TextBox txtFn = (TextBox)tblChild.FindControl("txtCFn" + i);

            //    TextBox txtLn = (TextBox)tblChild.FindControl("txtCLn" + i);

            //    DropDownList ddlTitle = (DropDownList)tblChild.FindControl("ddlCTitle" + i);

            //    TextBox txtBirthDate = (TextBox)tblChild.FindControl("txtCBirthDate" + i);

            //    string age = (DateTime.Now.Year - Convert.ToDateTime(txtBirthDate.Text).Year).ToString();

            //    xmlRequestData = xmlRequestData + "<CustomerInfo><givenName>" + txtFn.Text + "</givenName><surName>" + txtLn.Text + "</surName><nameReference>" + ddlTitle.SelectedItem.Value + "</nameReference><dob>" + txtBirthDate.Text + "</dob><age>" + age + "</age><psgrtype>chd</psgrtype></CustomerInfo>";
            //}

            //Table tblInfants = (Table)this.UpdatePanel1.FindControl("tblInfants");
            //for (int i = 1; i <= infantCnt; i++)
            //{
            //    TextBox txtFn = (TextBox)tblInfants.FindControl("txtIFn" + i);

            //    TextBox txtLn = (TextBox)tblInfants.FindControl("txtILn" + i);

            //    DropDownList ddlTitle = (DropDownList)tblInfants.FindControl("ddlITitle" + i);

            //    TextBox txtBirthDate = (TextBox)tblInfants.FindControl("txtIBirthDate" + i);

            //    string age = (DateTime.Now.Year - Convert.ToDateTime(txtBirthDate.Text).Year).ToString();

            //    xmlRequestData = xmlRequestData + "<CustomerInfo><givenName>" + txtFn.Text + "</givenName><surName>" + txtLn.Text + "</surName><nameReference>" + ddlTitle.SelectedItem.Value + "</nameReference><dob>" + txtBirthDate.Text + "</dob><age>" + age + "</age><psgrtype>inf</psgrtype></CustomerInfo>";
            //}
            #endregion
            string strname = dtid.Tables[0].Rows[0]["Customer_Details"].ToString();
            string[] strrows = strname.ToString().Split(';');
            int id = strrows.Count();
            for (int m = 0; m < id; m++)
            {
                if (strrows[m].ToUpper().Contains("ADT"))
                {
                    string[] stradt = strrows[m].ToString().Split('|');
                    xmlRequestData = xmlRequestData + "<CustomerInfo><givenName>" + stradt[1].ToString() + "</givenName><surName>" + stradt[2].ToString() + "</surName><nameReference>" + stradt[0].ToString() + "</nameReference><psgrtype>adt</psgrtype></CustomerInfo>";
                }
                if (strrows[m].ToUpper().Contains("CHD"))
                {
                    string[] strchd = strrows[m].ToString().Split('|');
                    xmlRequestData = xmlRequestData + "<CustomerInfo><givenName>" + strchd[1].ToString() + "</givenName><surName>" + strchd[2].ToString() + "</surName><nameReference>" + strchd[0].ToString() + "</nameReference><dob>" + strchd[5].ToString() + "</dob><age>" + strchd[4].ToString() + "</age><psgrtype>chd</psgrtype></CustomerInfo>";
                }
                if (strrows[m].ToUpper().Contains("INF"))
                {
                    string[] strinf = strrows[m].ToString().Split('|');
                    xmlRequestData = xmlRequestData + "<CustomerInfo><givenName>" + strinf[1].ToString() + "</givenName><surName>" + strinf[2].ToString() + "</surName><nameReference>" + strinf[0].ToString() + "</nameReference><dob>" + strinf[5].ToString() + "</dob><age>" + strinf[4].ToString() + "</age><psgrtype>inf</psgrtype></CustomerInfo>";

                }
            }

            xmlRequestData = xmlRequestData + "</personName><telePhone><phoneNumber>" + telephone + "</phoneNumber></telePhone><email><emailAddress>" + emailAddress + "</emailAddress></email><creditcardno>4111111111111111</creditcardno><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword> <partnerRefId>" + refNo + "</partnerRefId> <Clienttype>ArzooFWS1.1</Clienttype><AdultPax>" + Session["adultcnt"].ToString() + "</AdultPax><ChildPax>" + Session["childCnt"].ToString() + "</ChildPax><InfantPax>" + Session["infantCnt"].ToString() + "</InfantPax></Bookingrequest>";
            DataSet dsBookingResponse = new DataSet();

            //DataSet dsBalance = objBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"].ToString()));

            //string balance = dsBalance.Tables[0].Rows[0]["Balance"].ToString();
            //string commisionPercentage = dsBalance.Tables[0].Rows[0]["CommisionPercentage"].ToString();
            //string agentId = dsBalance.Tables[0].Rows[0]["AgentId"].ToString();

            //string actualFare = lblTotalOnwardReturn.Text;
            //string deductAmount = Convert.ToString(Convert.ToDouble(actualFare.ToString()) -
            //    ((Convert.ToDouble(actualFare.ToString()) * Convert.ToInt32(commisionPercentage)) / 100));
            //string commisionFare = Convert.ToString(Convert.ToDouble(actualFare.ToString()) - Convert.ToDouble(deductAmount));

            //Session["AgentId_Agent"] = agentId;
            //Session["ActualFare_Agent"] = actualFare;
            //Session["CommisionFare_Agent"] = commisionFare;
            //Session["CommisionPercentage_Agent"] = commisionPercentage;
            //Session["DeductAmount_Agent"] = deductAmount;

            //if (Convert.ToDouble(balance) >= Convert.ToDouble(deductAmount))
            //{

            dsBookingResponse = objFlights.GetBookingDetails(xmlRequestData);
            //}
            //else { return; }

            string error = string.Empty;

            // If there is any Error -- We wont get the transid instead we get error
            if (dsBookingResponse.Tables[0].Columns.Contains("transid"))
            {
                transId = dsBookingResponse.Tables[0].Rows[0]["transid"].ToString();

                //DeductAgentBalance(Convert.ToInt32(Session["AgentId_Agent"].ToString()), Convert.ToDouble(Session["DeductAmount_Agent"].ToString()),
                //                        Convert.ToInt32(Session["UserID"].ToString()), refNo, Convert.ToDouble(Session["ActualFare_Agent"].ToString()),
                //                        Convert.ToDouble(Session["CommisionFare_Agent"].ToString()), Convert.ToInt32(Session["CommisionPercentage_Agent"].ToString()));

                //objBAL = new ClsBAL();
                //DataSet dsBalanceA = objBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"].ToString()));

                //string balanceAgent = dsBalanceA.Tables[0].Rows[0]["Balance"].ToString();
                //Label lbl = (Label)this.Master.FindControl("lblBalance");
                //lbl.Text = balance;
                //Session["Balance"] = balanceAgent;

                //  #region SaveResponse
                #region Dedcuting the amount from the agent and DB's balance after booking

                if (Session["UserID"] != null)
                {
                    if (Session["Role"] != null)
                    {
                        if (Session["Role"].ToString() == "Agent" || Session["Role"].ToString() == "Distributor")
                        {
                            string[] commPer = Session["CommisionPercentage_Agent"].ToString().Split('.');
                            DeductAgentBalance(Convert.ToInt32(Session["AgentId_Agent"].ToString()), Convert.ToDouble(Session["DeductAmount_Agent"].ToString()),
                                                    Convert.ToInt32(Session["UserID"].ToString()), refNo, Convert.ToDouble(Session["ActualFare_Agent"].ToString()),
                                                    Convert.ToDouble(Session["CommisionFare_Agent"].ToString()), Convert.ToDouble(Session["CommisionPercentage_Agent"]));

                            objBAL = new ClsBAL();
                            DataSet dsBalanceA = objBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"].ToString()));

                            string balanceAgent = dsBalanceA.Tables[0].Rows[0]["Balance"].ToString();
                            Label lbl = (Label)this.Master.FindControl("lblBalance");
                            lbl.Text = balanceAgent;
                            Session["Balance"] = balanceAgent;
                        }
                        else if (Session["Role"].ToString() == "User")
                        {
                            DeductAgentBalance(Convert.ToInt32(Session["AgentId_Agent"].ToString()), Convert.ToDouble("0.00"), Convert.ToInt32(Session["UserID"].ToString()), refNo, Convert.ToDouble(Session["Amount"].ToString()),
                                                Convert.ToDouble("0.00"), Convert.ToDouble("0.00"));
                        }
                        else if (Session["Role"].ToString() == "Admin")
                        {
                            DeductAgentBalance(0, Convert.ToDouble("0.00"), Convert.ToInt32(Session["UserID"].ToString()), refNo, Convert.ToDouble(Session["Amount"].ToString()),
                                               Convert.ToDouble("0.00"), Convert.ToDouble("0.00"));
                        }
                    }
                }
                else if (Session["Role"] == null)
                {
                    DeductAgentBalance(0, Convert.ToDouble("0.00"), 0, refNo, Convert.ToDouble(Session["Amount"].ToString()),
                                              Convert.ToDouble("0.00"), Convert.ToDouble("0.00"));
                }
                #endregion
                FlightBAL objFlightBal = new FlightBAL();

                objFlightBal.ReferenceNo = refNo;
                objFlightBal.TransId = transId;
                objFlightBal.Status = dsBookingResponse.Tables["Bookingresponse"].Rows[0]["status"].ToString();
                if (objFlightBal.Status == "SUCCESS")
                {
                    objFlightsBal.UpdateDomesticFlightBooking(objFlightBal);
                    GetBookingStatus(objFlightBal.ReferenceNo);
                }
                else
                {
                    objFlightsBal.UpdateDomesticFlightBooking(objFlightBal);
                }

                GetDetailsForPrint(Convert.ToString(Session["Order_Id"]));
                lbtnmail.Visible = false;
                pnlSearch.Visible = false;
                lbtnmail_Click1(sender, e);
                pnlPassengerDet.Visible = false;
                lblStatus.Visible = true;
                lblStatus.Text = "Ticket has been booked successfully. Reference Number is : " + Convert.ToString(Session["Order_Id"]);
                lblStatus.ForeColor = System.Drawing.Color.Green;
                //  Response.Redirect("Pay.aspx", false);

            }
            else
            {
                lblStatus.Text = dsBookingResponse.Tables[0].Rows[0]["Error"].ToString();
                lblStatus.Visible = true;
            }
        }
        catch (Exception ex)
        {
        }
    }