private void BindTicketDetails()
    {
        FlightBAL objFlightsBAL = new FlightBAL();
        DataSet dsFlights = new DataSet();
        dsFlights = objFlightsBAL.GetCarDetaisl(txtRefNo.Text,"");
        if (dsFlights.Tables[0].Rows.Count > 0)
        {

            //lblCarName.Text = dsFlights.Tables[0].Rows[1]["CarName"].ToString();
            lblCarRefNo.Text = dsFlights.Tables[0].Rows[0]["ReferanceId"].ToString();
            lblStatus.Text = dsFlights.Tables[0].Rows[0]["Status"].ToString();
            //if (dsFlights.Tables[0].Rows[0]["ReferenceNo"].ToString() == "1")
            //{
            //    lblStatus.Text ="Booked";
            //}

            lblAddress.Text = dsFlights.Tables[0].Rows[0]["Address"].ToString();
            lblCity1.Text = dsFlights.Tables[0].Rows[0]["City_Car"].ToString();
            lblJourneyDate.Text = dsFlights.Tables[0].Rows[0]["TravelDate"].ToString();
            lblFirstName.Text = dsFlights.Tables[0].Rows[0]["Name"].ToString();
            lblMobileNo.Text = dsFlights.Tables[0].Rows[0]["MobileNo"].ToString();
            lblEmailId.Text = dsFlights.Tables[0].Rows[0]["EmailId"].ToString();
            lblAdd.Text = dsFlights.Tables[0].Rows[0]["Address"].ToString();
            lblCity.Text = dsFlights.Tables[0].Rows[0]["City"].ToString();
            lblPinCode.Text = dsFlights.Tables[0].Rows[0]["ZipCode"].ToString();
            lblState.Text = dsFlights.Tables[0].Rows[0]["State"].ToString();
            lblPickupTime.Text = dsFlights.Tables[0].Rows[0]["PickupTime"].ToString();
            lblCarName.Text = dsFlights.Tables[0].Rows[0]["CarName"].ToString();

        }
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        FlightBAL objFlightBal = new FlightBAL();
        if (txtRefNo.Text != "")
        {
            objFlightBal.RefNo = txtRefNo.Text;
        }
        else
        {
            objFlightBal.RefNo = null;
        }
        if (txtfromdate.Text != "")
        {
            DateTime dt = DateTime.Parse(txtfromdate.Text, CultureInfo.GetCultureInfo("en-gb"));

            objFlightBal.DateOfJourney = Convert.ToDateTime(dt.ToShortDateString());
        }
        else
        {
            objFlightBal.DateOfJourney = null;
        }
        if (txttodate.Text != "")
        {
            DateTime dt = DateTime.Parse(txttodate.Text, CultureInfo.GetCultureInfo("en-gb"));

            objFlightBal.DateOfIssue = Convert.ToDateTime(dt.ToShortDateString());

        }
        else
        {
            objFlightBal.DateOfIssue = null;
        }
        if (txtName.Text != "")
        {
            objFlightBal.Name = txtName.Text;
        }
        else
        {
            objFlightBal.Name = null;
        }

        objFlightBal.TableName = "GetGuestBookings";
        _objDataSet = objFlightBal.CarSearch(objFlightBal);
        if (_objDataSet != null)
        {
            if (_objDataSet.Tables[0].Rows.Count > 0)
            {

                gvBookings.DataSource = _objDataSet;
                Session["GvReports"] = _objDataSet.Tables[0];
                gvBookings.DataBind();

            }
        }
        else
        {
            gvBookings.EmptyDataText = "No Records found";

        }
    }
    public static string[] GetAirportCodes(string prefixText)
    {
        try
        {

            DataSet ds = new DataSet();

            FlightBAL objFlightBal = new FlightBAL();
            ds = objFlightBal.GetAirportCodes();

            string filteringquery = "CityName LIKE'" + prefixText + "%'";
            //Select always return array,thats why we store it into array of Datarow
            DataRow[] dr = ds.Tables[0].Select(filteringquery);
            //create new table
            DataTable dtNew = new DataTable();
            //create a clone of datatable dt and store it into new datatable
            dtNew = ds.Tables[0].Clone();
            //fetching all filtered rows add add into new datatable
            foreach (DataRow drNew in dr)
            {
                dtNew.ImportRow(drNew);
            }
            //return dtAirportCodes;

            List<string> airports = new List<string>();
            for (int i = 0; i < dtNew.Rows.Count; i++)
            {
                airports.Add(dtNew.Rows[i]["CityName"].ToString().Trim() + "," + dtNew.Rows[i]["AirportDesc"].ToString().Trim() + " - (" + dtNew.Rows[i]["AirportCode"].ToString().Trim() + ")");
            }
            return airports.ToArray();
        }
        catch (Exception)
        {
            throw;

        }
    }
    protected void btnSignInInt_Click(object sender, EventArgs e)
    {
        try
        {
            FlightBAL objFlightsBAL = new FlightBAL();
            DataSet dsFlights = new DataSet();
            dsFlights = objFlightsBAL.GetInternationalFlightDetails(txtRefNo.Text.Trim());
            if (dsFlights.Tables[0].Rows.Count > 0)
            {
                string customerDetails = dsFlights.Tables[0].Rows[0]["CustomerDetails"].ToString();
                string[] strArryCustDet = customerDetails.Split('|');
                lblName.Text = strArryCustDet[0] + strArryCustDet[1] + "  " + strArryCustDet[2];
                lblTel.Text = dsFlights.Tables[0].Rows[0]["Telephone"].ToString();
                lblEmailAddress.Text = dsFlights.Tables[0].Rows[0]["EmailAddress"].ToString();
                lblPNR.Text = dsFlights.Tables[0].Rows[0]["ReferenceNo"].ToString();
                lblOrigin.Text = dsFlights.Tables[0].Rows[0]["DepartureAirportCode"].ToString();
                lblDestination.Text = dsFlights.Tables[0].Rows[0]["ArrivalAirportCode"].ToString();
                lblAirlineName.Text = dsFlights.Tables[0].Rows[0]["OperatingAirlineName"].ToString();
                //img.ImageUrl = dsFlights.Tables[0].Rows[0]["imageFileName"].ToString();
                lblFlightNumber.Text = dsFlights.Tables[0].Rows[0]["FlightNumber"].ToString();
                string DepartureDatetime = dsFlights.Tables[0].Rows[0]["DepartureDateTime"].ToString();
                string[] strArryDeptDatetime = DepartureDatetime.Split('T');
                lblDepartureDate.Text = strArryDeptDatetime[0].ToString();
                lblDepartureTime.Text = strArryDeptDatetime[1].ToString();
                string ArrivalDatetime = dsFlights.Tables[0].Rows[0]["ArrivalDateTime"].ToString();
                string[] strArrivalDatetime = ArrivalDatetime.Split('T');
                lblArrivalDate.Text = strArryDeptDatetime[0].ToString();
                lblArrivalTime.Text = strArryDeptDatetime[1].ToString();
                lblPNRNo.Text = dsFlights.Tables[0].Rows[0]["ReferenceNo"].ToString();
                lblPsngrMobileNo.Text = dsFlights.Tables[0].Rows[0]["Telephone"].ToString();

                string[] strCusDetArr = customerDetails.Split(';');
                string indCustDet = string.Empty;
                DataTable dtPsgrDet = new DataTable();
                dtPsgrDet.Columns.Add("Name", typeof(string));
                dtPsgrDet.Columns.Add("Type", typeof(string));
                dtPsgrDet.Columns.Add("Age", typeof(string));

                for (int i = 0; i < strCusDetArr.Length; i++)
                {
                    indCustDet = strCusDetArr[i];
                    string[] strArryCustDet1 = indCustDet.Split('|');
                    DataRow dr = dtPsgrDet.NewRow();
                    dr["Name"] = strArryCustDet1[0] + strArryCustDet1[1] + "  " + strArryCustDet1[2];
                    dr["Type"] = strArryCustDet1[3];
                    dr["Age"] = "-";
                    dtPsgrDet.Rows.Add(dr);
                }

                gdvPassengerDetails.DataSource = dtPsgrDet;
                gdvPassengerDetails.DataBind();
                lblPassengerType.Text = strArryCustDet[3];
                lblPassengerCnt.Text = strCusDetArr.Length.ToString();
                lblBasicFare.Text = dsFlights.Tables[0].Rows[0]["ActualBasefare"].ToString();
                lblTaxes.Text = dsFlights.Tables[0].Rows[0]["Tax"].ToString();
                lblServiceTax.Text = (Convert.ToDouble(dsFlights.Tables[0].Rows[0]["STax"]) + Convert.ToDouble(dsFlights.Tables[0].Rows[0]["Scharge"])).ToString();
                lblTotal.Text = Convert.ToDouble(lblBasicFare.Text) + (Convert.ToDouble(lblTaxes.Text) + Convert.ToDouble(lblServiceTax.Text) - Convert.ToDouble(dsFlights.Tables[0].Rows[0]["TDiscount"].ToString())).ToString();
                pnlViewticket.Visible = true;

            }
        }
        catch (Exception ex)
        {

            throw;
        }
    }
        public DataSet CarSearch(FlightBAL objFlightBAL)
        {
            try
            {
                ObjDAL = new clsDataLayer();
                SqlParameter[] p = new SqlParameter[6];
                p[0] = new SqlParameter("@ReferenceId ", objFlightBAL.RefNo);
                p[1] = new SqlParameter("@AgentName", objFlightBAL.Name);
                p[2] = new SqlParameter("@DateOfJourney", objFlightBAL.DateOfJourney);
                p[3] = new SqlParameter("@DateOfIssue", objFlightBAL.DateOfIssue);
                p[4] = new SqlParameter("@Query", objFlightBAL.TableName);
                p[5] = new SqlParameter("@AgentId", objFlightBAL.agentId);

                //p[10] = new SqlParameter("@PageSize", objFlightBAL.PageSize);

                //p[5] = new SqlParameter("@userid", objFlightBAL.CreatedBy);
                return ObjDAL.fnExecuteDataset("sp_CarProvisional", p);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
    private DataSet GetIntBookingRequest()
    {
        DataSet ds = new DataSet();
        dsIntFlights = (DataSet)Session["dsIntFlights"];
        #region Variables

        string str = string.Empty;
        string FlightSegmentsID = string.Empty;
        string DepartureAirportCode = string.Empty;
        string ArrivalDateTime = string.Empty;
        string DepartureAirportName = string.Empty;
        string DepartureDateTime = string.Empty;
        string FlightNumber = string.Empty;
        string MarketingAirlineCode = string.Empty;
        string OperatingAirlineCode = string.Empty;
        string OperatingAirlineName = string.Empty;
        string OperatingAirlineFlightNumber = string.Empty;
        string NumStops = string.Empty;
        string LinkSellAgrmnt = string.Empty;
        string Conx = string.Empty;
        string AirpChg = string.Empty;
        string InsideAvailOption = string.Empty;
        string GenTrafRestriction = string.Empty;
        string DaysOperates = string.Empty;
        string JrnyTm = string.Empty;
        string EndDt = string.Empty;
        string StartTerminal = string.Empty;
        string EndTerminal = string.Empty;
        string FltTm = string.Empty;
        string LSAInd = string.Empty;
        string Mile = string.Empty;
        string Availability = string.Empty;
        string BIC = string.Empty;
        string bookingclass = string.Empty;
        string classType = string.Empty;
        string farebasiscode = string.Empty;
        string Rule = string.Empty;
        string PsgrType = string.Empty;
        string BaseFare = string.Empty;
        string Tax = string.Empty;
        string BagInfo = string.Empty;
        string AirEquipType = string.Empty;
        string ArrivalAirportCode = string.Empty;
        string ArrivalAirportName = string.Empty;
        string return1 = string.Empty;
        string id = string.Empty;
        string key = string.Empty;
        string ActualBaseFare = string.Empty;
        string FareTax = string.Empty;
        string STax = string.Empty;
        string TCharge = string.Empty;
        string SCharge = string.Empty;
        string TDiscount = string.Empty;
        string TMarkup = string.Empty;
        string TPartnerCommission = string.Empty;
        string TSdiscount = string.Empty;
        string FarePsgrType = string.Empty;
        string FareBaseFare = string.Empty;
        string FareTax1 = string.Empty;
        string Country = string.Empty;
        string Amt = string.Empty;
        string ocTax = string.Empty;
        string onwardId = string.Empty;
        string OriginDestinationOption_Id = string.Empty;
        string FareDetails_id = string.Empty;
        string FareBreakUp_Id = string.Empty;
        string FareAry_id = string.Empty;
        string FareId = string.Empty;
        string bookingclassFareId = string.Empty;
        string psgrBreakUp_Id = string.Empty;
        string psgrAy_id = string.Empty;
        string country = string.Empty;
        string taxAmt = string.Empty;
        string taxData = string.Empty;
        string taxDataAry_id = string.Empty;

        string CFareId = string.Empty;
        string CPsgrType = string.Empty;
        string CBaseFare = string.Empty;
        string CFareTax = string.Empty;
        string IFareId = string.Empty;
        string IPsgrType = string.Empty;
        string IBaseFare = string.Empty;
        string IFareTax = string.Empty;

        string CFarePsgrType = string.Empty;
        string CFareBaseFare = string.Empty;
        string CFareTax1 = string.Empty;
        string CBagInfo = string.Empty;
        string IFarePsgrType = string.Empty;
        string IFareBaseFare = string.Empty;
        string IFareTax1 = string.Empty;
        string IBagInfo = string.Empty;
        string taxdatapsgr = string.Empty;

        #endregion
        try
        {
            string result = null;
            DataTable dtFlightSegment = dsIntFlights.Tables[12];
            if (dtFlightSegment.Rows.Count > 0)
            {
                DataRow[] rowFilghtSegment = dtFlightSegment.Select("FlightSegment_ID=" + Convert.ToInt32(lblIntFlightSegmentId.Text));
                FlightSegmentsID = rowFilghtSegment[0]["FlightSegments_Id"].ToString();

            }
            DataTable dtFlightSegments = dsIntFlights.Tables[11];
            if (dtFlightSegments.Rows.Count > 0)
            {
                DataRow[] rowFilghtSegments = dtFlightSegments.Select("FlightSegments_ID=" + FlightSegmentsID);
                onwardId = rowFilghtSegments[0]["Onward_Id"].ToString();
            }
            DataTable dtOnward = dsIntFlights.Tables[10];
            if (dtOnward.Rows.Count > 0)
            {
                DataRow[] rowOnward = dtOnward.Select("Onward_Id=" + onwardId);
                OriginDestinationOption_Id = rowOnward[0]["OriginDestinationOption_Id"].ToString();
            }
            DataTable dtOriginDestinationOption = dsIntFlights.Tables[3];
            if (dtOriginDestinationOption.Rows.Count > 0)
            {
                DataRow[] rowOriginDestinationOption = dtOriginDestinationOption.Select("OriginDestinationOption_Id=" + OriginDestinationOption_Id);
                return1 = rowOriginDestinationOption[0]["Return"].ToString();
                id = rowOriginDestinationOption[0]["id"].ToString();
                key = rowOriginDestinationOption[0]["key"].ToString();
            }
            DataTable dtFareDetails = dsIntFlights.Tables[4];
            if (dtFareDetails.Rows.Count > 0)
            {
                DataRow[] rowFareDetails = dtFareDetails.Select("OriginDestinationOption_Id=" + OriginDestinationOption_Id);
                ActualBaseFare = rowFareDetails[0]["ActualBaseFare"].ToString();
                Tax = rowFareDetails[0]["Tax"].ToString();
                STax = rowFareDetails[0]["STax"].ToString();
                TCharge = rowFareDetails[0]["TCharge"].ToString();
                SCharge = rowFareDetails[0]["SCharge"].ToString();
                TDiscount = rowFareDetails[0]["TDiscount"].ToString();
                TMarkup = rowFareDetails[0]["TMarkup"].ToString();
                TPartnerCommission = rowFareDetails[0]["TPartnerCommission"].ToString();
                TSdiscount = rowFareDetails[0]["TSdiscount"].ToString();
                ocTax = rowFareDetails[0]["ocTax"].ToString();
                FareDetails_id = rowFareDetails[0]["FareDetails_id"].ToString();
            }
            DataTable dtFareBreakUp = dsIntFlights.Tables[5];
            if (dtFareBreakUp.Rows.Count > 0)
            {
                DataRow[] rowFareBreakUp = dtFareBreakUp.Select("FareDetails_Id=" + FareDetails_id);
                FareBreakUp_Id = rowFareBreakUp[0]["FareBreakUp_Id"].ToString();

            }
            DataTable dtFareAry = dsIntFlights.Tables[6];
            if (dtFareAry.Rows.Count > 0)
            {
                DataRow[] rowFareAry = dtFareAry.Select("FareBreakUp_Id=" + FareBreakUp_Id);
                FareAry_id = rowFareAry[0]["FareAry_id"].ToString();
            }
            DataTable dtFare = dsIntFlights.Tables[7];
            if (dtFare.Rows.Count > 0)
            {
                DataRow[] rowFare = dtFare.Select("FareAry_id=" + FareAry_id);
                PsgrType = rowFare[0]["PsgrType"].ToString();
                BaseFare = rowFare[0]["BaseFare"].ToString();
                FareTax = rowFare[0]["Tax"].ToString();
                FareId = rowFare[0]["Fare_Id"].ToString();
                //child
                //CPsgrType = rowFare[1]["PsgrType"].ToString();
                //CBaseFare = rowFare[1]["BaseFare"].ToString();
                //CFareTax = rowFare[1]["Tax"].ToString();
                //CFareId = rowFare[1]["Fare_Id"].ToString();
                ////infant
                //IPsgrType = rowFare[2]["PsgrType"].ToString();
                //IBaseFare = rowFare[2]["BaseFare"].ToString();
                //IFareTax = rowFare[2]["Tax"].ToString();
                //IFareId = rowFare[2]["Fare_Id"].ToString();

            }

            DataTable dtBookingClass = dsIntFlights.Tables[13];
            if (dtBookingClass.Rows.Count > 0)
            {
                DataRow[] rowBookingClass = dtBookingClass.Select("FlightSegment_Id=" + lblIntFlightSegmentId.Text);
                Availability = rowBookingClass[0]["Availability"].ToString();
                BIC = rowBookingClass[0]["BIC"].ToString();
            }
            DataTable dtBookingClassFare = dsIntFlights.Tables[14];
            if (dtBookingClassFare.Rows.Count > 0)
            {
                DataRow[] rowBookingClassFare = dtBookingClassFare.Select("FlightSegment_Id=" + lblIntFlightSegmentId.Text);
                bookingclass = rowBookingClassFare[0]["bookingclass"].ToString();
                classType = rowBookingClassFare[0]["classType"].ToString();
                farebasiscode = rowBookingClassFare[0]["farebasiscode"].ToString();
                Rule = rowBookingClassFare[0]["Rule"].ToString();
                if (dtBookingClassFare.Columns.Contains("bookingclassFare_Id"))
                {
                    bookingclassFareId = rowBookingClassFare[0]["bookingclassFare_Id"].ToString();
                }

            }
            if (dtBookingClassFare.Columns.Contains("bookingclassFare_Id"))
            {
                DataTable dtPsgrBreakUp = dsIntFlights.Tables[15];
                if (dtPsgrBreakUp.Rows.Count > 0)
                {
                    DataRow[] rowPsgrBreakUp = dtPsgrBreakUp.Select("bookingclassFare_Id=" + bookingclassFareId);
                    psgrBreakUp_Id = rowPsgrBreakUp[0]["psgrBreakUp_Id"].ToString();

                }
                DataTable dtPsgrAry = dsIntFlights.Tables[16];
                if (dtPsgrAry.Rows.Count > 0)
                {
                    DataRow[] rowPsgrAry = dtPsgrAry.Select("psgrBreakUp_Id=" + psgrBreakUp_Id);
                    psgrAy_id = rowPsgrAry[0]["psgrAry_Id"].ToString();

                }
                DataTable dtPsgr = dsIntFlights.Tables[17];
                if (dtPsgr.Rows.Count > 0)
                {
                    DataRow[] rowPsgr = dtPsgr.Select("psgrAry_Id=" + psgrAy_id);
                    FarePsgrType = rowPsgr[0]["psgrType"].ToString();
                    FareBaseFare = rowPsgr[0]["BaseFare"].ToString();
                    FareTax1 = rowPsgr[0]["Tax"].ToString();
                    BagInfo = rowPsgr[0]["BagInfo"].ToString();
                    //child
                    //CFarePsgrType = rowPsgr[1]["psgrType"].ToString();
                    //CFareBaseFare = rowPsgr[1]["BaseFare"].ToString();
                    //CFareTax1 = rowPsgr[1]["Tax"].ToString();
                    //CBagInfo = rowPsgr[1]["BagInfo"].ToString();
                    ////infant
                    //IFarePsgrType = rowPsgr[2]["psgrType"].ToString();
                    //IFareBaseFare = rowPsgr[2]["BaseFare"].ToString();
                    //IFareTax1 = rowPsgr[2]["Tax"].ToString();
                    //IBagInfo = rowPsgr[2]["BagInfo"].ToString();

                }

                if (dtPsgr.Rows.Count > 0)
                {
                    DataRow[] rowPsgr = dtPsgr.Select("psgrAry_Id=" + psgrAy_id);
                    foreach (DataRow rows in rowPsgr)
                    {
                        if (rows.Table.Rows.Count == 0)
                        {
                            taxdatapsgr = "<Psgr><PsgrType>" + rows["psgrType"].ToString() + "</PsgrType><BaseFare>" + rows["BaseFare"].ToString() + "</BaseFare><Tax>" + rows["Tax"].ToString() + "</Tax><BagInfo></BagInfo></Psgr>";
                        }
                        else
                        {
                            taxdatapsgr = taxdatapsgr + "<Psgr><PsgrType>" + rows["psgrType"].ToString() + "</PsgrType><BaseFare>" + rows["BaseFare"].ToString() + "</BaseFare><Tax>" + rows["Tax"].ToString() + "</Tax><BagInfo></BagInfo></Psgr>";
                        }
                    }
                }
            }
            //  <Psgr><PsgrType>" + FarePsgrType + "</PsgrType><BaseFare>" + FareBaseFare + "</BaseFare><Tax>" + FareTax1 + "</Tax><BagInfo></BagInfo></Psgr>
            DataTable dtTaxDataAry = dsIntFlights.Tables[8];
            if (dtTaxDataAry.Rows.Count > 0)
            {
                DataRow[] rowTaxDataAry = dtTaxDataAry.Select("Fare_id=" + FareId);
                taxDataAry_id = rowTaxDataAry[0]["TaxdataAry_Id"].ToString();
            }
            DataTable dtTaxData = dsIntFlights.Tables[9];
            if (dtTaxData.Rows.Count > 0)
            {
                DataRow[] rowTaxData = dtTaxData.Select("TaxdataAry_Id=" + taxDataAry_id);
                for (int j = 0; j < rowTaxData.Length; j++)
                {
                    if (rowTaxData.Length == 0)
                    {
                        taxData = "<TaxData><Country>" + rowTaxData[j]["Country"].ToString() + "</Country><Amt>" + rowTaxData[j]["Amt"].ToString() + "</Amt></TaxData>";

                    }
                    else
                    {
                        taxData = taxData + "<TaxData><Country>" + rowTaxData[j]["Country"].ToString() + "</Country><Amt>" + rowTaxData[j]["Amt"].ToString() + "</Amt></TaxData>";
                        //ravi
                        //  taxData = taxData + "<Fare><PsgrType>" + dtFare.Rows[j]["PsgrType"].ToString() + "</PsgrType><BaseFare>" + dtFare.Rows[j]["BaseFare"].ToString() + "</BaseFare><Tax>" + dtFare.Rows[j]["Tax"].ToString() + "</Tax><TaxDataAry><TaxData><Country>" + rowTaxData[0]["Country"].ToString() + "</Country><Amt>" + rowTaxData[0]["Amt"].ToString() + "</Amt></TaxData><TaxData><Country>" + rowTaxData[1]["Country"].ToString() + "</Country><Amt>" + rowTaxData[1]["Amt"].ToString() + "</Amt></TaxData><TaxData><Country>" + rowTaxData[2]["Country"].ToString() + "</Country><Amt>" + rowTaxData[2]["Amt"].ToString() + "</Amt></TaxData></TaxDataAry></Fare>";

                    }
                }

            }
            if (dtFare.Rows.Count > 0)
            {
                DataRow[] rowFare = dtFare.Select("FareAry_id=" + FareAry_id);
                foreach (DataRow row in rowFare)
                {
                    if (row.Table.Rows.Count == 0)
                    {
                        str = "<Fare><PsgrType>" + row["PsgrType"].ToString() + "</PsgrType><BaseFare>" + row["BaseFare"].ToString() + "</BaseFare><Tax>" + row["Tax"].ToString() + "</Tax><TaxDataAry>" + taxData + "</TaxDataAry></Fare>";
                    }
                    else
                    {
                        str = str + "<Fare><PsgrType>" + row["PsgrType"].ToString() + "</PsgrType><BaseFare>" + row["BaseFare"].ToString() + "</BaseFare><Tax>" + row["Tax"].ToString() + "</Tax><TaxDataAry>" + taxData + "</TaxDataAry></Fare>";
                    }
                }
            }

            FlightBAL objFlightsBal = new FlightBAL();

            #region Pricing
            //  string XmlPricingRequest = "<PriceRequest><noadults>" + ddlAdultsInt.SelectedValue + "</noadults><nochild>" + ddlChildsInt.SelectedValue + "</nochild><noinfant>" + ddlInfantsInt.SelectedValue + "</noinfant><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooINTLWS1.0</Clienttype><OriginDestinationOption><FareDetails><ActualBaseFare>" + ActualBaseFare + "</ActualBaseFare><Tax>" + Tax + "</Tax><STax>" + STax + "</STax><TCharge>" + TCharge + "</TCharge><SCharge>" + SCharge + "</SCharge><TDiscount>" + TDiscount + "</TDiscount><TMarkup>" + TMarkup + "</TMarkup><TPartnerCommission>" + TPartnerCommission + "</TPartnerCommission><TSdiscount>" + TSdiscount + "</TSdiscount><FareBreakup><FareAry><Fare><PsgrType>" + PsgrType + "</PsgrType><BaseFare>" + BaseFare + "</BaseFare><Tax>" + FareTax + "</Tax></Fare></FareAry></FareBreakup><ocTax>" + ocTax + "</ocTax></FareDetails>";
            string XmlPricingRequest = "<PriceRequest><noadults>" + ddlAdultsInt.SelectedValue + "</noadults><nochild>" + ddlChildsInt.SelectedValue + "</nochild><noinfant>" + ddlInfantsInt.SelectedValue + "</noinfant><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooINTLWS1.0</Clienttype><OriginDestinationOption><FareDetails><ActualBaseFare>" + ActualBaseFare + "</ActualBaseFare><Tax>" + Tax + "</Tax><STax>" + STax + "</STax><TCharge>" + TCharge + "</TCharge><SCharge>" + SCharge + "</SCharge><TDiscount>" + TDiscount + "</TDiscount><TMarkup>" + TMarkup + "</TMarkup><TPartnerCommission>" + TPartnerCommission + "</TPartnerCommission><TSdiscount>" + TSdiscount + "</TSdiscount><FareBreakup><FareAry>" + str + "</FareAry></FareBreakup><ocTax>" + ocTax + "</ocTax></FareDetails>";
            XmlPricingRequest = XmlPricingRequest + "<onward><FlightSegments>";

            if (dtFlightSegment.Rows.Count > 0)
            {
                DataRow[] rowFilghtSegment = dtFlightSegment.Select("FlightSegments_Id=" + FlightSegmentsID);
                for (int j = 0; j < rowFilghtSegment.Length; j++)
                {
                    AirEquipType = rowFilghtSegment[j]["AirEquipType"].ToString();
                    ArrivalAirportCode = rowFilghtSegment[j]["ArrivalAirportCode"].ToString();
                    ArrivalAirportName = rowFilghtSegment[j]["ArrivalAirportName"].ToString();
                    ArrivalDateTime = rowFilghtSegment[j]["ArrivalDateTime"].ToString();
                    DepartureAirportCode = rowFilghtSegment[j]["DepartureAirportCode"].ToString();
                    DepartureAirportName = rowFilghtSegment[j]["DepartureAirportName"].ToString();
                    DepartureDateTime = rowFilghtSegment[j]["DepartureDateTime"].ToString();
                    FlightNumber = rowFilghtSegment[j]["FlightNumber"].ToString();
                    MarketingAirlineCode = rowFilghtSegment[j]["MarketingAirlineCode"].ToString();
                    OperatingAirlineCode = rowFilghtSegment[j]["OperatingAirlineCode"].ToString();
                    OperatingAirlineName = rowFilghtSegment[j]["OperatingAirlineName"].ToString();
                    OperatingAirlineFlightNumber = rowFilghtSegment[j]["OperatingAirlineFlightNumber"].ToString();
                    NumStops = rowFilghtSegment[j]["NumStops"].ToString();
                    LinkSellAgrmnt = rowFilghtSegment[j]["LinkSellAgrmnt"].ToString();
                    Conx = rowFilghtSegment[j]["Conx"].ToString();
                    AirpChg = rowFilghtSegment[j]["AirpChg"].ToString();
                    InsideAvailOption = rowFilghtSegment[j]["InsideAvailOption"].ToString();
                    GenTrafRestriction = rowFilghtSegment[j]["GenTrafRestriction"].ToString();
                    DaysOperates = rowFilghtSegment[j]["DaysOperates"].ToString();
                    JrnyTm = rowFilghtSegment[j]["JrnyTm"].ToString();
                    EndDt = rowFilghtSegment[j]["EndDt"].ToString();
                    StartTerminal = rowFilghtSegment[j]["StartTerminal"].ToString();
                    EndTerminal = rowFilghtSegment[j]["EndTerminal"].ToString();
                    FltTm = rowFilghtSegment[j]["FltTm"].ToString();
                    LSAInd = rowFilghtSegment[j]["LSAInd"].ToString();
                    Mile = rowFilghtSegment[j]["Mile"].ToString();

                    DataTable dtBookingClass1 = dsIntFlights.Tables[13];
                    if (dtBookingClass1.Rows.Count > 0)
                    {
                        DataRow[] rowBookingClass = dtBookingClass1.Select("FlightSegment_Id=" + rowFilghtSegment[j]["FlightSegment_Id"].ToString());
                        Availability = rowBookingClass[0]["Availability"].ToString();
                        BIC = rowBookingClass[0]["BIC"].ToString();
                    }

                    DataTable dtBookingClassFare1 = dsIntFlights.Tables[14];
                    if (dtBookingClassFare1.Rows.Count > 0)
                    {
                        DataRow[] rowBookingClassFare = dtBookingClassFare1.Select("FlightSegment_Id=" + rowFilghtSegment[j]["FlightSegment_Id"].ToString());
                        bookingclass = rowBookingClassFare[0]["bookingclass"].ToString();
                        classType = rowBookingClassFare[0]["classType"].ToString();
                        farebasiscode = rowBookingClassFare[0]["farebasiscode"].ToString();
                        Rule = rowBookingClassFare[0]["Rule"].ToString();

                    }

                    XmlPricingRequest = XmlPricingRequest + "<FlightSegment><AirEquipType>" + AirEquipType + "</AirEquipType><ArrivalAirportCode>" + ArrivalAirportCode + "</ArrivalAirportCode><ArrivalAirportName>" + ArrivalAirportName + "</ArrivalAirportName><ArrivalDateTime>" + ArrivalDateTime + "</ArrivalDateTime><DepartureAirportCode>" + DepartureAirportCode + "</DepartureAirportCode><DepartureAirportName>" + DepartureAirportName + "</DepartureAirportName><DepartureDateTime>" + DepartureDateTime + "</DepartureDateTime><FlightNumber>" + FlightNumber + "</FlightNumber>";
                    XmlPricingRequest = XmlPricingRequest + "<MarketingAirlineCode>" + MarketingAirlineCode + "</MarketingAirlineCode><OperatingAirlineCode>" + OperatingAirlineCode + "</OperatingAirlineCode><OperatingAirlineName>" + OperatingAirlineName + "</OperatingAirlineName><OperatingAirlineFlightNumber>" + OperatingAirlineFlightNumber + "</OperatingAirlineFlightNumber><NumStops>" + NumStops + "</NumStops><LinkSellAgrmnt>" + LinkSellAgrmnt + "</LinkSellAgrmnt><Conx>" + Conx + "</Conx><AirpChg>" + AirpChg + "</AirpChg><InsideAvailOption>" + InsideAvailOption + "</InsideAvailOption><GenTrafRestriction>" + GenTrafRestriction + "</GenTrafRestriction><DaysOperates>" + DaysOperates + "</DaysOperates><JrnyTm>" + JrnyTm + "</JrnyTm><EndDt>" + EndDt + "</EndDt><StartTerminal>" + StartTerminal + "</StartTerminal><EndTerminal>" + EndTerminal + "</EndTerminal>";
                    // XmlPricingRequest = XmlPricingRequest + "<FltTm>" + FltTm + "</FltTm><LSAInd>" + LSAInd + "</LSAInd><Mile>" + Mile + "</Mile><BookingClass><Availability>" + Availability + "</Availability><BIC>" + BIC + "</BIC></BookingClass><BookingClassFare><bookingclass>" + bookingclass + "</bookingclass><classType>" + classType + "</classType><farebasiscode>" + farebasiscode + "</farebasiscode><Rule>" + Rule.Replace("<", "&lt;").Replace(">", "&gt;") + "</Rule><PsgrBreakup><PsgrAry><Psgr><PsgrType>" + FarePsgrType + "</PsgrType><BaseFare>" + FareBaseFare + "</BaseFare><Tax>" + FareTax1 + "</Tax><BagInfo></BagInfo></Psgr></PsgrAry></PsgrBreakup></BookingClassFare></FlightSegment>";
                    XmlPricingRequest = XmlPricingRequest + "<FltTm>" + FltTm + "</FltTm><LSAInd>" + LSAInd + "</LSAInd><Mile>" + Mile + "</Mile><BookingClass><Availability>" + Availability + "</Availability><BIC>" + BIC + "</BIC></BookingClass><BookingClassFare><bookingclass>" + bookingclass + "</bookingclass><classType>" + classType + "</classType><farebasiscode>" + farebasiscode + "</farebasiscode><Rule>" + Rule.Replace("<", "&lt;").Replace(">", "&gt;") + "</Rule>";
                    if (dtBookingClassFare.Columns.Contains("bookingclassFare_Id"))
                    {
                        XmlPricingRequest = XmlPricingRequest + "<PsgrBreakup><PsgrAry>" + taxdatapsgr + "</PsgrAry></PsgrBreakup>";
                    }
                    XmlPricingRequest = XmlPricingRequest + "</BookingClassFare></FlightSegment>";
                }
            }
            XmlPricingRequest = XmlPricingRequest + "</FlightSegments></onward><Return>" + return1 + "</Return><id>" + id + "</id><key>" + key + "</key>";
            XmlPricingRequest = XmlPricingRequest + "</OriginDestinationOption></PriceRequest>";
            //  XmlPricingRequest = "<PriceRequest><noadults>1</noadults><nochild>0</nochild><noinfant>0</noinfant><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooINTLWS1.0</Clienttype><OriginDestinationOption><FareDetails><ActualBaseFare>1200</ActualBaseFare><Tax>2434</Tax><STax>15</STax><TCharge>0</TCharge><SCharge>0</SCharge><TDiscount>0</TDiscount><TMarkup>0</TMarkup><TPartnerCommission>0</TPartnerCommission><TSdiscount>0</TSdiscount><FareBreakup><FareAry><Fare><PsgrType>ADT</PsgrType><BaseFare>1200</BaseFare><Tax>2434</Tax></Fare></FareAry></FareBreakup><ocTax>0</ocTax></FareDetails><onward><FlightSegments><FlightSegment><AirEquipType>319</AirEquipType><ArrivalAirportCode>BOM</ArrivalAirportCode><ArrivalAirportName>MUMBAI</ArrivalAirportName><ArrivalDateTime>2012-11-22T08:20:00</ArrivalDateTime><DepartureAirportCode>BLR</DepartureAirportCode><DepartureAirportName>BANGALORE</DepartureAirportName><DepartureDateTime>2012-11-22T06:45:00</DepartureDateTime><FlightNumber>640</FlightNumber><MarketingAirlineCode>AI</MarketingAirlineCode><OperatingAirlineCode>AI</OperatingAirlineCode><OperatingAirlineName>Air India </OperatingAirlineName><OperatingAirlineFlightNumber>640</OperatingAirlineFlightNumber><NumStops>0</NumStops><LinkSellAgrmnt></LinkSellAgrmnt><Conx>N</Conx><AirpChg>N</AirpChg><InsideAvailOption>C</InsideAvailOption><GenTrafRestriction>?</GenTrafRestriction><DaysOperates>NA</DaysOperates><JrnyTm>95</JrnyTm><EndDt></EndDt><StartTerminal></StartTerminal><EndTerminal></EndTerminal><FltTm>95</FltTm><LSAInd>NR</LSAInd><Mile>0</Mile><BookingClass><Availability>9</Availability><BIC>E</BIC></BookingClass><BookingClassFare><bookingclass>E</bookingclass><classType>Economy</classType><farebasiscode>2vRNmb/yC+cens5pMtaPkYnDM963BJmv</farebasiscode><Rule>Cancellation Penalty: All bookings done are subject to the cancellation penalty levied by the respective airline.&lt;br&gt;In addition to the airline''s cancellation penalty, we charge a service fee of Rs. 200 per passenger for all cancellations.|Date Change Penalty: In addition to the airline''s date change penalty, we charge a service fee of Rs. 250 per passenger for any date changes.|</Rule><PsgrBreakup><PsgrAry><Psgr><PsgrType>ADT</PsgrType><BaseFare>1200</BaseFare><Tax>2434</Tax><BagInfo></BagInfo></Psgr></PsgrAry></PsgrBreakup></BookingClassFare></FlightSegment></FlightSegments></onward><Return></Return><id>arzoo13</id><key>zWbxBFyA059f68R2DgKcVEb0gG2ZuxB2ESt+/BTgCLzQweTiPhdGIWgoifR/a2Cj9x+aTfz36efDvXFXubDdI3wdmkWLxP8GZ+Lq5Tx3+M+2Q/P5Ci0UbF/rxHYOApxUDGWf4lPayrbQweTiPhdGIWgoifR/a2Cj6xVBmZQfx+ONy3thiCpYihRRnjyQGrh7hXWLu9m7LCssMPJ4Xz20E7cCU/hS9xGE+mdK+SICvYvDvXFXubDdIyuoEEf9FbAN4z7uuUBbuJV0ouCOH4QaD+k2w/1qSPBE4z7uuUBbuJVNq/UVRvg/WtDB5OI+F0YhaCiJ9H9rYKNiGWZ6hnYEx2fi6uU8d/jPAJdXKqYIvc6k7AR2V9RC8mLW1E7VsZRB6xVBmZQfx+ONy3thiCpYikgRopJOZai5w71xV7mw3SOesti0ItOrM+qV6E/q3ryX4z7uuUBbuJVda06JiVzmQbdnNHyB7CF7LlNKor8yYnvQweTiPhdGIWgoifR/a2CjIMslYqDKLY23AlP4UvcRhGj3lQ/u1K004z7uuUBbuJXZbs/Nj1KYstDB5OI+F0YhaCiJ9H9rYKN0T/ucEjF5PZ1wvmyPYreXJCBv6x4bv/pu0YP7Nu5g2NDB5OI+F0YhaCiJ9H9rYKOhL5P5CPMmfY3Le2GIKliKHFNpSrtt65mFdYu72bssK5KdnOzPZf54twJT+FL3EYTpQH95xm5Uz1e19n1oIAdmy0wCTwW+1dqVswhkwvUGUDOPZa2xmRkUvCTUhkR0CW/QweTiPhdGIT52/cnXSmDtDgDBTfsCDU1n4urlPHf4z7ZD8/kKLRRsX+vEdg4CnFQMZZ/iU9rKttDB5OI+F0YhPnb9yddKYO0kSKl1oUnxcdDB5OI+F0YhaCiJ9H9rYKNPW37Oq/0IzMO9cVe5sN0jIVA6RFn+Em3QweTiPhdGIWgoifR/a2CjfXbFNbiqMm99r9ByVqdVqiM7V96J</key></OriginDestinationOption></PriceRequest>";
           DataSet dsPricingResponse = objFlightsBal.GetDatasetFromAPI(XmlPricingRequest, "http://live.arzoo.com:9302/Pricing");

                if (dsPricingResponse.Tables[0].Rows[0]["error"] == string.Empty)
                {
                    //  DataTable dtpricingflightsegment = dsPricingResponse.Tables

                    DataTable dtpricingFlightSegment = dsPricingResponse.Tables["FlightSegment"];
                    if (dtpricingFlightSegment.Rows.Count > 0)
                    {
                        DataRow[] rowFilghtSegment = dtpricingFlightSegment.Select("FlightSegment_ID=" + Convert.ToInt32(lblIntFlightSegmentId.Text));
                        FlightSegmentsID = rowFilghtSegment[0]["FlightSegments_Id"].ToString();

                    }
                    DataTable dtpricingFlightSegments = dsPricingResponse.Tables["FlightSegments"];
                    if (dtpricingFlightSegments.Rows.Count > 0)
                    {
                        DataRow[] rowFilghtSegments = dtpricingFlightSegments.Select("FlightSegments_ID=" + FlightSegmentsID);
                        onwardId = rowFilghtSegments[0]["Onward_Id"].ToString();
                    }
                    DataTable dtpricingOnward = dsPricingResponse.Tables["onward"];
                    if (dtpricingOnward.Rows.Count > 0)
                    {
                        DataRow[] rowOnward = dtpricingOnward.Select("Onward_Id=" + onwardId);
                        OriginDestinationOption_Id = rowOnward[0]["OriginDestinationOption_Id"].ToString();
                    }
                    DataTable dtpricingFareDetails = dsIntFlights.Tables["FareDetails"];
                    if (dtFareDetails.Rows.Count > 0)
                    {
                        DataRow[] rowFareDetails = dtFareDetails.Select("OriginDestinationOption_Id=" + OriginDestinationOption_Id);
                        ActualBaseFare = rowFareDetails[0]["ActualBaseFare"].ToString();
                        Tax = rowFareDetails[0]["Tax"].ToString();
                        STax = rowFareDetails[0]["STax"].ToString();
                        TCharge = rowFareDetails[0]["TCharge"].ToString();
                        SCharge = rowFareDetails[0]["SCharge"].ToString();
                        TDiscount = rowFareDetails[0]["TDiscount"].ToString();
                        TMarkup = rowFareDetails[0]["TMarkup"].ToString();
                        TPartnerCommission = rowFareDetails[0]["TPartnerCommission"].ToString();
                        TSdiscount = rowFareDetails[0]["TSdiscount"].ToString();
                        ocTax = rowFareDetails[0]["ocTax"].ToString();
                        FareDetails_id = rowFareDetails[0]["FareDetails_id"].ToString();
                    }
                }

            #endregion

            string ref1 = Common.GetFlightsReferenceNo("LJIF");

            string xmlRequest = "<Bookingrequest><noadults>" + ddlAdultsInt.SelectedValue + "</noadults><nochild>" + ddlChildsInt.SelectedValue + "</nochild><noinfant>" + ddlInfantsInt.SelectedValue + "</noinfant><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooINTLWS1.0</Clienttype><creditcardno></creditcardno><PartnerreferenceID>" + ref1 + "</PartnerreferenceID>";
            xmlRequest = xmlRequest + "<personName>";

            // Dynamic generation of names of adults, infants , Child
            Table tbladults = (Table)this.UpdatePanel2.FindControl("tblAdultsInt");
            for (int i = 1; i <= Convert.ToInt32(Session["adultCntInt"]); i++)
            {

                TextBox txtFn = (TextBox)tbladults.FindControl("txtFnInt" + i);
                TextBox txtLn = (TextBox)tbladults.FindControl("txtLnInt" + i);
                DropDownList ddlTitle = (DropDownList)tbladults.FindControl("ddlTitleInt" + i);

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

            Table tblChild = (Table)this.UpdatePanel2.FindControl("tblChildInt");
            for (int i = 1; i <= Convert.ToInt32(Session["childCntInt"]); i++)
            {
                TextBox txtFn = (TextBox)tblChild.FindControl("txtCFnInt" + i);

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

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

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

                string age = (DateTime.Now.Year - Convert.ToDateTime(txtBirthDate.Text).Year).ToString();
                //if (Convert.ToInt32(age) > 5)
                //{
                //    Literal lit = new Literal();
                //    lit.Text = txtFn.Text + " Age  between 3 - 5 yrs.";
                //    this.Controls.Add(lit);
                //    break;
                //}

                xmlRequest = xmlRequest + "<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.UpdatePanel2.FindControl("tblInfantsInt");
            for (int i = 1; i <= Convert.ToInt32(Session["infantCntInt"]); i++)
            {
                TextBox txtFn = (TextBox)tblInfants.FindControl("txtIFnInt" + i);

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

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

                TextBox txtBirthDate = (TextBox)tblInfants.FindControl("txtIBirthDateInt" + i);
                string age = string.Empty;
                if (txtBirthDate != null)
                    age = (DateTime.Now.Year - Convert.ToDateTime(txtBirthDate.Text).Year).ToString();
                else
                    age = "0";
                //if (Convert.ToInt32(age) == 12)
                //{
                //    Literal lit = new Literal();
                //    lit.Text = txtFn.Text + " Age should be below 1 yr.";
                //    this.Controls.Add(lit);
                //    break;
                //}

                xmlRequest = xmlRequest + "<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>";
            }

            xmlRequest = xmlRequest + "</personName><telePhone><phoneNumber>" + txtMobileNumInt.Text + "</phoneNumber></telePhone><email><emailAddress>" + txtEmailIDInt.Text + "</emailAddress></email>";
            //xmlRequest = xmlRequest + "<OriginDestinationOption><FareDetails><ActualBaseFare>" + ActualBaseFare + "</ActualBaseFare><Tax>" + Tax + "</Tax><STax>" + STax + "</STax><TCharge>" + TCharge + "</TCharge><SCharge>" + SCharge + "</SCharge><TDiscount>" + TDiscount + "</TDiscount><TMarkup>" + TMarkup + "</TMarkup><TPartnerCommission>" + TPartnerCommission + "</TPartnerCommission><TSdiscount>" + TSdiscount + "</TSdiscount><FareBreakup><FareAry><Fare><PsgrType>" + PsgrType + "</PsgrType><BaseFare>" + BaseFare + "</BaseFare><Tax>" + FareTax + "</Tax><TaxDataAry>";
            //xmlRequest = xmlRequest + taxData + "</TaxDataAry></Fare></FareAry></FareBreakup><ocTax>" + ocTax + "</ocTax></FareDetails><onward><FlightSegments>";
            xmlRequest = xmlRequest + "<OriginDestinationOption><FareDetails><ActualBaseFare>" + ActualBaseFare + "</ActualBaseFare><Tax>" + Tax + "</Tax><STax>" + STax + "</STax><TCharge>" + TCharge + "</TCharge><SCharge>" + SCharge + "</SCharge><TDiscount>" + TDiscount + "</TDiscount><TMarkup>" + TMarkup + "</TMarkup><TPartnerCommission>" + TPartnerCommission + "</TPartnerCommission><TSdiscount>" + TSdiscount + "</TSdiscount><FareBreakup><FareAry>";
            xmlRequest = xmlRequest + str + "</FareAry></FareBreakup><ocTax>" + ocTax + "</ocTax></FareDetails><onward><FlightSegments>";

            if (dtFlightSegment.Rows.Count > 0)
            {
                DataRow[] rowFilghtSegment = dtFlightSegment.Select("FlightSegments_Id=" + FlightSegmentsID);
                for (int j = 0; j < rowFilghtSegment.Length; j++)
                {
                    AirEquipType = rowFilghtSegment[j]["AirEquipType"].ToString();
                    ArrivalAirportCode = rowFilghtSegment[j]["ArrivalAirportCode"].ToString();
                    ArrivalAirportName = rowFilghtSegment[j]["ArrivalAirportName"].ToString();
                    ArrivalDateTime = rowFilghtSegment[j]["ArrivalDateTime"].ToString();
                    DepartureAirportCode = rowFilghtSegment[j]["DepartureAirportCode"].ToString();
                    DepartureAirportName = rowFilghtSegment[j]["DepartureAirportName"].ToString();
                    DepartureDateTime = rowFilghtSegment[j]["DepartureDateTime"].ToString();
                    FlightNumber = rowFilghtSegment[j]["FlightNumber"].ToString();
                    MarketingAirlineCode = rowFilghtSegment[j]["MarketingAirlineCode"].ToString();
                    OperatingAirlineCode = rowFilghtSegment[j]["OperatingAirlineCode"].ToString();
                    OperatingAirlineName = rowFilghtSegment[j]["OperatingAirlineName"].ToString();
                    OperatingAirlineFlightNumber = rowFilghtSegment[j]["OperatingAirlineFlightNumber"].ToString();
                    NumStops = rowFilghtSegment[j]["NumStops"].ToString();
                    LinkSellAgrmnt = rowFilghtSegment[j]["LinkSellAgrmnt"].ToString();
                    Conx = rowFilghtSegment[j]["Conx"].ToString();
                    AirpChg = rowFilghtSegment[j]["AirpChg"].ToString();
                    InsideAvailOption = rowFilghtSegment[j]["InsideAvailOption"].ToString();
                    GenTrafRestriction = rowFilghtSegment[j]["GenTrafRestriction"].ToString();
                    DaysOperates = rowFilghtSegment[j]["DaysOperates"].ToString();
                    JrnyTm = rowFilghtSegment[j]["JrnyTm"].ToString();
                    EndDt = rowFilghtSegment[j]["EndDt"].ToString();
                    StartTerminal = rowFilghtSegment[j]["StartTerminal"].ToString();
                    EndTerminal = rowFilghtSegment[j]["EndTerminal"].ToString();
                    FltTm = rowFilghtSegment[j]["FltTm"].ToString();
                    LSAInd = rowFilghtSegment[j]["LSAInd"].ToString();
                    Mile = rowFilghtSegment[j]["Mile"].ToString();

                    DataTable dtBookingClass1 = dsIntFlights.Tables[13];
                    if (dtBookingClass1.Rows.Count > 0)
                    {
                        DataRow[] rowBookingClass = dtBookingClass1.Select("FlightSegment_Id=" + rowFilghtSegment[j]["FlightSegment_Id"].ToString());
                        Availability = rowBookingClass[0]["Availability"].ToString();
                        BIC = rowBookingClass[0]["BIC"].ToString();
                    }

                    DataTable dtBookingClassFare1 = dsIntFlights.Tables[14];
                    if (dtBookingClassFare1.Rows.Count > 0)
                    {
                        DataRow[] rowBookingClassFare = dtBookingClassFare1.Select("FlightSegment_Id=" + rowFilghtSegment[j]["FlightSegment_Id"].ToString());
                        bookingclass = rowBookingClassFare[0]["bookingclass"].ToString();
                        classType = rowBookingClassFare[0]["classType"].ToString();
                        farebasiscode = rowBookingClassFare[0]["farebasiscode"].ToString();
                        Rule = rowBookingClassFare[0]["Rule"].ToString();

                    }

                    xmlRequest = xmlRequest + "<FlightSegment><AirEquipType>" + AirEquipType + "</AirEquipType><ArrivalAirportCode>" + ArrivalAirportCode + "</ArrivalAirportCode><ArrivalAirportName>" + ArrivalAirportName + "</ArrivalAirportName><ArrivalDateTime>" + ArrivalDateTime + "</ArrivalDateTime><DepartureAirportCode>" + DepartureAirportCode + "</DepartureAirportCode><DepartureAirportName>" + DepartureAirportName + "</DepartureAirportName><DepartureDateTime>" + DepartureDateTime + "</DepartureDateTime><FlightNumber>" + FlightNumber + "</FlightNumber>";
                    xmlRequest = xmlRequest + "<MarketingAirlineCode>" + MarketingAirlineCode + "</MarketingAirlineCode><OperatingAirlineCode>" + OperatingAirlineCode + "</OperatingAirlineCode><OperatingAirlineName>" + OperatingAirlineName + "</OperatingAirlineName><OperatingAirlineFlightNumber>" + OperatingAirlineFlightNumber + "</OperatingAirlineFlightNumber><NumStops>" + NumStops + "</NumStops><LinkSellAgrmnt>" + LinkSellAgrmnt + "</LinkSellAgrmnt><Conx>" + Conx + "</Conx><AirpChg>" + AirpChg + "</AirpChg><InsideAvailOption>" + InsideAvailOption + "</InsideAvailOption><GenTrafRestriction>" + GenTrafRestriction + "</GenTrafRestriction><DaysOperates>" + DaysOperates + "</DaysOperates><JrnyTm>" + JrnyTm + "</JrnyTm><EndDt>" + EndDt + "</EndDt><StartTerminal>" + StartTerminal + "</StartTerminal><EndTerminal>" + EndTerminal + "</EndTerminal>";
                    xmlRequest = xmlRequest + "<FltTm>" + FltTm + "</FltTm><LSAInd>" + LSAInd + "</LSAInd><Mile>" + Mile + "</Mile><BookingClass><Availability>" + Availability + "</Availability><BIC>" + BIC + "</BIC></BookingClass><BookingClassFare><bookingclass>" + bookingclass + "</bookingclass><classType>" + classType + "</classType><farebasiscode>" + farebasiscode + "</farebasiscode><Rule>" + Rule.Replace("<", "&lt;").Replace(">", "&gt;") + "</Rule>";
                    if (dtBookingClassFare.Columns.Contains("bookingclassFare_Id"))
                    {
                        xmlRequest = xmlRequest + "<PsgrBreakup><PsgrAry><Psgr><PsgrType>" + FarePsgrType + "</PsgrType><BaseFare>" + FareBaseFare + "</BaseFare><Tax>" + FareTax1 + "</Tax><BagInfo></BagInfo></Psgr></PsgrAry></PsgrBreakup>";
                    }
                    xmlRequest = xmlRequest + "</BookingClassFare></FlightSegment>";
                }
            }
            xmlRequest = xmlRequest + "</FlightSegments></onward><Return>" + return1 + "</Return><id>" + id + "</id><key>" + key + "</key>";
            xmlRequest = xmlRequest + "</OriginDestinationOption></Bookingrequest>";

            #region Unwanted Code
            //xmlRequest = "<Bookingrequest><noadults>1</noadults><nochild>0</nochild><noinfant>0</noinfant><Clientid>" + FlightsConstants.USERID + "</Clientid>";
            //xmlRequest = xmlRequest + "<Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooINTLWS1.0</Clienttype><creditcardno></creditcardno><PartnerreferenceID>" + ref1 + "</PartnerreferenceID><personName><CustomerInfo><givenName>Bindu</givenName> <surName>B</surName>";
            //xmlRequest = xmlRequest + "<nameReference>Mrs.</nameReference>";
            //xmlRequest = xmlRequest + "<psgrtype>adt</psgrtype>";
            //xmlRequest = xmlRequest + "</CustomerInfo>";
            //xmlRequest = xmlRequest + "</personName>";
            //xmlRequest = xmlRequest + "<telePhone>";
            //xmlRequest = xmlRequest + "<phoneNumber>9701213996</phoneNumber>";
            //xmlRequest = xmlRequest + "</telePhone>";
            //xmlRequest = xmlRequest + "<email>";
            //xmlRequest = xmlRequest + "<emailAddress>[email protected]</emailAddress>";
            //xmlRequest = xmlRequest + "</email>";
            //xmlRequest = xmlRequest + "<OriginDestinationOption>";
            //xmlRequest = xmlRequest + "<FareDetails>";
            //xmlRequest = xmlRequest + "<ActualBaseFare>21250</ActualBaseFare>";
            //xmlRequest = xmlRequest + "<Tax>19675</Tax>";
            //xmlRequest = xmlRequest + "<STax>264</STax>";
            //xmlRequest = xmlRequest + "<TCharge>0</TCharge>";
            //xmlRequest = xmlRequest + "<SCharge>0</SCharge>";
            //xmlRequest = xmlRequest + "<TDiscount>0</TDiscount>";
            //xmlRequest = xmlRequest + "<TMarkup>0</TMarkup>";
            //xmlRequest = xmlRequest + "<TPartnerCommission>0</TPartnerCommission>";
            //xmlRequest = xmlRequest + "<TSdiscount>0</TSdiscount>";
            //xmlRequest = xmlRequest + "<FareBreakup>";
            //xmlRequest = xmlRequest + "<FareAry>";
            //xmlRequest = xmlRequest + "<Fare>";
            //xmlRequest = xmlRequest + "<PsgrType>ADT</PsgrType>";
            //xmlRequest = xmlRequest + "<BaseFare>21250</BaseFare>";
            //xmlRequest = xmlRequest + "<Tax>19675</Tax>";
            //xmlRequest = xmlRequest + "<TaxDataAry>";
            //xmlRequest = xmlRequest + "<TaxData>";
            //xmlRequest = xmlRequest + "<Country>YQ</Country>";
            //xmlRequest = xmlRequest + "<Amt>0</Amt>";
            //xmlRequest = xmlRequest + "</TaxData>";
            //xmlRequest = xmlRequest + "<TaxData>";
            //xmlRequest = xmlRequest + "<Country>WO</Country>";
            //xmlRequest = xmlRequest + "<Amt>7108</Amt>";
            //xmlRequest = xmlRequest + "</TaxData>";
            //xmlRequest = xmlRequest + "<TaxData>";
            //xmlRequest = xmlRequest + "<Country>Other</Country>";
            //xmlRequest = xmlRequest + "<Amt>12567</Amt>";
            //xmlRequest = xmlRequest + "</TaxData>";
            //xmlRequest = xmlRequest + "</TaxDataAry>";
            //xmlRequest = xmlRequest + "</Fare>";
            //xmlRequest = xmlRequest + "</FareAry>";
            //xmlRequest = xmlRequest + "</FareBreakup>";
            //xmlRequest = xmlRequest + "<ocTax>0</ocTax>";
            //xmlRequest = xmlRequest + "</FareDetails>";
            //xmlRequest = xmlRequest + "<onward>";
            //xmlRequest = xmlRequest + "<FlightSegments>";
            //xmlRequest = xmlRequest + "<FlightSegment>";
            //xmlRequest = xmlRequest + "<AirEquipType>744</AirEquipType>";
            //xmlRequest = xmlRequest + "<ArrivalAirportCode>LHR</ArrivalAirportCode>";
            //xmlRequest = xmlRequest + "<ArrivalAirportName>London</ArrivalAirportName>";
            //xmlRequest = xmlRequest + "<ArrivalDateTime>2012-11-19T13:25:00</ArrivalDateTime>";
            //xmlRequest = xmlRequest + "<DepartureAirportCode>BLR</DepartureAirportCode>";
            //xmlRequest = xmlRequest + "<DepartureAirportName>BANGALORE</DepartureAirportName>";
            //xmlRequest = xmlRequest + "<DepartureDateTime>2012-11-19T07:50:00</DepartureDateTime>";
            //xmlRequest = xmlRequest + "<FlightNumber>6656</FlightNumber>";
            //xmlRequest = xmlRequest + "<MarketingAirlineCode>AA</MarketingAirlineCode>";
            //xmlRequest = xmlRequest + "<OperatingAirlineCode>BA</OperatingAirlineCode>";
            //xmlRequest = xmlRequest + "<OperatingAirlineName>American Airlines </OperatingAirlineName>";
            //xmlRequest = xmlRequest + "<OperatingAirlineFlightNumber>6656</OperatingAirlineFlightNumber>";
            //xmlRequest = xmlRequest + "<NumStops>0</NumStops>";
            //xmlRequest = xmlRequest + "<LinkSellAgrmnt />";
            //xmlRequest = xmlRequest + "<Conx>N</Conx>";
            //xmlRequest = xmlRequest + "<AirpChg>N</AirpChg>";
            //xmlRequest = xmlRequest + "<InsideAvailOption>C</InsideAvailOption>";
            //xmlRequest = xmlRequest + "<GenTrafRestriction>?</GenTrafRestriction>";
            //xmlRequest = xmlRequest + "<DaysOperates>NA</DaysOperates>";
            //xmlRequest = xmlRequest + "<JrnyTm>665</JrnyTm>";
            //xmlRequest = xmlRequest + "<EndDt />";
            //xmlRequest = xmlRequest + "<StartTerminal />";
            //xmlRequest = xmlRequest + "<EndTerminal />";
            //xmlRequest = xmlRequest + "<FltTm>665</FltTm>";
            //xmlRequest = xmlRequest + "<LSAInd>R</LSAInd>";
            //xmlRequest = xmlRequest + "<Mile>0</Mile>";
            //xmlRequest = xmlRequest + "<BookingClass>";
            //xmlRequest = xmlRequest + "<Availability>1</Availability>";
            //xmlRequest = xmlRequest + "<BIC>S</BIC>";
            //xmlRequest = xmlRequest + "</BookingClass>";
            //xmlRequest = xmlRequest + "<BookingClassFare>";
            //xmlRequest = xmlRequest + "<bookingclass>S</bookingclass>";
            //xmlRequest = xmlRequest + "<classType>Economy</classType>";
            //xmlRequest = xmlRequest + "<farebasiscode>ZeHo17My7PSA3CBU2WO9J34bX8FEuX61F9zkShsUkYU=</farebasiscode>";
            //xmlRequest = xmlRequest + "<Rule>Cancellation Penalty: All bookings done are subject to the cancellation penalty levied by the respective airline.&lt;br&gt;In addition to the airline''s cancellation penalty, we charge a service fee of Rs. 200 per passenger for all cancellations.|Date Change Penalty: In addition to the airline''s date change penalty, we charge a service fee of Rs. 250 per passenger for any date changes.|</Rule>";
            //xmlRequest = xmlRequest + "<PsgrBreakup>";
            //xmlRequest = xmlRequest + "<PsgrAry>";
            //xmlRequest = xmlRequest + "<Psgr>";
            //xmlRequest = xmlRequest + "<PsgrType>ADT</PsgrType>";
            //xmlRequest = xmlRequest + "<BaseFare>21250</BaseFare>";
            //xmlRequest = xmlRequest + "<Tax>19675</Tax>";
            //xmlRequest = xmlRequest + "<BagInfo />";
            //xmlRequest = xmlRequest + "</Psgr>";
            //xmlRequest = xmlRequest + "</PsgrAry>";
            //xmlRequest = xmlRequest + "</PsgrBreakup>";
            //xmlRequest = xmlRequest + "</BookingClassFare>";
            //xmlRequest = xmlRequest + "</FlightSegment>";
            //xmlRequest = xmlRequest + "<FlightSegment>";
            //xmlRequest = xmlRequest + "<AirEquipType>777</AirEquipType>";
            //xmlRequest = xmlRequest + "<ArrivalAirportCode>JFK</ArrivalAirportCode>";
            //xmlRequest = xmlRequest + "<ArrivalAirportName>NEW YORK</ArrivalAirportName>";
            //xmlRequest = xmlRequest + "<ArrivalDateTime>2012-11-19T18:10:00</ArrivalDateTime>";
            //xmlRequest = xmlRequest + "<DepartureAirportCode>LHR</DepartureAirportCode>";
            //xmlRequest = xmlRequest + "<DepartureAirportName>London</DepartureAirportName>";
            //xmlRequest = xmlRequest + "<DepartureDateTime>2012-11-19T15:15:00</DepartureDateTime>";
            //xmlRequest = xmlRequest + "<FlightNumber>6134</FlightNumber>";
            //xmlRequest = xmlRequest + "<MarketingAirlineCode>AA</MarketingAirlineCode>";
            //xmlRequest = xmlRequest + "<OperatingAirlineCode>BA</OperatingAirlineCode>";
            //xmlRequest = xmlRequest + "<OperatingAirlineName>American Airlines </OperatingAirlineName>";
            //xmlRequest = xmlRequest + "<OperatingAirlineFlightNumber>6134</OperatingAirlineFlightNumber>";
            //xmlRequest = xmlRequest + "<NumStops>0</NumStops>";
            //xmlRequest = xmlRequest + "<LinkSellAgrmnt />";
            //xmlRequest = xmlRequest + "<Conx>N</Conx>";
            //xmlRequest = xmlRequest + "<AirpChg>N</AirpChg>";
            //xmlRequest = xmlRequest + "<InsideAvailOption>C</InsideAvailOption>";
            //xmlRequest = xmlRequest + "<GenTrafRestriction>?</GenTrafRestriction>";
            //xmlRequest = xmlRequest + "<DaysOperates>NA</DaysOperates>";
            //xmlRequest = xmlRequest + "<JrnyTm>985</JrnyTm>";
            //xmlRequest = xmlRequest + "<EndDt />";
            //xmlRequest = xmlRequest + "<StartTerminal />";
            //xmlRequest = xmlRequest + "<EndTerminal />";
            //xmlRequest = xmlRequest + "<FltTm>985</FltTm>";
            //xmlRequest = xmlRequest + "<LSAInd>R</LSAInd>";
            //xmlRequest = xmlRequest + "<Mile>0</Mile>";
            //xmlRequest = xmlRequest + "<BookingClass>";
            //xmlRequest = xmlRequest + "<Availability>7</Availability>";
            //xmlRequest = xmlRequest + "<BIC>S</BIC>";
            //xmlRequest = xmlRequest + "</BookingClass>";
            //xmlRequest = xmlRequest + "<BookingClassFare>";
            //xmlRequest = xmlRequest + "<bookingclass>S</bookingclass>";
            //xmlRequest = xmlRequest + "<classType>Economy</classType>";
            //xmlRequest = xmlRequest + "<farebasiscode>ZeHo17My7PSA3CBU2WO9J34bX8FEuX61F9zkShsUkYU=</farebasiscode>";
            //xmlRequest = xmlRequest + "<Rule>Cancellation Penalty: All bookings done are subject to the cancellation penalty levied by the respective airline.&lt;br&gt;In addition to the airline''s cancellation penalty, we charge a service fee of Rs. 200 per passenger for all cancellations.|Date Change Penalty: In addition to the airline''s date change penalty, we charge a service fee of Rs. 250 per passenger for any date changes.|</Rule>";
            //xmlRequest = xmlRequest + "<PsgrBreakup>";
            //xmlRequest = xmlRequest + "<PsgrAry>";
            //xmlRequest = xmlRequest + "<Psgr>";
            //xmlRequest = xmlRequest + "<PsgrType>ADT</PsgrType>";
            //xmlRequest = xmlRequest + "<BaseFare>21250</BaseFare>";
            //xmlRequest = xmlRequest + "<Tax>19675</Tax>";
            //xmlRequest = xmlRequest + "<BagInfo />";
            //xmlRequest = xmlRequest + "</Psgr>";
            //xmlRequest = xmlRequest + "</PsgrAry>";
            //xmlRequest = xmlRequest + "</PsgrBreakup>";
            //xmlRequest = xmlRequest + "</BookingClassFare>";
            //xmlRequest = xmlRequest + "</FlightSegment>";
            //xmlRequest = xmlRequest + "</FlightSegments>";
            //xmlRequest = xmlRequest + "</onward>";
            //xmlRequest = xmlRequest + "<Return />";
            //xmlRequest = xmlRequest + "<id>arzoo13</id>";
            //xmlRequest = xmlRequest + "<key>";
            //xmlRequest = xmlRequest + "zWbxBFyA059f68R2DgKcVEb0gG2ZuxB2eOVHvZcIhsrrFUGZlB/H443Le2GIKliKcDol4S0eYt5n";
            //xmlRequest = xmlRequest + "4urlPHf4zwkxESOCSurS2zJT2fsu8E6Ny3thiCpYihRRnjyQGrh7hXWLu9m7LCssMPJ4Xz20E7cC";
            //xmlRequest = xmlRequest + "U/hS9xGE+mdK+SICvYvDvXFXubDdIyuoEEf9FbAN4z7uuUBbuJWfy8uNPG/9b2fi6uU8d/jPtkPz";
            //xmlRequest = xmlRequest + "+QotFGxf68R2DgKcVAxln+JT2sq20MHk4j4XRiE+dv3J10pg7QerGRHTwDoP0MHk4j4XRiFoKIn0";
            //xmlRequest = xmlRequest + "f2tgo/6/bBnC356utwJT+FL3EYQxhMrs9+Ll73qUfflxOSlgjct7YYgqWIooknPUNPq0fsMbz0mC";
            //xmlRequest = xmlRequest + "CnYdPxS/giio89vDvXFXubDdI5p3QtIQ6TM+X+vEdg4CnFSHVzKRaecmxRqaN5ZXELxy0MHk4j4X";
            //xmlRequest = xmlRequest + "RiFoKIn0f2tgo08iYOkW5WfDVAdtvjUETBAUbFQMZCvw/rcCU/hS9xGEV/KirOjbVWVf68R2DgKc";
            //xmlRequest = xmlRequest + "VIdXMpFp5ybFFnoP/rNoJySNy3thiCpYinP52+a6dCWv4z7uuUBbuJUr4zgoGssePSsZx2FQz4Qz";
            //xmlRequest = xmlRequest + "Mi4GIKZ/bQN5v2nhdWyUxWkXlLIRnKfWBOVnFhmDx7P+RkIizk8EmY3Le2GIKliKvHScqTjHzQGF";
            //xmlRequest = xmlRequest + "dYu72bssK9yA/LGYY4DttwJT+FL3EYR8llOd/AvvBcO9cVe5sN0jaHWZ74lyniM+CXHuBVUeI0eC";
            //xmlRequest = xmlRequest + "jTlyW+v3IvPKAXmAs/XjPu65QFu4lRIiMi13yfqv0MHk4j4XRiFoKIn0f2tgo3rxF/w/vseO0MHk";
            //xmlRequest = xmlRequest + "4j4XRiFoKIn0f2tgo08iYOkW5WfDtBFngPW6tS4UbFQMZCvw/rcCU/hS9xGEPmH+rCYA9GVn4url";
            //xmlRequest = xmlRequest + "PHf4z/KpTLVv6TwZmq/OLBKU+urDvXFXubDdI76GeeoT8f7/mZIC7bwXLBPEyJNwmQ0Hhl/rxHYO";
            //xmlRequest = xmlRequest + "ApxUwsS2F117BWpVx8rwsmCp/7cCU/hS9xGEO2M3JTnaOUPjPu65QFu4lcYxXFxB1Lxm2zJT2fsu";
            //xmlRequest = xmlRequest + "8E6Ny3thiCpYiskg7jRgjK6SgNO9QJL9N+kUA6rZxn6L2roVT2rwaaIHT9JeYXDjtB74LCthwRi6";
            //xmlRequest = xmlRequest + "QuM+7rlAW7iVci/YXLUgYhtn4urlPHf4z0sauaT5dh0YX+vEdg4CnFRm6meIMgjYjdDB5OI+F0Yh";
            //xmlRequest = xmlRequest + "aCiJ9H9rYKMzmFBNkf0Z9F/rxHYOApxU8q6B7/fP8qZn4urlPHf4z6xCf1SAy2vSGs5/DTSC7BXj";
            //xmlRequest = xmlRequest + "Pu65QFu4lXSi4I4fhBoPMaaYjNFAcsm3AlP4UvcRhPpnSvkiAr2Lw71xV7mw3SMrqBBH/RWwDeM+";
            //xmlRequest = xmlRequest + "7rlAW7iVdKLgjh+EGg9kUDg3MAXg5eM+7rlAW7iV3nbymUm4szIU66LMw4VmWYV1i7vZuywr4wJX";
            //xmlRequest = xmlRequest + "2WV2PV5f68R2DgKcVAxln+JT2sq20MHk4j4XRiEuvf9jqO9829DB5OI+F0YhE8ZmQzVYvJbgy4cv";
            //xmlRequest = xmlRequest + "1MfIol/rxHYOApxUuPBYmR6Sgw5f68R2DgKcVCB0cQSVLEagT+e92o4/qz5f68R2DgKcVMcBF2dl";
            //xmlRequest = xmlRequest + "btCnrziqklPvBLLl8OEMpKE9Rrqlvng58vzQsS7VmIqni8k6cEhUG/jNng==";
            //xmlRequest = xmlRequest + "</key>";
            //xmlRequest = xmlRequest + "</OriginDestinationOption>";
            //xmlRequest = xmlRequest + "</Bookingrequest>";

            #endregion

            StringBuilder stt = new StringBuilder();

            stt.Append("xmlRequest");
            stt.Append("=");
            stt.Append(Server.UrlEncode(xmlRequest));
            byte[] requestData = Encoding.UTF8.GetBytes(stt.ToString());

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://live.arzoo.com:9302/Booking");

            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.Accept = "application/json";

            request.ContentLength = requestData.Length;

            using (Stream requestStream = request.GetRequestStream())
            {
                requestStream.Write(requestData, 0, requestData.Length);
            }
            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            {
                using (Stream stream = response.GetResponseStream())
                {
                    using (StreamReader reader = new StreamReader(stream, Encoding.ASCII))
                        result = reader.ReadToEnd();
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(result);
                    XmlNodeReader xmlReader = new XmlNodeReader(doc);

                    ds.ReadXml(xmlReader);
                }
            }

            //result = "<Bookingresponse><OriginDestinationOption><FareDetails><ActualBaseFare>85035</ActualBaseFare><Tax>4079</Tax><STax>1055</STax><TCharge>0</TCharge><SCharge>0</SCharge><TDiscount>0</TDiscount><TMarkup>150</TMarkup><TPartnerCommission>0</TPartnerCommission><TSdiscount>0</TSdiscount><FareBreakup><FareAry><Fare><PsgrType>ADT</PsgrType><BaseFare>85035</BaseFare><Tax>4079</Tax></Fare></FareAry></FareBreakup></FareDetails><onward><FlightSegments><FlightSegment><AirEquipType>77W</AirEquipType><ArrivalAirportCode>LHR</ArrivalAirportCode><ArrivalAirportName>LONDON&lt;BR&gt; (HEATHROW)</ArrivalAirportName><ArrivalDateTime>2010-02-26T06:35:00</ArrivalDateTime><DepartureAirportCode>BOM</DepartureAirportCode><DepartureAirportName>MUMBAI&lt;BR&gt; (CHHATRAPATI SHIVAJI INTERNATIONAL)</DepartureAirportName><DepartureDateTime>2010-02-26T02:05:00</DepartureDateTime><FlightNumber>4131</FlightNumber><MarketingAirlineCode>BD</MarketingAirlineCode><OperatingAirlineCode>BD</OperatingAirlineCode><OperatingAirlineName>British Midland</OperatingAirlineName><OperatingAirlineFlightNumber>4131</OperatingAirlineFlightNumber><NumStops>0</NumStops><LinkSellAgrmnt></LinkSellAgrmnt><Conx>N</Conx><AirpChg>N</AirpChg><InsideAvailOption>C</InsideAvailOption><GenTrafRestriction>?</GenTrafRestriction><DaysOperates>NA</DaysOperates><JrnyTm></JrnyTm><EndDt></EndDt><StartTerminal></StartTerminal><EndTerminal></EndTerminal><FltTm>0</FltTm><LSAInd>R</LSAInd><Mile>0</Mile><BookingClass><Availability>9</Availability><BIC>Y</BIC></BookingClass><BookingClassFare><bookingclass>Y</bookingclass><classType>Economy</classType><farebasiscode>rb8QAsvpFIPpZo9gBUBg+6BMOP0MtJ7L</farebasiscode><Rule></Rule><PsgrBreakup><PsgrAry><Psgr><PsgrType>ADT</PsgrType><BaseFare>85035</BaseFare><Tax>4079</Tax><BagInfo></BagInfo></Psgr></PsgrAry></PsgrBreakup></BookingClassFare></FlightSegment><FlightSegment><AirEquipType>346</AirEquipType><ArrivalAirportCode>JFK</ArrivalAirportCode><ArrivalAirportName>NEW YORK&lt;BR&gt; (JOHN F KENNEDY INTL)</ArrivalAirportName><ArrivalDateTime>2010-02-26T12:20:00</ArrivalDateTime><DepartureAirportCode>LHR</DepartureAirportCode><DepartureAirportName>LONDON&lt;BR&gt; (HEATHROW)</DepartureAirportName><DepartureDateTime>2010-02-26T09:20:00</DepartureDateTime><FlightNumber>8223</FlightNumber><MarketingAirlineCode>CO</MarketingAirlineCode><OperatingAirlineCode>CO</OperatingAirlineCode><OperatingAirlineName>Continental Airlines </OperatingAirlineName><OperatingAirlineFlightNumber>8223</OperatingAirlineFlightNumber><NumStops>0</NumStops><LinkSellAgrmnt></LinkSellAgrmnt><Conx>N</Conx><AirpChg>N</AirpChg><InsideAvailOption>C</InsideAvailOption><GenTrafRestriction>?</GenTrafRestriction><DaysOperates>NA</DaysOperates><JrnyTm></JrnyTm><EndDt></EndDt><StartTerminal></StartTerminal><EndTerminal></EndTerminal><FltTm>0</FltTm><LSAInd>R</LSAInd><Mile>0</Mile><BookingClass><Availability>4</Availability><BIC>L</BIC></BookingClass><BookingClassFare><bookingclass>L</bookingclass><classType>Economy</classType><farebasiscode>rb8QAsvpFIPpZo9gBUBg+6BMOP0MtJ7L</farebasiscode><Rule></Rule><PsgrBreakup><PsgrAry><Psgr><PsgrType>ADT</PsgrType><BaseFare>85035</BaseFare><Tax>4079</Tax><BagInfo></BagInfo></Psgr></PsgrAry></PsgrBreakup></BookingClassFare></FlightSegment></FlightSegments></onward><Return/><id>arzoo100</id><key>ayCbutV8CZjQweTiPhdGIT52/cnXSmDtWDF6uoVa0Yx+dIrODcZqUYV1i7vZuywrXxtmsFOjbi9n4urlPHf4zxGFVKSEVPuglBZfw/aOkGOFdYu72bssKyww8nhfPbQTtwJT+FL3EYT6Z0r5IgK9i8O9cVe5sN0jK6gQR/0VsA3jPu65QFu4leESvkw2tYVo0MHk4j4XRiFoKIn0f2tgo+sVQZmUH8fjjct7YYgqWIoUUZ48kBq4e/0pg3DmQVVVo2Q3a0AUQSXLUP1Wu6PBd4V1i7vZuywrSdRter3iPenjPu65QFu4lbsv+JV45WPGtyljvg7883Sh2gnY0OmCJCn868u75ToLhXWLu9m7LCuMmusGneSEdRuxNaSOsudhnGqNtXQ916PjPu65QFu4lU2r9RVG+D9a0MHk4j4XRiFoKIn0f2tgozK2rkfhSWEWx6xZaH0ssx82RPW27flqmu5f2a5HBe02z/lJy0jWbT0M1G6o3Y+hzWfi6uU8d/jPAJdXKqYIvc5G93zQPY0iVQD8L1fsyfdm6xVBmZQfx+ONy3thiCpYihlAiI3xsTJF4z7uuUBbuJUEGsOfbTr3UF/rxHYOApxUsDfYCka6IQumFoD34DG1PbcCU/hS9xGEMwKsr63khSb3Qspj6nxBZe9bfmEZ7GUgEriX6+12U2wkVz4JY1XabcCU/hS9xGEcUGtscRHmuLDvXFXubDdIz12g5QheQXO4z7uuUBbuJVmadCAqLb2y2fi6uU8d/jPS1i6Qoti3wtoJoL9ZE4l6rEu1ZiKp4vJfk8fwf1jcc9f68R2DgKcVK1lGTAnSPxSl9HJUgz+eC+FdYu72bssKzNAqSxshbWRYUz9VFYzmixqeExNPowVA78GaMTl9BYe0fUDu2DE3rHDvXFXubDdI3dYiTg2zkNgU+gGkoFGtlfAPC2FpjoIsV/rxHYOApxURZOpRI/EzoEVg7MnTiMjPoV1i7vZuywrp7AOSJb8tei2GAYztr4tGO6Udvv6goYtX+vEdg4CnFThuwJPu5BuYitpzzDzl21bJ/v5/y98kwILsR2pjhA21YV1i7vZuywrGJgEwhHzH+9n4urlPHf4zwMsIQITsGsy0MHk4j4XRiFoKIn0f2tgowznwUkbWS71w71xV7mw3SOi9DZLo5De59CaB/YiXgfO40U/DdrAcfnP5jcg4z9RPIZB8/lb/sd5w71xV7mw3SNZoQyFRfkMl+M+7rlAW7iVOm7uM/9yhhNn4urlPHf4z7kR+x0lYQ5LX+vEdg4CnFRKt+2PZYo+CjOuGPE4fK4oZ+Lq5Tx3+M9KeFGbag7+buM+7rlAW7iVdKLgjh+EGg8Mv3JUr8Yz2NNESEN0N1nFqHicn8G1rgW8dJypOMfNAYV1i7vZuywrLDDyeF89tBO3AlP4UvcRhPpnSvkiAr2L00RIQ3Q3WcWoeJyfwbWuBfSvd+pfPzkTw71xV7mw3SNdcG/zHitfN1rAgZFeAikBjct7YYgqWIpXyYBKr/eg5uM+7rlAW7iVygQsiztYTQ9f68R2DgKcVBCq+RQJHE/z</key></OriginDestinationOption><telePhone><phoneNumber>9879961339</phoneNumber></telePhone><email><emailAddress>[email protected]</emailAddress></email><noadults>1</noadults><nochild>0</nochild><noinfant>0</noinfant><Clientid>Given By Arzoo.com</Clientid><Clienttype>ArzooINTLWS1.0</Clienttype><creditcardno>1234567890123456</creditcardno><error></error><personName><CustomerInfo><givenName>Sagar</givenName><surName>Arora</surName><nameReference>Mr.</nameReference><psgrtype>adt</psgrtype></CustomerInfo></personName><status>SUCCESS</status><transid>A396009</transid></Bookingresponse>";

            //   XmlDocument doc = new XmlDocument();
            //   doc.LoadXml(result);
            //   XmlNodeReader xmlReader = new XmlNodeReader(doc);

            //   ds.ReadXml(xmlReader);

        }

        catch (Exception ex)
        {
            if (ex.Message.Contains("409"))
            {
                lblerror.Text = "Please contact administrator";
                lblerror.Visible = true;
            }
        }
        return ds;
    }
    protected void btnIntBook_Click(object sender, EventArgs e)
    {
        if (Session["UserID"] == null) { Response.Redirect("~/Default.aspx", false); return; }
        ClsBAL objBAL = new ClsBAL();
        DataSet dsBookingResponse = new DataSet();

        //if (Session["Role"].ToString() == "Agent")
        //{

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

        DataSet dsCommSlab = objBAL.GetCommissionSlab(Session["Role"].ToString(), "InterNationalFlights",lblairline.Text); // Change it
        string commisionPercentage = string.Empty;
        if (dsCommSlab.Tables[0].Rows.Count > 0)
            commisionPercentage = dsCommSlab.Tables[0].Rows[0]["Commission"].ToString();// Change it
        else
            commisionPercentage = "0";

        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 = Session["TotalFare"].ToString();

        string deductAmount = Convert.ToString(Convert.ToDouble(actualFare.ToString()) -
            ((Convert.ToDouble(actualFare.ToString()) * Convert.ToDouble(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 = GetIntBookingRequest();
        }
        else { lblMsg.Text = "Please contact administrator."; return; }
        //}
        //else if (Session["Role"].ToString() == "User")
        //{

        //}

        #region Save Response
        FlightBAL objFlightBal = new FlightBAL();
        if (dsBookingResponse.Tables.Count > 0)
        {
            if (dsBookingResponse.Tables["BookingResponse"].Rows.Count > 0)
            {
                objFlightBal.ReferenceNo = Common.GetFlightsReferenceNo("LJIF");
                objFlightBal.TransId = dsBookingResponse.Tables["BookingResponse"].Rows[0]["transid"].ToString();
                objFlightBal.Status = dsBookingResponse.Tables["BookingResponse"].Rows[0]["status"].ToString();
                objFlightBal.AdultPax = Convert.ToInt32(dsBookingResponse.Tables["BookingResponse"].Rows[0]["noadults"].ToString());
                objFlightBal.InfantPax = Convert.ToInt32(dsBookingResponse.Tables["BookingResponse"].Rows[0]["noinfant"].ToString());
                objFlightBal.ChildPax = Convert.ToInt32(dsBookingResponse.Tables["BookingResponse"].Rows[0]["nochild"].ToString());
                objFlightBal.Origin_Destination_Id = dsBookingResponse.Tables["OriginDestinationOption"].Rows[0]["id"].ToString();
                objFlightBal.Origin_Destination_Key = dsBookingResponse.Tables["OriginDestinationOption"].Rows[0]["key"].ToString();
                objFlightBal.ActualBasefare = Convert.ToDecimal(dsBookingResponse.Tables["FareDetails"].Rows[0]["ActualBasefare"].ToString());
                objFlightBal.Tax = Convert.ToDecimal(dsBookingResponse.Tables["FareDetails"].Rows[0]["Tax"].ToString());
                objFlightBal.STax = Convert.ToDecimal(dsBookingResponse.Tables["FareDetails"].Rows[0]["STax"].ToString());
                objFlightBal.TCharge = Convert.ToDecimal(dsBookingResponse.Tables["FareDetails"].Rows[0]["TCharge"].ToString());
                objFlightBal.Scharge = Convert.ToDecimal(dsBookingResponse.Tables["FareDetails"].Rows[0]["Scharge"].ToString());
                objFlightBal.TDiscount = Convert.ToDecimal(dsBookingResponse.Tables["FareDetails"].Rows[0]["TDiscount"].ToString());
                objFlightBal.TMarkUp = Convert.ToDecimal(dsBookingResponse.Tables["FareDetails"].Rows[0]["TMarkUp"].ToString());
                objFlightBal.TPartnerCommission = Convert.ToDecimal(dsBookingResponse.Tables["FareDetails"].Rows[0]["TPartnerCommission"].ToString());
                objFlightBal.TSDiscount = Convert.ToDecimal(dsBookingResponse.Tables["FareDetails"].Rows[0]["TSDiscount"].ToString());
                objFlightBal.CreatedBy = Convert.ToInt32(Session["UserID"]);
                objFlightBal.TripMode = "One";

                DataTable dtflightBookingId = objFlightBal.AddDInternationalFlightBooking(objFlightBal);
                string flightBookingId = dtflightBookingId.Rows[0]["FlightBookingID"].ToString();

                //Do the Insert of Flgiht Segment

                objFlightBal.FlightBookingID = flightBookingId.ToString();
                if (dsBookingResponse.Tables["FlightSegment"].Rows.Count > 0)
                {
                    for (int j = 0; j < dsBookingResponse.Tables["FlightSegment"].Rows.Count; j++)
                    {
                        objFlightBal.AirEquipType = dsBookingResponse.Tables["FlightSegment"].Rows[j]["AirEquipType"].ToString();
                        objFlightBal.ArrivalAirportCode = dsBookingResponse.Tables["FlightSegment"].Rows[j]["ArrivalAirportCode"].ToString();
                        objFlightBal.ArrivalAirportName = dsBookingResponse.Tables["FlightSegment"].Rows[j]["ArrivalAirportName"].ToString();
                        objFlightBal.ArrivalDateTime = dsBookingResponse.Tables["FlightSegment"].Rows[j]["ArrivalDateTime"].ToString();
                        objFlightBal.DepartureAirportCode = dsBookingResponse.Tables["FlightSegment"].Rows[j]["DepartureAirportCode"].ToString();
                        objFlightBal.DepartureAirportName = dsBookingResponse.Tables["FlightSegment"].Rows[j]["DepartureAirportName"].ToString();
                        objFlightBal.DepartureDateTime = dsBookingResponse.Tables["FlightSegment"].Rows[j]["DepartureDateTime"].ToString();
                        objFlightBal.FlightNumber = dsBookingResponse.Tables["FlightSegment"].Rows[j]["FlightNumber"].ToString();
                        objFlightBal.MarketingAirlineCode = dsBookingResponse.Tables["FlightSegment"].Rows[j]["MarketingAirlineCode"].ToString();
                        objFlightBal.OperatingAirlineCode = dsBookingResponse.Tables["FlightSegment"].Rows[j]["OperatingAirlineCode"].ToString();
                        objFlightBal.OperatingAirlineName = dsBookingResponse.Tables["FlightSegment"].Rows[j]["OperatingAirlineName"].ToString();
                        objFlightBal.OperatingAirlineFlightNumber = dsBookingResponse.Tables["FlightSegment"].Rows[j]["OperatingAirlineFlightNumber"].ToString();
                        objFlightBal.NumStops = dsBookingResponse.Tables["FlightSegment"].Rows[j]["NumStops"].ToString();
                        objFlightBal.LinkSellAgrmnt = dsBookingResponse.Tables["FlightSegment"].Rows[j]["LinkSellAgrmnt"].ToString();
                        objFlightBal.Conx = dsBookingResponse.Tables["FlightSegment"].Rows[j]["Conx"].ToString();
                        objFlightBal.AirpChg = dsBookingResponse.Tables["FlightSegment"].Rows[j]["AirpChg"].ToString();
                        objFlightBal.InsideAvailOption = dsBookingResponse.Tables["FlightSegment"].Rows[j]["InsideAvailOption"].ToString();
                        objFlightBal.GenTrafRestriction = dsBookingResponse.Tables["FlightSegment"].Rows[j]["GenTrafRestriction"].ToString();
                        objFlightBal.DaysOperates = dsBookingResponse.Tables["FlightSegment"].Rows[j]["DaysOperates"].ToString();
                        objFlightBal.JrnyTm = dsBookingResponse.Tables["FlightSegment"].Rows[j]["JrnyTm"].ToString();
                        objFlightBal.EndDt = dsBookingResponse.Tables["FlightSegment"].Rows[j]["EndDt"].ToString();
                        objFlightBal.StartTerminal = dsBookingResponse.Tables["FlightSegment"].Rows[j]["StartTerminal"].ToString();
                        objFlightBal.EndTerminal = dsBookingResponse.Tables["FlightSegment"].Rows[j]["EndTerminal"].ToString();
                        objFlightBal.FltTm = dsBookingResponse.Tables["FlightSegment"].Rows[j]["FltTm"].ToString();
                        objFlightBal.LSAInd = dsBookingResponse.Tables["FlightSegment"].Rows[j]["LSAInd"].ToString();
                        objFlightBal.Mile = dsBookingResponse.Tables["FlightSegment"].Rows[j]["Mile"].ToString();
                        objFlightBal.Availability = dsBookingResponse.Tables["BookingClass"].Rows[j]["Availability"].ToString();
                        objFlightBal.BIC = dsBookingResponse.Tables["BookingClass"].Rows[j]["BIC"].ToString();
                        objFlightBal.emailAddress = dsBookingResponse.Tables["email"].Rows[0]["emailAddress"].ToString();
                        objFlightBal.telephone = dsBookingResponse.Tables["telephone"].Rows[0]["PhoneNumber"].ToString();
                        objFlightBal.CreatedBy = Convert.ToInt32(Session["UserID"]);
                        string givenName = string.Empty;
                        string surName = string.Empty;
                        string namereference = string.Empty;
                        string psgrType = string.Empty;
                        string customerInfo = string.Empty;
                        string Age = string.Empty;
                        for (int i = 0; i < dsBookingResponse.Tables["CustomerInfo"].Rows.Count; i++)
                        {

                            givenName = dsBookingResponse.Tables["CustomerInfo"].Rows[i]["givenName"].ToString();
                            surName = dsBookingResponse.Tables["CustomerInfo"].Rows[i]["surName"].ToString();
                            namereference = dsBookingResponse.Tables["CustomerInfo"].Rows[i]["nameReference"].ToString();
                            psgrType = dsBookingResponse.Tables["CustomerInfo"].Rows[i]["psgrtype"].ToString();

                            if (dsBookingResponse.Tables["CustomerInfo"].Columns.Contains("age"))
                            {
                                Age = dsBookingResponse.Tables["CustomerInfo"].Rows[i]["age"].ToString();
                                if (customerInfo == string.Empty)
                                {
                                    customerInfo = namereference + "|" + givenName + "|" + surName + "|" + psgrType + "|" + Age;
                                }
                                else
                                {
                                    customerInfo = customerInfo + ";" + namereference + "|" + givenName + "|" + surName + "|" + psgrType + "|" + Age;
                                }
                            }
                            else
                            {
                                Age = "-";
                                if (customerInfo == string.Empty)
                                {
                                    customerInfo = namereference + "|" + givenName + "|" + surName + "|" + psgrType + "|" + Age;
                                }
                                else
                                {
                                    customerInfo = customerInfo + ";" + namereference + "|" + givenName + "|" + surName + "|" + psgrType + "|" + Age;
                                }
                            }

                        }
                        objFlightBal.Customer_Details = customerInfo;

                        objFlightBal.bookingClass = dsBookingResponse.Tables["BookingClassFare"].Rows[0]["bookingClass"].ToString();
                        objFlightBal.ClassType = dsBookingResponse.Tables["BookingClassFare"].Rows[0]["ClassType"].ToString();
                        objFlightBal.farebasisCode = dsBookingResponse.Tables["BookingClassFare"].Rows[0]["farebasisCode"].ToString();
                        objFlightBal.Fare_Rule = dsBookingResponse.Tables["BookingClassFare"].Rows[0]["Rule"].ToString();
                        objFlightBal.PsgrType = dsBookingResponse.Tables["psgr"].Rows[0]["PsgrType"].ToString();
                        objFlightBal.BaseFare = dsBookingResponse.Tables["psgr"].Rows[0]["BaseFare"].ToString();
                        objFlightBal.psgrTax = dsBookingResponse.Tables["psgr"].Rows[0]["Tax"].ToString();
                        objFlightBal.BagInfo = dsBookingResponse.Tables["psgr"].Rows[0]["BagInfo"].ToString();

                        bool res1 = objFlightBal.AddInternationalFlightSegment(objFlightBal);

                        if (res1)
                        {
                            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()), objFlightBal.ReferenceNo.ToString(), Convert.ToDouble(Session["ActualFare_Agent"].ToString()),
                                       Convert.ToDouble(Session["CommisionFare_Agent"].ToString()), Convert.ToInt32(commPer[0]));

                            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;

                            GetIntBookingStatus(objFlightBal.ReferenceNo.ToString());
                            GetDetailsForPrint(objFlightBal.ReferenceNo.ToString());

                        }

                    }

                    lbtnmail.Visible = false;
                    pnlIntPassengerDet.Visible = false;
                    lblMsg.Visible = true;
                    lblMsg.Text = "Ticket has been booked successfully. Reference Number is : " + objFlightBal.ReferenceNo.ToString();
                    lblMsg.ForeColor = System.Drawing.Color.Green;
                    lbtnmail_Click1(sender, e);
                }
            }
        }

        #endregion
    }
    protected void btnRoundTripSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            if (Session["UserID"] == null) { Response.Redirect("~/Default.aspx", false); return; }

            #region Variables
            string FlightSegmentsID = string.Empty;
            string originDestination_Id = string.Empty;
            string fareDetailsId = string.Empty;
            string TotalFare = string.Empty;
            string AirEquipType = string.Empty;
            string ArrivalAirportCode = string.Empty;
            string ArrivalDateTime = string.Empty;
            string DepartureAirportCode = string.Empty;
            string DepartureDateTime = string.Empty;
            string FlightNumber = string.Empty;
            string OperatingAirlineCode = string.Empty;
            string OperatingAirlineFlightNumber = string.Empty;
            string RPH = string.Empty;
            string StopQuantity = string.Empty;
            string airLineName = string.Empty;
            string airportTax = string.Empty;
            string imageFileName = string.Empty;
            string BookingClassAvailability = string.Empty;
            string BookingClassResBookDesigCode = string.Empty;
            string adultFare = string.Empty;
            string bookingclass = string.Empty;
            string childFare = string.Empty;
            string classType = string.Empty;
            string farebasiscode = string.Empty;
            string infantfare = string.Empty;
            string Rule = string.Empty;
            string adultCommission = string.Empty;
            string childCommission = string.Empty;
            string commissionOnTCharge = string.Empty;
            string Discount = string.Empty;
            string airportTaxChild = string.Empty;
            string airportTaxInfant = string.Empty;
            string adultTaxBreakup = string.Empty;
            string childTaxBreakup = string.Empty;
            string infantTaxBreakup = string.Empty;
            string octax = string.Empty;
            string id = string.Empty;
            string key = string.Empty;
            string TCharge = string.Empty;
            string TMarkup = string.Empty;
            string TSdiscount = string.Empty;
            string TPartnerCommission = string.Empty;
            string actualBaseFare = string.Empty;
            string tax = string.Empty;
            string Stax = string.Empty;
            string SCharge = string.Empty;
            string TDiscount = string.Empty;

            string responseDepartId = string.Empty;
            string responseReturnId = string.Empty;
            string OriginDestinationOptionsId = string.Empty;

            string FlightSegmentsIDRet = string.Empty;
            string originDestination_IdRet = string.Empty;
            string fareDetailsIdRet = string.Empty;
            string TotalFareRet = string.Empty;
            string AirEquipTypeRet = string.Empty;
            string ArrivalAirportCodeRet = string.Empty;
            string ArrivalDateTimeRet = string.Empty;
            string DepartureAirportCodeRet = string.Empty;
            string DepartureDateTimeRet = string.Empty;
            string FlightNumberRet = string.Empty;
            string OperatingAirlineCodeRet = string.Empty;
            string OperatingAirlineFlightNumberRet = string.Empty;
            string RPHRet = string.Empty;
            string StopQuantityRet = string.Empty;
            string airLineNameRet = string.Empty;
            string airportTaxRet = string.Empty;
            string imageFileNameRet = string.Empty;
            string BookingClassAvailabilityRet = string.Empty;
            string BookingClassResBookDesigCodeRet = string.Empty;
            string adultFareRet = string.Empty;
            string bookingclassRet = string.Empty;
            string childFareRet = string.Empty;
            string classTypeRet = string.Empty;
            string farebasiscodeRet = string.Empty;
            string infantfareRet = string.Empty;
            string RuleRet = string.Empty;
            string adultCommissionRet = string.Empty;
            string childCommissionRet = string.Empty;
            string commissionOnTChargeRet = string.Empty;
            string DiscountRet = string.Empty;
            string airportTaxChildRet = string.Empty;
            string airportTaxInfantRet = string.Empty;
            string adultTaxBreakupRet = string.Empty;
            string childTaxBreakupRet = string.Empty;
            string infantTaxBreakupRet = string.Empty;
            string octaxRet = string.Empty;
            string idRet = string.Empty;
            string keyRet = string.Empty;
            string TChargeRet = string.Empty;
            string TMarkupRet = string.Empty;
            string TSdiscountRet = string.Empty;
            string TPartnerCommissionRet = string.Empty;
            string actualBaseFareRet = string.Empty;
            string taxRet = string.Empty;
            string StaxRet = string.Empty;
            string SChargeRet = string.Empty;
            string TDiscountRet = string.Empty;

            string responseDepartIdRet = string.Empty;
            string responseReturnIdRet = string.Empty;
            string OriginDestinationOptionsIdRet = string.Empty;

            #endregion

            DataTable dtFlightSegment = dsFilghts.Tables["FlightSegment"];

            if (dtFlightSegment.Rows.Count > 0)
            {
                DataRow[] rowFlightSegment = dtFlightSegment.Select("FlightSegment_Id=" + lblonwardFlightSegmentId.Text);
                AirEquipType = rowFlightSegment[0]["AirEquipType"].ToString();
                ArrivalAirportCode = rowFlightSegment[0]["ArrivalAirportCode"].ToString();
                ArrivalDateTime = rowFlightSegment[0]["ArrivalDateTime"].ToString();
                DepartureAirportCode = rowFlightSegment[0]["DepartureAirportCode"].ToString();
                DepartureDateTime = rowFlightSegment[0]["DepartureDateTime"].ToString();
                FlightNumber = rowFlightSegment[0]["FlightNumber"].ToString();
                OperatingAirlineCode = rowFlightSegment[0]["OperatingAirlineCode"].ToString();
                OperatingAirlineFlightNumber = rowFlightSegment[0]["OperatingAirlineFlightNumber"].ToString();
                RPH = rowFlightSegment[0]["RPH"].ToString();
                StopQuantity = rowFlightSegment[0]["StopQuantity"].ToString();
                airLineName = rowFlightSegment[0]["airLineName"].ToString();
                airportTax = rowFlightSegment[0]["airportTax"].ToString();
                imageFileName = rowFlightSegment[0]["imageFileName"].ToString();
                Discount = rowFlightSegment[0]["Discount"].ToString();
                airportTaxChild = rowFlightSegment[0]["airportTaxChild"].ToString();
                airportTaxInfant = rowFlightSegment[0]["airportTaxInfant"].ToString();
                adultTaxBreakup = rowFlightSegment[0]["adultTaxBreakup"].ToString();
                childTaxBreakup = rowFlightSegment[0]["childTaxBreakup"].ToString();
                infantTaxBreakup = rowFlightSegment[0]["infantTaxBreakup"].ToString();
                octax = rowFlightSegment[0]["octax"].ToString();
                FlightSegmentsID = rowFlightSegment[0]["FlightSegments_Id"].ToString();
            }

            DataTable dtFlightSegments = dsFilghts.Tables["FlightSegments"];

            if (dtFlightSegments.Rows.Count > 0)
            {
                DataRow[] rowFlightSegments = dtFlightSegments.Select("FlightSegments_Id=" + FlightSegmentsID);
                originDestination_Id = rowFlightSegments[0]["originDestinationoption_Id"].ToString();
            }
            DataTable dtoriginDestinationoption = dsFilghts.Tables["originDestinationoption"];

            if (dtoriginDestinationoption.Rows.Count > 0)
            {
                DataRow[] roworiginDestinationoption = dtoriginDestinationoption.Select("originDestinationoption_Id=" + originDestination_Id);
                id = roworiginDestinationoption[0]["id"].ToString();
                key = roworiginDestinationoption[0]["key"].ToString();
            }

            DataTable dtFareDetails = dsFilghts.Tables["FareDetails"];

            if (dtFareDetails.Rows.Count > 0)
            {
                DataRow[] rowFareDetails = dtFareDetails.Select("originDestinationoption_Id=" + originDestination_Id);
                fareDetailsId = rowFareDetails[0]["FareDetails_Id"].ToString();
            }

            DataTable dtChargeableFares = dsFilghts.Tables["ChargeableFares"];
            if (dtChargeableFares.Rows.Count > 0)
            {
                DataRow[] rowChargeableFares = dtChargeableFares.Select("FareDetails_Id=" + fareDetailsId);
                actualBaseFare = rowChargeableFares[0]["ActualBaseFare"].ToString();
                tax = rowChargeableFares[0]["tax"].ToString();
                Stax = rowChargeableFares[0]["Stax"].ToString();
                SCharge = rowChargeableFares[0]["SCharge"].ToString();
                TDiscount = rowChargeableFares[0]["TDiscount"].ToString();
                TPartnerCommission = rowChargeableFares[0]["TPartnerCommission"].ToString();

            }

            DataTable dtNonChargeableFares = dsFilghts.Tables["NonChargeableFares"];
            if (dtNonChargeableFares.Rows.Count > 0)
            {
                DataRow[] rowNonChargeableFares = dtNonChargeableFares.Select("FareDetails_Id=" + fareDetailsId);
                TCharge = rowNonChargeableFares[0]["TCharge"].ToString();
                TSdiscount = rowNonChargeableFares[0]["TSdiscount"].ToString();
                TMarkup = rowNonChargeableFares[0]["TMarkup"].ToString();
            }
            DataTable dtBookingClass = dsFilghts.Tables["BookingClass"];
            if (dtBookingClass.Rows.Count > 0)
            {
                DataRow[] rowBookingClass = dtBookingClass.Select("FlightSegment_Id=" + lblonwardFlightSegmentId.Text);
                BookingClassAvailability = rowBookingClass[0]["Availability"].ToString();
                BookingClassResBookDesigCode = rowBookingClass[0]["ResBookDesigCode"].ToString();

            }

            DataTable dtBookingClassfare = dsFilghts.Tables["BookingClassFare"];
            if (dtBookingClassfare.Rows.Count > 0)
            {
                DataRow[] rowBookingClassFare = dtBookingClassfare.Select("FlightSegment_Id=" + lblonwardFlightSegmentId.Text);
                adultFare = rowBookingClassFare[0]["adultFare"].ToString();
                if (dtBookingClassfare.Columns.Contains("childFare"))
                {
                    childFare = rowBookingClassFare[0]["childFare"].ToString();
                }
                if (dtBookingClassfare.Columns.Contains("infantfare"))
                {
                    infantfare = rowBookingClassFare[0]["infantfare"].ToString();
                }
                bookingclass = rowBookingClassFare[0]["bookingclass"].ToString();
                classType = rowBookingClassFare[0]["classType"].ToString();
                farebasiscode = rowBookingClassFare[0]["farebasiscode"].ToString();
                Rule = rowBookingClassFare[0]["Rule"].ToString().Replace("<", "&lt;").Replace(">", "&gt;");
                adultCommission = rowBookingClassFare[0]["adultCommission"].ToString();
                childCommission = rowBookingClassFare[0]["childCommission"].ToString();
                commissionOnTCharge = rowBookingClassFare[0]["commissionOnTCharge"].ToString();
            }

            #region ReturnOriginDestionOptionDetails
            DataTable dtFlightSegmentRet = dsFilghts.Tables["FlightSegment"];

            if (dtFlightSegmentRet.Rows.Count > 0)
            {
                DataRow[] rowFlightSegmentRet = dtFlightSegmentRet.Select("FlightSegment_Id=" + lblReturnFlightSegment.Text);
                AirEquipTypeRet = rowFlightSegmentRet[0]["AirEquipType"].ToString();
                ArrivalAirportCodeRet = rowFlightSegmentRet[0]["ArrivalAirportCode"].ToString();
                ArrivalDateTimeRet = rowFlightSegmentRet[0]["ArrivalDateTime"].ToString();
                DepartureAirportCodeRet = rowFlightSegmentRet[0]["DepartureAirportCode"].ToString();
                DepartureDateTimeRet = rowFlightSegmentRet[0]["DepartureDateTime"].ToString();
                FlightNumberRet = rowFlightSegmentRet[0]["FlightNumber"].ToString();
                OperatingAirlineCodeRet = rowFlightSegmentRet[0]["OperatingAirlineCode"].ToString();
                OperatingAirlineFlightNumberRet = rowFlightSegmentRet[0]["OperatingAirlineFlightNumber"].ToString();
                RPHRet = rowFlightSegmentRet[0]["RPH"].ToString();
                StopQuantityRet = rowFlightSegmentRet[0]["StopQuantity"].ToString();
                airLineNameRet = rowFlightSegmentRet[0]["airLineName"].ToString();
                airportTaxRet = rowFlightSegmentRet[0]["airportTax"].ToString();
                imageFileNameRet = rowFlightSegmentRet[0]["imageFileName"].ToString();
                DiscountRet = rowFlightSegmentRet[0]["Discount"].ToString();
                airportTaxChildRet = rowFlightSegmentRet[0]["airportTaxChild"].ToString();
                airportTaxInfantRet = rowFlightSegmentRet[0]["airportTaxInfant"].ToString();
                adultTaxBreakupRet = rowFlightSegmentRet[0]["adultTaxBreakup"].ToString();
                childTaxBreakupRet = rowFlightSegmentRet[0]["childTaxBreakup"].ToString();
                infantTaxBreakupRet = rowFlightSegmentRet[0]["infantTaxBreakup"].ToString();

                octaxRet = rowFlightSegmentRet[0]["octax"].ToString();
                FlightSegmentsIDRet = rowFlightSegmentRet[0]["FlightSegments_Id"].ToString();
            }

            DataTable dtFlightSegmentsRet = dsFilghts.Tables["FlightSegments"];

            if (dtFlightSegmentsRet.Rows.Count > 0)
            {
                DataRow[] rowFlightSegmentsRet = dtFlightSegmentsRet.Select("FlightSegments_Id=" + FlightSegmentsIDRet);
                originDestination_IdRet = rowFlightSegmentsRet[0]["originDestinationoption_Id"].ToString();
            }
            DataTable dtoriginDestinationoptionRet = dsFilghts.Tables["originDestinationoption"];

            if (dtoriginDestinationoptionRet.Rows.Count > 0)
            {
                DataRow[] roworiginDestinationoptionRet = dtoriginDestinationoptionRet.Select("originDestinationoption_Id=" + originDestination_IdRet);
                idRet = roworiginDestinationoptionRet[0]["id"].ToString();
                keyRet = roworiginDestinationoptionRet[0]["key"].ToString();
            }

            DataTable dtFareDetailsRet = dsFilghts.Tables["FareDetails"];

            if (dtFareDetailsRet.Rows.Count > 0)
            {
                DataRow[] rowFareDetailsRet = dtFareDetailsRet.Select("originDestinationoption_Id=" + originDestination_IdRet);
                fareDetailsIdRet = rowFareDetailsRet[0]["FareDetails_Id"].ToString();
            }

            DataTable dtChargeableFaresRet = dsFilghts.Tables["ChargeableFares"];
            if (dtChargeableFaresRet.Rows.Count > 0)
            {
                DataRow[] rowChargeableFaresRet = dtChargeableFaresRet.Select("FareDetails_Id=" + fareDetailsIdRet);
                actualBaseFareRet = rowChargeableFaresRet[0]["ActualBaseFare"].ToString();
                taxRet = rowChargeableFaresRet[0]["tax"].ToString();
                StaxRet = rowChargeableFaresRet[0]["Stax"].ToString();
                SChargeRet = rowChargeableFaresRet[0]["SCharge"].ToString();
                TDiscountRet = rowChargeableFaresRet[0]["TDiscount"].ToString();
                TPartnerCommissionRet = rowChargeableFaresRet[0]["TPartnerCommission"].ToString();

            }

            DataTable dtNonChargeableFaresRet = dsFilghts.Tables["NonChargeableFares"];
            if (dtNonChargeableFaresRet.Rows.Count > 0)
            {
                DataRow[] rowNonChargeableFaresRet = dtNonChargeableFaresRet.Select("FareDetails_Id=" + fareDetailsIdRet);
                TChargeRet = rowNonChargeableFaresRet[0]["TCharge"].ToString();
                TSdiscountRet = rowNonChargeableFaresRet[0]["TSdiscount"].ToString();
                TMarkupRet = rowNonChargeableFaresRet[0]["TMarkup"].ToString();
            }
            DataTable dtBookingClassRet = dsFilghts.Tables["BookingClass"];
            if (dtBookingClassRet.Rows.Count > 0)
            {
                DataRow[] rowBookingClassRet = dtBookingClassRet.Select("FlightSegment_Id=" + lblReturnFlightSegment.Text);
                BookingClassAvailabilityRet = rowBookingClassRet[0]["Availability"].ToString();
                BookingClassResBookDesigCodeRet = rowBookingClassRet[0]["ResBookDesigCode"].ToString();

            }

            DataTable dtBookingClassfareRet = dsFilghts.Tables["BookingClassFare"];
            if (dtBookingClassfareRet.Rows.Count > 0)
            {
                DataRow[] rowBookingClassFareRet = dtBookingClassfareRet.Select("FlightSegment_Id=" + lblReturnFlightSegment.Text);
                adultFareRet = rowBookingClassFareRet[0]["adultFare"].ToString();
                if (dtBookingClassfareRet.Columns.Contains("childFare"))
                {
                    childFareRet = rowBookingClassFareRet[0]["childFare"].ToString();
                }
                if (dtBookingClassfareRet.Columns.Contains("infantfare"))
                {
                    infantfareRet = rowBookingClassFareRet[0]["infantfare"].ToString();
                }
                bookingclassRet = rowBookingClassFareRet[0]["bookingclass"].ToString();
                classTypeRet = rowBookingClassFareRet[0]["classType"].ToString();
                farebasiscodeRet = rowBookingClassFareRet[0]["farebasiscode"].ToString();
                RuleRet = rowBookingClassFareRet[0]["Rule"].ToString().Replace("<", "&lt;").Replace(">", "&gt;");
                adultCommissionRet = rowBookingClassFareRet[0]["adultCommission"].ToString();
                childCommissionRet = rowBookingClassFareRet[0]["childCommission"].ToString();
                commissionOnTChargeRet = rowBookingClassFareRet[0]["commissionOnTCharge"].ToString();

            }

            #endregion
            #region Pricing

            #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>" + id + "</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>" + txtPhoneNum.Text + "</telePhone><email>" + txtEmailID.Text + "</email> <creditcardno></creditcardno><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooFWS1.1</Clienttype><AdultPax>" +  Session["adultcnt"].ToString() + "</AdultPax><ChildPax>" +  Session["childCnt"].ToString() + "</ChildPax><InfantPax>" + Session["infantCnt"].ToString() + "</InfantPax></pricingrequest>";

            DataSet dsFlightPricing = objFlights.GetPricingDetails(XMLPricing.Replace("<br>",""));

            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];
                if (dtchangeprice.Rows.Count > 0)
                {
                    DataRow[] rowchangeprices = dtchangeprice.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();
                    TotalFare = (Convert.ToDecimal(actualBaseFare) + Convert.ToDecimal(tax) + Convert.ToDecimal(Stax).ToString()) ;//+ Convert.ToDecimal(SCharge) - Convert.ToDecimal(TDiscount)).ToString();
                }
            }

            #endregion

            #endregion

            string refNo = Common.GetFlightsReferenceNo("LJDF");

            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>" + id + "</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
            Table tbladults = (Table)this.UpdatePanel1.FindControl("tblAdults");
            for (int i = 1; i <= Convert.ToInt32(Session["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 <= Convert.ToInt32(Session["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 <= Convert.ToInt32(Session["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>";
            }

            xmlRequestData = xmlRequestData + "</personName><telePhone><phoneNumber>" + txtMobileNo.Text + "</phoneNumber></telePhone><email><emailAddress>" + txtEmailID.Text + "</emailAddress></email><creditcardno>4111111111111111</creditcardno><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword> <partnerRefId>" + refNo + "</partnerRefId> <Clienttype>ArzooFWS1.1</Clienttype><AdultPax>" + ddlAdult.SelectedItem.Value + "</AdultPax><ChildPax>" + ddlChild.SelectedItem.Value + "</ChildPax><InfantPax>" + ddlInfant.SelectedItem.Value + "</InfantPax></Bookingrequest>";
            DataSet dsBookingResponse = new DataSet();

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

            DataSet dsCommSlab = objBAL.GetCommissionSlab(Session["Role"].ToString(), "DomesticFlights", airLineName.ToString()); // Change it
            string commisionPercentage = string.Empty;
            if (dsCommSlab.Tables[0].Rows.Count > 0)
                commisionPercentage = dsCommSlab.Tables[0].Rows[0]["Commission"].ToString();// Change it
            else
                commisionPercentage = "0";

            string balance = dsBalance.Tables[0].Rows[0]["Balance"].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.ToDouble(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;

            //Return Deduct
            DataSet dsCommSlabRet = objBAL.GetCommissionSlab(Session["Role"].ToString(), "DomesticFlights", airLineNameRet.ToString()); // Change it
            string commisionPercentageRet = string.Empty;
            if (dsCommSlabRet.Tables[0].Rows.Count > 0)
                commisionPercentageRet = dsCommSlabRet.Tables[0].Rows[0]["Commission"].ToString();// Change it
            else
                commisionPercentageRet = "0";

            string actualFareRet = lblTotalOnwardReturn.Text;
            string deductAmountRet = Convert.ToString(Convert.ToDouble(actualFareRet.ToString()) -
                ((Convert.ToDouble(actualFareRet.ToString()) * Convert.ToDouble(commisionPercentageRet)) / 100));
            string commisionFareRet = Convert.ToString(Convert.ToDouble(actualFareRet.ToString()) - Convert.ToDouble(deductAmountRet));

            Session["ActualFare_AgentRet"] = actualFareRet;
            Session["CommisionFare_AgentRet"] = commisionFareRet;
            Session["CommisionPercentage_AgentRet"] = commisionPercentageRet;
            Session["DeductAmount_AgentRet"] = deductAmountRet;

            //End Of ReturnDeduct

            if (Convert.ToDouble(balance) >= (Convert.ToDouble(deductAmount) + Convert.ToDouble(deductAmountRet)))
            {

                dsBookingResponse = objFlights.GetBookingDetails(xmlRequestData.Replace("<br>",""));
            }
            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();

                string[] commPer = Session["CommisionPercentage_Agent"].ToString().Split('.');
                string[] commPerRet = Session["CommisionPercentage_AgentRet"].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.ToInt32(commPer[0]));
                DeductAgentBalance(Convert.ToInt32(Session["AgentId_Agent"].ToString()), Convert.ToDouble(Session["DeductAmount_AgentRet"].ToString()),
                                    Convert.ToInt32(Session["UserID"].ToString()), refNo, Convert.ToDouble(Session["ActualFare_AgentRet"].ToString()),
                                    Convert.ToDouble(Session["CommisionFare_AgentRet"].ToString()), Convert.ToInt32(commPerRet[0]));

                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
                FlightBAL objFlightBal = new FlightBAL();

                objFlightBal.ReferenceNo = refNo;
                objFlightBal.TransId = transId;
                objFlightBal.Status = dsBookingResponse.Tables["Bookingresponse"].Rows[0]["status"].ToString();
                objFlightBal.AdultPax = Convert.ToInt32(dsBookingResponse.Tables["Bookingresponse"].Rows[0]["AdultPax"].ToString());
                objFlightBal.InfantPax = Convert.ToInt32(dsBookingResponse.Tables["Bookingresponse"].Rows[0]["InfantPax"].ToString());
                objFlightBal.ChildPax = Convert.ToInt32(dsBookingResponse.Tables["Bookingresponse"].Rows[0]["ChildPax"].ToString());
                objFlightBal.Origin_Destination_Id = dsBookingResponse.Tables["originDestinationOption"].Rows[0]["id"].ToString();
                objFlightBal.Origin_Destination_Key = dsBookingResponse.Tables["originDestinationOption"].Rows[0]["key"].ToString();
                objFlightBal.ActualBasefare = Convert.ToDecimal(dsBookingResponse.Tables["ChargeableFares"].Rows[0]["ActualBasefare"].ToString());
                objFlightBal.Tax = Convert.ToDecimal(dsBookingResponse.Tables["ChargeableFares"].Rows[0]["Tax"].ToString());
                objFlightBal.STax = Convert.ToDecimal(dsBookingResponse.Tables["ChargeableFares"].Rows[0]["STax"].ToString());
                objFlightBal.Scharge = Convert.ToDecimal(dsBookingResponse.Tables["ChargeableFares"].Rows[0]["Scharge"].ToString());
                objFlightBal.TDiscount = Convert.ToDecimal(dsBookingResponse.Tables["ChargeableFares"].Rows[0]["TDiscount"].ToString());
                objFlightBal.TPartnerCommission = Convert.ToDecimal(dsBookingResponse.Tables["ChargeableFares"].Rows[0]["TPartnerCommission"].ToString());
                objFlightBal.TCharge = Convert.ToDecimal(dsBookingResponse.Tables["NonChargeableFares"].Rows[0]["TCharge"].ToString());
                objFlightBal.TMarkUp = Convert.ToDecimal(dsBookingResponse.Tables["NonChargeableFares"].Rows[0]["TMarkUp"].ToString());
                objFlightBal.TSDiscount = Convert.ToDecimal(dsBookingResponse.Tables["NonChargeableFares"].Rows[0]["TSDiscount"].ToString());
                //added
                objFlightBal.ActualBasefareRet = Convert.ToDecimal(actualBaseFareRet);
                objFlightBal.TaxRet = Convert.ToDecimal(taxRet);
                objFlightBal.STaxRet = Convert.ToDecimal(StaxRet);
                objFlightBal.SchargeRet = Convert.ToDecimal(SChargeRet);
                objFlightBal.TDiscountRet = Convert.ToDecimal(TDiscountRet);
                objFlightBal.TPartnerCommissionRet = Convert.ToDecimal(TPartnerCommissionRet);
                objFlightBal.TChargeRet = Convert.ToDecimal(TChargeRet);
                objFlightBal.TMarkUpRet = Convert.ToDecimal(TMarkupRet);
                objFlightBal.TSDiscountRet = Convert.ToDecimal(TSdiscountRet);
                string givenName = string.Empty;
                string surName = string.Empty;
                string namereference = string.Empty;
                string psgrType = string.Empty;
                string Age = string.Empty;
                string customerInfo = string.Empty;

                for (int i = 0; i < dsBookingResponse.Tables["CustomerInfo"].Rows.Count; i++)
                {

                    givenName = dsBookingResponse.Tables["CustomerInfo"].Rows[i]["givenName"].ToString();
                    surName = dsBookingResponse.Tables["CustomerInfo"].Rows[i]["surName"].ToString();
                    namereference = dsBookingResponse.Tables["CustomerInfo"].Rows[i]["nameReference"].ToString();
                    //  psgrType = "adt"; //dsBookingResponse.Tables["CustomerInfo"].Rows[i]["psgrtype"].ToString();

                    string[] str = namereference.ToString().Split(',');
                    if (str[0].ToString() == "C")
                    {
                        psgrType = "Child";
                        Age = dsBookingResponse.Tables["CustomerInfo"].Rows[i]["age"].ToString();
                    }
                    else
                        if (str[0].ToString() == "I")
                        {
                            psgrType = "Infant";
                            Age = dsBookingResponse.Tables["CustomerInfo"].Rows[i]["age"].ToString();
                        }
                        else
                        {
                            psgrType = "Adult";
                        }

                    //   psgrType = "";// dsBookingResponse.Tables["CustomerInfo"].Rows[i]["psgrtype"].ToString();

                    if (psgrType.ToString() != "Adult")
                    {
                        if (psgrType.ToString() == "Child")
                        {

                            if (customerInfo == string.Empty)
                            {
                                customerInfo = str[1].ToString() + "|" + givenName + "|" + surName + "|" + psgrType + "|" + Age;
                            }
                            else
                            {
                                customerInfo = customerInfo + ";" + str[1].ToString() + "|" + givenName + "|" + surName + "|" + psgrType + "|" + Age;
                            }
                        }
                        else
                        {
                            if (customerInfo == string.Empty)
                            {
                                customerInfo = str[1].ToString() + "|" + givenName + "|" + surName + "|" + psgrType + "|" + Age + "M";
                            }
                            else
                            {
                                customerInfo = customerInfo + ";" + str[1].ToString() + "|" + givenName + "|" + surName + "|" + psgrType + "|" + Age + "M";
                            }
                        }
                    }
                    else
                    {
                        if (customerInfo == string.Empty)
                        {
                            customerInfo = str[0].ToString() + "|" + givenName + "|" + surName + "|" + psgrType + "|" + "-";
                        }
                        else
                        {
                            customerInfo = customerInfo + ";" + str[0].ToString() + "|" + givenName + "|" + surName + "|" + psgrType + "|" + "-";
                        }
                    }
                    //if (customerInfo == string.Empty)
                    //{
                    //    customerInfo = namereference + "|" + givenName + "|" + surName + "|" + psgrType;
                    //}
                    //else
                    //{
                    //    customerInfo = customerInfo + ";" + namereference + "|" + givenName + "|" + surName + "|" + psgrType;
                    //}

                }
                objFlightBal.Customer_Details = customerInfo;
                objFlightBal.telephone = dsBookingResponse.Tables["telePhone"].Rows[0]["PhoneNumber"].ToString();
                objFlightBal.emailAddress = lblEmailAddress.Text = dsBookingResponse.Tables["email"].Rows[0]["emailAddress"].ToString();
                objFlightBal.TripMode = "Round";
                objFlightBal.idRet = idRet;
                objFlightBal.keyRet = keyRet;

                DataTable dtflightBookingId = objFlightBal.AddDomesticFlightBooking(objFlightBal);
                string flightBookingId = dtflightBookingId.Rows[0]["FlightBookingID"].ToString();

                objFlightBal.FlightBookingID = flightBookingId.ToString();
                if (dsBookingResponse.Tables["FlightSegment"].Rows.Count > 0)
                {
                    for (int j = 0; j < dsBookingResponse.Tables["FlightSegment"].Rows.Count; j++)
                    {
                        objFlightBal.AirEquipType = dsBookingResponse.Tables["FlightSegment"].Rows[j]["AirEquipType"].ToString();
                        objFlightBal.ArrivalAirportCode = dsBookingResponse.Tables["FlightSegment"].Rows[j]["ArrivalAirportCode"].ToString();
                        objFlightBal.ArrivalDateTime = dsBookingResponse.Tables["FlightSegment"].Rows[j]["ArrivalDateTime"].ToString();
                        objFlightBal.DepartureAirportCode = dsBookingResponse.Tables["FlightSegment"].Rows[j]["DepartureAirportCode"].ToString();
                        objFlightBal.DepartureDateTime = dsBookingResponse.Tables["FlightSegment"].Rows[j]["DepartureDateTime"].ToString();
                        objFlightBal.FlightNumber = dsBookingResponse.Tables["FlightSegment"].Rows[j]["FlightNumber"].ToString();
                        objFlightBal.OperatingAirlineCode = dsBookingResponse.Tables["FlightSegment"].Rows[j]["OperatingAirlineCode"].ToString();
                        objFlightBal.OperatingAirlineFlightNumber = dsBookingResponse.Tables["FlightSegment"].Rows[j]["OperatingAirlineFlightNumber"].ToString();
                        objFlightBal.RPH = dsBookingResponse.Tables["FlightSegment"].Rows[j]["RPH"].ToString();
                        objFlightBal.StopQuantity = dsBookingResponse.Tables["FlightSegment"].Rows[j]["StopQuantity"].ToString();
                        objFlightBal.airlineName = dsBookingResponse.Tables["FlightSegment"].Rows[j]["airlineName"].ToString();
                        objFlightBal.airportTax = dsBookingResponse.Tables["FlightSegment"].Rows[j]["airportTax"].ToString();
                        objFlightBal.imageFileName = dsBookingResponse.Tables["FlightSegment"].Rows[j]["imageFileName"].ToString();
                        objFlightBal.Discount = dsBookingResponse.Tables["FlightSegment"].Rows[j]["Discount"].ToString();
                        objFlightBal.airportTaxChild = dsBookingResponse.Tables["FlightSegment"].Rows[j]["airportTaxChild"].ToString();
                        objFlightBal.airportTaxInfant = dsBookingResponse.Tables["FlightSegment"].Rows[j]["airportTaxInfant"].ToString();
                        objFlightBal.adultTaxBreakUp = dsBookingResponse.Tables["FlightSegment"].Rows[j]["adultTaxBreakUp"].ToString();
                        objFlightBal.ChildTaxBreakUp = dsBookingResponse.Tables["FlightSegment"].Rows[j]["ChildTaxBreakUp"].ToString();
                        objFlightBal.InfantTaxBreakUp = dsBookingResponse.Tables["FlightSegment"].Rows[j]["InfantTaxBreakUp"].ToString();
                        objFlightBal.ocTax = dsBookingResponse.Tables["FlightSegment"].Rows[j]["ocTax"].ToString();
                        objFlightBal.Availability = dsBookingResponse.Tables["BookingClass"].Rows[j]["Availability"].ToString();
                        objFlightBal.ResBookingCode = dsBookingResponse.Tables["BookingClass"].Rows[j]["ResBookDesigCode"].ToString();
                        objFlightBal.adultFare = dsBookingResponse.Tables["BookingClassFare"].Rows[j]["adultFare"].ToString();
                        objFlightBal.bookingClass = dsBookingResponse.Tables["BookingClassFare"].Rows[j]["bookingClass"].ToString();
                        objFlightBal.ChildFare = dsBookingResponse.Tables["BookingClassFare"].Rows[j]["ChildFare"].ToString();
                        objFlightBal.ClassType = dsBookingResponse.Tables["BookingClassFare"].Rows[j]["ClassType"].ToString();
                        objFlightBal.farebasisCode = dsBookingResponse.Tables["BookingClassFare"].Rows[j]["farebasisCode"].ToString();
                        objFlightBal.infantFare = dsBookingResponse.Tables["BookingClassFare"].Rows[j]["infantFare"].ToString();
                        objFlightBal.Fare_Rule = dsBookingResponse.Tables["BookingClassFare"].Rows[j]["Rule"].ToString();
                        objFlightBal.adultCommission = dsBookingResponse.Tables["BookingClassFare"].Rows[j]["adultCommission"].ToString();
                        objFlightBal.childCommission = dsBookingResponse.Tables["BookingClassFare"].Rows[j]["childCommission"].ToString();
                        objFlightBal.CommissionOnTCharge = dsBookingResponse.Tables["BookingClassFare"].Rows[j]["CommissionOnTCharge"].ToString();

                        objFlightBal.CreatedBy = Convert.ToInt32(Session["UserID"]);

                        bool res = objFlightBal.AddDomesticFlightBookingsegments(objFlightBal);
                        if (res)
                        {
                            GetBookingStatus(refNo);
                            GetDetailsForPrint(objFlightBal.ReferenceNo.ToString());

                        }

                #endregion

                        else
                        {
                            error = dsBookingResponse.Tables[0].Rows[0]["error"].ToString();
                            lblStatus.Text = error;
                            lblStatus.ForeColor = System.Drawing.Color.Red;

                        }
                    }
                    lbtnmail.Visible = false;
                    lbtnmail_Click1(sender, e);
                    pnlPassengerDet.Visible = false;
                    lblStatus.Visible = true;
                    lblStatus.Text = "Ticket has been booked successfully. Reference Number is : " + objFlightBal.ReferenceNo.ToString();
                    lblStatus.ForeColor = System.Drawing.Color.Green;
                }
            }
            else
            {
                lblStatus.Text = dsBookingResponse.Tables[0].Rows[0]["Error"].ToString();

                if (lblStatus.Text == "Insufficient Funds")
                {
                    lblStatus.Text = "Please Contact administrator";

                }
                lblStatus.Visible = true;
            }

        }
        catch (Exception ex)
        {

        }
    }
    protected void GetDetailsForPrint(string RefNo)
    {
        try
        {
            FlightBAL objFlightsBAL = new FlightBAL();
            DataSet dsFlights = new DataSet();
            dsFlights = objFlightsBAL.GetInternationalFlightDetails(RefNo);
            if (dsFlights.Tables[0].Rows.Count == 1)
            {
                if (dsFlights.Tables[0].Rows.Count > 0)
                {
                    string customerDetails = dsFlights.Tables[0].Rows[0]["CustomerDetails"].ToString();
                    string[] strArryCustDet = customerDetails.Split('|');
                    lblName.Text = strArryCustDet[0] + strArryCustDet[1] + "  " + strArryCustDet[2];
                    lblTel.Text = dsFlights.Tables[0].Rows[0]["Telephone"].ToString();
                    lblEmailAddress.Text = dsFlights.Tables[0].Rows[0]["EmailAddress"].ToString();
                    lblPNR.Text = dsFlights.Tables[0].Rows[0]["ReferenceNo"].ToString();
                    lblAirlinePNR.Text = dsFlights.Tables[0].Rows[0]["AirlinePNR"].ToString();
                    lblOrigin.Text = dsFlights.Tables[0].Rows[0]["DepartureAirportCode"].ToString();
                    lblDestination.Text = dsFlights.Tables[0].Rows[0]["ArrivalAirportCode"].ToString();
                    lblAirlineName.Text = dsFlights.Tables[0].Rows[0]["OperatingAirlineName"].ToString();
                    //img.ImageUrl = dsFlights.Tables[0].Rows[0]["imageFileName"].ToString();
                    lblFlightNumber.Text = dsFlights.Tables[0].Rows[0]["FlightNumber"].ToString();
                    string DepartureDatetime = dsFlights.Tables[0].Rows[0]["DepartureDateTime"].ToString();
                    string[] strArryDeptDatetime = DepartureDatetime.Split('T');
                    DateTime dt = Convert.ToDateTime(strArryDeptDatetime[0].ToString());
                    lblDepartureDate.Text = dt.ToLongDateString();
                    lblDepartureTime.Text = strArryDeptDatetime[1].ToString();
                    string ArrivalDatetime = dsFlights.Tables[0].Rows[0]["ArrivalDateTime"].ToString();
                    string[] strArrivalDatetime = ArrivalDatetime.Split('T');
                    DateTime dt1 = Convert.ToDateTime(strArrivalDatetime[0].ToString());
                    lblArrivalDate.Text = dt1.ToLongDateString();
                    lblArrivalTime.Text = strArrivalDatetime[1].ToString();
                    //  lblPNRNo.Text = dsFlights.Tables[0].Rows[0]["ReferenceNo"].ToString();
                    lblPsngrMobileNo.Text = dsFlights.Tables[0].Rows[0]["Telephone"].ToString();

                    string[] strCusDetArr = customerDetails.Split(';');
                    string indCustDet = string.Empty;
                    DataTable dtPsgrDet = new DataTable();
                    dtPsgrDet.Columns.Add("Name", typeof(string));
                    dtPsgrDet.Columns.Add("Type", typeof(string));
                    dtPsgrDet.Columns.Add("Age", typeof(string));

                    for (int i = 0; i < strCusDetArr.Length; i++)
                    {
                        indCustDet = strCusDetArr[i];
                        string[] strArryCustDet1 = indCustDet.Split('|');
                        DataRow dr = dtPsgrDet.NewRow();
                        dr["Name"] = strArryCustDet1[0] + strArryCustDet1[1] + "  " + strArryCustDet1[2];
                        if (strArryCustDet1[3].ToString() == "adt")
                        {
                            dr["Type"] = "Adult";
                            Session["strtype"] = "Adult";
                        }
                        else
                            if (strArryCustDet1[3].ToString() == "chd")
                            {
                                dr["Type"] = "Child";
                                Session["strtype"] = "," + "Child";
                            }
                            else
                                if (strArryCustDet1[3].ToString() == "inf")
                                {
                                    dr["Type"] = "Infant";
                                    Session["strtype"] = "," + "Infant";
                                }
                        if (strArryCustDet1[3].ToString() != "inf")
                        {
                            dr["Age"] = strArryCustDet1[4];
                        }
                        else
                        {
                            dr["Age"] = strArryCustDet1[4] + "M";
                        }
                        dtPsgrDet.Rows.Add(dr);
                    }

                    gdvPassengerDetails.DataSource = dtPsgrDet;
                    gdvPassengerDetails.DataBind();
                    lblPassengerType.Text = Session["strtype"].ToString();
                    lblPassengerCnt.Text = strCusDetArr.Length.ToString();
                    lblBasicFare.Text = dsFlights.Tables[0].Rows[0]["ActualBasefare"].ToString();
                    lblTaxes.Text = dsFlights.Tables[0].Rows[0]["Tax"].ToString();
                    Label4.Text = (Convert.ToDouble(dsFlights.Tables[0].Rows[0]["STax"]).ToString()); //+ Convert.ToDouble(dsFlights.Tables[0].Rows[0]["Scharge"])).ToString();
                    Double total = Convert.ToDouble(lblBasicFare.Text) + Convert.ToDouble(lblTaxes.Text) + Convert.ToDouble(Label4.Text); //- Convert.ToDouble(dsFlights.Tables[0].Rows[0]["TDiscount"].ToString());
                    lblTotal.Text = total.ToString();
                    pnlViewticket.Visible = true;

                }
            }
            else if (dsFlights.Tables[0].Rows.Count == 2)
            {
                //return

                if (dsFlights.Tables[0].Rows.Count > 0)
                {
                    lblAirlineNamereturn.Text = dsFlights.Tables[0].Rows[1]["OperatingAirlineName"].ToString();
                    //img.ImageUrl = dsFlights.Tables[0].Rows[0]["imageFileName"].ToString();
                    lblFlightNumberreturn.Text = dsFlights.Tables[0].Rows[1]["FlightNumber"].ToString();

                    lblOriginRet.Text = dsFlights.Tables[0].Rows[1]["DepartureAirportCode"].ToString();
                    lblDestinationRet.Text = dsFlights.Tables[0].Rows[1]["ArrivalAirportCode"].ToString();

                    string DepartureDatetimeRet = dsFlights.Tables[0].Rows[1]["DepartureDateTime"].ToString();
                    string[] strArryDeptDatetimeRet = DepartureDatetimeRet.Split('T');
                    DateTime dt1 = Convert.ToDateTime(strArryDeptDatetimeRet[0].ToString());
                    lblDepartureDatereturn.Text = dt1.ToLongDateString();
                    lblDepartureTimereturn.Text = strArryDeptDatetimeRet[1].ToString();
                    string ArrivalDatetimeRet = dsFlights.Tables[0].Rows[1]["ArrivalDateTime"].ToString();
                    string[] strArrivalDatetimeRet = ArrivalDatetimeRet.Split('T');
                    DateTime dt = Convert.ToDateTime(strArrivalDatetimeRet[0].ToString());
                    lblArrivalDatereturn.Text = dt.ToLongDateString();
                    lblArrivalTimereturn.Text = strArrivalDatetimeRet[1].ToString();
                    // lblPNRNoreturn.Text = dsFlights.Tables[0].Rows[1]["ReferenceNo"].ToString();

                    //string Afareret = dsFlights.Tables[0].Rows[0]["ActualBasefareRet"].ToString();
                    //string Tret = dsFlights.Tables[0].Rows[0]["TaxRet"].ToString();
                    //string Sts = (Convert.ToDouble(dsFlights.Tables[0].Rows[0]["STaxRet"]) + Convert.ToDouble(dsFlights.Tables[0].Rows[0]["SchargeRet"])).ToString();
                    //string totret = (Convert.ToDouble(Afareret) + Convert.ToDouble(Tret) + Convert.ToDouble(Sts) - Convert.ToDouble(dsFlights.Tables[0].Rows[0]["TDiscountRet"].ToString())).ToString();
                    //lblBasicFare.Text = (Convert.ToDecimal(lblBasicFare.Text) + Convert.ToDecimal(Afareret)).ToString();
                    //lblTaxes.Text = (Convert.ToDecimal(lblTaxes.Text) + Convert.ToDecimal(Tret)).ToString();
                    //lblServiceTax.Text = (Convert.ToDecimal(lblServiceTax.Text) + Convert.ToDecimal(Sts)).ToString();
                    //lblTotal.Text = (Convert.ToDecimal(lblTotal.Text) + Convert.ToDecimal(totret)).ToString("####0.00");

                }

            }

            //return en

            pnlViewticket.Visible = true;

        }

        catch (Exception ex)
        {

            throw;
        }
    }
        public bool UpdateInternationalFlightCancelStatus(FlightBAL objFlightBAL)
        {
            try
            {
                ObjDAL = new clsDataLayer();
                SqlParameter[] p = new SqlParameter[3];
                p[0] = new SqlParameter("@tableName", "UpdateCancelStatus");
                p[1] = new SqlParameter("@TransId", objFlightBAL.TransId);
                p[2] = new SqlParameter("@Status", objFlightBAL.Status);

                return ObjDAL.fnExecuteStoredProcedure("sp_InternationalFlightBooking", p);
            }
            catch (Exception ex)
            {
                throw new ArgumentException(ex.Message);
            }
        }
    private DataSet GetIntBookingRequest()
    {
        DataSet ds = new DataSet();

        #region Variables

        string str = string.Empty;
        string FlightSegmentsID = string.Empty;
        string DepartureAirportCode = string.Empty;
        string ArrivalDateTime = string.Empty;
        string DepartureAirportName = string.Empty;
        string DepartureDateTime = string.Empty;
        string FlightNumber = string.Empty;
        string MarketingAirlineCode = string.Empty;
        string OperatingAirlineCode = string.Empty;
        string OperatingAirlineName = string.Empty;
        string OperatingAirlineFlightNumber = string.Empty;
        string NumStops = string.Empty;
        string LinkSellAgrmnt = string.Empty;
        string Conx = string.Empty;
        string AirpChg = string.Empty;
        string InsideAvailOption = string.Empty;
        string GenTrafRestriction = string.Empty;
        string DaysOperates = string.Empty;
        string JrnyTm = string.Empty;
        string EndDt = string.Empty;
        string StartTerminal = string.Empty;
        string EndTerminal = string.Empty;
        string FltTm = string.Empty;
        string LSAInd = string.Empty;
        string Mile = string.Empty;
        string Availability = string.Empty;
        string BIC = string.Empty;
        string bookingclass = string.Empty;
        string classType = string.Empty;
        string farebasiscode = string.Empty;
        string Rule = string.Empty;
        string PsgrType = string.Empty;
        string BaseFare = string.Empty;
        string Tax = string.Empty;
        string BagInfo = string.Empty;
        string AirEquipType = string.Empty;
        string ArrivalAirportCode = string.Empty;
        string ArrivalAirportName = string.Empty;
        string return1 = string.Empty;
        string id = string.Empty;
        string key = string.Empty;
        string ActualBaseFare = string.Empty;
        string FareTax = string.Empty;
        string STax = string.Empty;
        string TCharge = string.Empty;
        string SCharge = string.Empty;
        string TDiscount = string.Empty;
        string TMarkup = string.Empty;
        string TPartnerCommission = string.Empty;
        string TSdiscount = string.Empty;
        string FarePsgrType = string.Empty;
        string FareBaseFare = string.Empty;
        string FareTax1 = string.Empty;
        string Country = string.Empty;
        string Amt = string.Empty;
        string ocTax = string.Empty;
        string onwardId = string.Empty;
        string OriginDestinationOption_Id = string.Empty;
        string FareDetails_id = string.Empty;
        string FareBreakUp_Id = string.Empty;
        string FareAry_id = string.Empty;
        string FareId = string.Empty;
        string bookingclassFareId = string.Empty;
        string psgrBreakUp_Id = string.Empty;
        string psgrAy_id = string.Empty;
        string country = string.Empty;
        string taxAmt = string.Empty;
        string taxData = string.Empty;
        string taxDataAry_id = string.Empty;

        string faretype = string.Empty;

        string CFareId = string.Empty;
        string CPsgrType = string.Empty;
        string CBaseFare = string.Empty;
        string CFareTax = string.Empty;
        string IFareId = string.Empty;
        string IPsgrType = string.Empty;
        string IBaseFare = string.Empty;
        string IFareTax = string.Empty;

        string CFarePsgrType = string.Empty;
        string CFareBaseFare = string.Empty;
        string CFareTax1 = string.Empty;
        string CBagInfo = string.Empty;
        string IFarePsgrType = string.Empty;
        string IFareBaseFare = string.Empty;
        string IFareTax1 = string.Empty;
        string IBagInfo = string.Empty;
        string taxdatapsgr = string.Empty;

        #endregion
        try
        {
            dsIntFlights = (DataSet)Session["dsIntFlights"];
            string result = null;
            DataTable dtFlightSegment = dsIntFlights.Tables[12];
            if (dtFlightSegment.Rows.Count > 0)
            {
                DataRow[] rowFilghtSegment = dtFlightSegment.Select("FlightSegment_ID=" + Convert.ToInt32(lblIntFlightSegmentId.Text));
                FlightSegmentsID = rowFilghtSegment[0]["FlightSegments_Id"].ToString();

            }
            DataTable dtFlightSegments = dsIntFlights.Tables[11];
            if (dtFlightSegments.Rows.Count > 0)
            {
                DataRow[] rowFilghtSegments = dtFlightSegments.Select("FlightSegments_ID=" + FlightSegmentsID);
                onwardId = rowFilghtSegments[0]["Onward_Id"].ToString();
            }
            DataTable dtOnward = dsIntFlights.Tables[10];
            if (dtOnward.Rows.Count > 0)
            {
                DataRow[] rowOnward = dtOnward.Select("Onward_Id=" + onwardId);
                OriginDestinationOption_Id = rowOnward[0]["OriginDestinationOption_Id"].ToString();
            }
            DataTable dtOriginDestinationOption = dsIntFlights.Tables[3];
            if (dtOriginDestinationOption.Rows.Count > 0)
            {
                DataRow[] rowOriginDestinationOption = dtOriginDestinationOption.Select("OriginDestinationOption_Id=" + OriginDestinationOption_Id);
                return1 = rowOriginDestinationOption[0]["Return"].ToString();
                id = rowOriginDestinationOption[0]["id"].ToString();
                key = rowOriginDestinationOption[0]["key"].ToString();
            }
            DataTable dtFareDetails = dsIntFlights.Tables[4];
            if (dtFareDetails.Rows.Count > 0)
            {
                DataRow[] rowFareDetails = dtFareDetails.Select("OriginDestinationOption_Id=" + OriginDestinationOption_Id);
                ActualBaseFare = rowFareDetails[0]["ActualBaseFare"].ToString();
                Tax = rowFareDetails[0]["Tax"].ToString();
                STax = rowFareDetails[0]["STax"].ToString();
                TCharge = rowFareDetails[0]["TCharge"].ToString();
                SCharge = rowFareDetails[0]["SCharge"].ToString();
                TDiscount = rowFareDetails[0]["TDiscount"].ToString();
                TMarkup = rowFareDetails[0]["TMarkup"].ToString();
                TPartnerCommission = rowFareDetails[0]["TPartnerCommission"].ToString();
                TSdiscount = rowFareDetails[0]["TSdiscount"].ToString();
                ocTax = rowFareDetails[0]["ocTax"].ToString();
                FareDetails_id = rowFareDetails[0]["FareDetails_id"].ToString();
            }
            DataTable dtFareBreakUp = dsIntFlights.Tables[5];
            if (dtFareBreakUp.Rows.Count > 0)
            {
                DataRow[] rowFareBreakUp = dtFareBreakUp.Select("FareDetails_Id=" + FareDetails_id);
                FareBreakUp_Id = rowFareBreakUp[0]["FareBreakUp_Id"].ToString();

            }
            DataTable dtFareAry = dsIntFlights.Tables[6];
            if (dtFareAry.Rows.Count > 0)
            {
                DataRow[] rowFareAry = dtFareAry.Select("FareBreakUp_Id=" + FareBreakUp_Id);
                FareAry_id = rowFareAry[0]["FareAry_id"].ToString();
            }
            DataTable dtFare = dsIntFlights.Tables[7];
            if (dtFare.Rows.Count > 0)
            {
                DataRow[] rowFare = dtFare.Select("FareAry_id=" + FareAry_id);

                PsgrType = rowFare[0]["PsgrType"].ToString();
                BaseFare = rowFare[0]["BaseFare"].ToString();
                FareTax = rowFare[0]["Tax"].ToString();
                FareId = rowFare[0]["Fare_Id"].ToString();
                Session["FareId"] = FareId.ToString();

                foreach (DataRow dr in rowFare)
                {
                    if (faretype == "")
                    {
                        faretype = dr["PsgrType"].ToString() + "," + dr["BaseFare"].ToString() + "," + dr["Tax"].ToString();
                    }
                    else
                    {

                        faretype = faretype + ";" + dr["PsgrType"].ToString() + "," + dr["BaseFare"].ToString() + "," + dr["Tax"].ToString() + ";";
                    }
                }

            }

            DataTable dtBookingClass = dsIntFlights.Tables[13];
            if (dtBookingClass.Rows.Count > 0)
            {
                DataRow[] rowBookingClass = dtBookingClass.Select("FlightSegment_Id=" + lblIntFlightSegmentId.Text);
                Availability = rowBookingClass[0]["Availability"].ToString();
                BIC = rowBookingClass[0]["BIC"].ToString();
            }
            DataTable dtBookingClassFare = dsIntFlights.Tables[14];
            if (dtBookingClassFare.Rows.Count > 0)
            {
                DataRow[] rowBookingClassFare = dtBookingClassFare.Select("FlightSegment_Id=" + lblIntFlightSegmentId.Text);
                bookingclass = rowBookingClassFare[0]["bookingclass"].ToString();
                classType = rowBookingClassFare[0]["classType"].ToString();
                farebasiscode = rowBookingClassFare[0]["farebasiscode"].ToString();
                Rule = rowBookingClassFare[0]["Rule"].ToString();
                if (dtBookingClassFare.Columns.Contains("bookingclassFare_Id"))
                {
                    bookingclassFareId = rowBookingClassFare[0]["bookingclassFare_Id"].ToString();
                }

            }
            //Non Mandatory fields
            if (dtBookingClassFare.Columns.Contains("bookingclassFare_Id"))
            {
                DataTable dtPsgrBreakUp = dsIntFlights.Tables[15];
                if (dtPsgrBreakUp.Rows.Count > 0)
                {
                    DataRow[] rowPsgrBreakUp = dtPsgrBreakUp.Select("bookingclassFare_Id=" + bookingclassFareId);
                    psgrBreakUp_Id = rowPsgrBreakUp[0]["psgrBreakUp_Id"].ToString();

                }
                DataTable dtPsgrAry = dsIntFlights.Tables[16];
                if (dtPsgrAry.Rows.Count > 0)
                {
                    DataRow[] rowPsgrAry = dtPsgrAry.Select("psgrBreakUp_Id=" + psgrBreakUp_Id);
                    psgrAy_id = rowPsgrAry[0]["psgrAry_Id"].ToString();

                }
                DataTable dtPsgr = dsIntFlights.Tables[17];
                if (dtPsgr.Rows.Count > 0)
                {
                    DataRow[] rowPsgr = dtPsgr.Select("psgrAry_Id=" + psgrAy_id);
                    FarePsgrType = rowPsgr[0]["psgrType"].ToString();
                    FareBaseFare = rowPsgr[0]["BaseFare"].ToString();
                    FareTax1 = rowPsgr[0]["Tax"].ToString();
                    BagInfo = rowPsgr[0]["BagInfo"].ToString();
                    //child
                    //CFarePsgrType = rowPsgr[1]["psgrType"].ToString();
                    //CFareBaseFare = rowPsgr[1]["BaseFare"].ToString();
                    //CFareTax1 = rowPsgr[1]["Tax"].ToString();
                    //CBagInfo = rowPsgr[1]["BagInfo"].ToString();
                    ////infant
                    //IFarePsgrType = rowPsgr[2]["psgrType"].ToString();
                    //IFareBaseFare = rowPsgr[2]["BaseFare"].ToString();
                    //IFareTax1 = rowPsgr[2]["Tax"].ToString();
                    //IBagInfo = rowPsgr[2]["BagInfo"].ToString();

                }

                if (dtPsgr.Rows.Count > 0)
                {
                    DataRow[] rowPsgr = dtPsgr.Select("psgrAry_Id=" + psgrAy_id);
                    foreach (DataRow rows in rowPsgr)
                    {
                        if (rows.Table.Rows.Count == 0)
                        {
                            taxdatapsgr = "<Psgr><PsgrType>" + rows["psgrType"].ToString() + "</PsgrType><BaseFare>" + rows["BaseFare"].ToString() + "</BaseFare><Tax>" + rows["Tax"].ToString() + "</Tax><BagInfo></BagInfo></Psgr>";
                        }
                        else
                        {
                            taxdatapsgr = taxdatapsgr + "<Psgr><PsgrType>" + rows["psgrType"].ToString() + "</PsgrType><BaseFare>" + rows["BaseFare"].ToString() + "</BaseFare><Tax>" + rows["Tax"].ToString() + "</Tax><BagInfo></BagInfo></Psgr>";
                        }
                    }
                }
            }
            //  <Psgr><PsgrType>" + FarePsgrType + "</PsgrType><BaseFare>" + FareBaseFare + "</BaseFare><Tax>" + FareTax1 + "</Tax><BagInfo></BagInfo></Psgr>
            DataTable dtTaxDataAry = dsIntFlights.Tables[8];
            if (dtTaxDataAry.Rows.Count > 0)
            {
                DataRow[] rowTaxDataAry = dtTaxDataAry.Select("Fare_id=" + FareId);
                taxDataAry_id = rowTaxDataAry[0]["TaxdataAry_Id"].ToString();
            }
            DataTable dtTaxData = dsIntFlights.Tables[9];
            if (dtTaxData.Rows.Count > 0)
            {
                DataRow[] rowTaxData = dtTaxData.Select("TaxdataAry_Id=" + taxDataAry_id);
                for (int j = 0; j < rowTaxData.Length; j++)
                {
                    if (rowTaxData.Length == 0)
                    {
                        taxData = "<TaxData><Country>" + rowTaxData[j]["Country"].ToString() + "</Country><Amt>" + rowTaxData[j]["Amt"].ToString() + "</Amt></TaxData>";

                    }
                    else
                    {
                        taxData = taxData + "<TaxData><Country>" + rowTaxData[j]["Country"].ToString() + "</Country><Amt>" + rowTaxData[j]["Amt"].ToString() + "</Amt></TaxData>";
                        //ravi
                        //  taxData = taxData + "<Fare><PsgrType>" + dtFare.Rows[j]["PsgrType"].ToString() + "</PsgrType><BaseFare>" + dtFare.Rows[j]["BaseFare"].ToString() + "</BaseFare><Tax>" + dtFare.Rows[j]["Tax"].ToString() + "</Tax><TaxDataAry><TaxData><Country>" + rowTaxData[0]["Country"].ToString() + "</Country><Amt>" + rowTaxData[0]["Amt"].ToString() + "</Amt></TaxData><TaxData><Country>" + rowTaxData[1]["Country"].ToString() + "</Country><Amt>" + rowTaxData[1]["Amt"].ToString() + "</Amt></TaxData><TaxData><Country>" + rowTaxData[2]["Country"].ToString() + "</Country><Amt>" + rowTaxData[2]["Amt"].ToString() + "</Amt></TaxData></TaxDataAry></Fare>";

                    }
                }

            }
            if (dtFare.Rows.Count > 0)
            {
                DataRow[] rowFare = dtFare.Select("FareAry_id=" + FareAry_id);
                foreach (DataRow row in rowFare)
                {
                    if (row.Table.Rows.Count == 0)
                    {
                        str = "<Fare><PsgrType>" + row["PsgrType"].ToString() + "</PsgrType><BaseFare>" + row["BaseFare"].ToString() + "</BaseFare><Tax>" + row["Tax"].ToString() + "</Tax><TaxDataAry>" + taxData + "</TaxDataAry></Fare>";
                    }
                    else
                    {
                        str = str + "<Fare><PsgrType>" + row["PsgrType"].ToString() + "</PsgrType><BaseFare>" + row["BaseFare"].ToString() + "</BaseFare><Tax>" + row["Tax"].ToString() + "</Tax><TaxDataAry>" + taxData + "</TaxDataAry></Fare>";
                    }
                }
            }

            bool res1 = false;

            if (Session["Role"].ToString() == "User")
            {

                //ravi db save

                FlightBAL objFlightBal = new FlightBAL();
                String RefNo = Common.GetFlightsReferenceNo("LJIF");
                Session["Order_Id"] = RefNo.ToString();
                objFlightBal.ReferenceNo = RefNo.ToString();
                objFlightBal.TransId = "0";
                objFlightBal.Status = "Pending";
                objFlightBal.AdultPax = Convert.ToInt32(Session["adultCntInt"]);
                objFlightBal.InfantPax = Convert.ToInt32(Session["infantCntInt"]);
                objFlightBal.ChildPax = Convert.ToInt32(Session["childCntInt"]);
                objFlightBal.Origin_Destination_Id = id;
                objFlightBal.Origin_Destination_Key = key;
                objFlightBal.ActualBasefare = Convert.ToDecimal(ActualBaseFare);
                objFlightBal.Tax = Convert.ToDecimal(Tax);
                objFlightBal.STax = Convert.ToDecimal(STax);
                objFlightBal.TCharge = Convert.ToDecimal(TCharge);
                objFlightBal.Scharge = Convert.ToDecimal(SCharge);
                objFlightBal.TDiscount = Convert.ToDecimal(TDiscount);
                objFlightBal.TMarkUp = Convert.ToDecimal(TMarkup);
                objFlightBal.TPartnerCommission = Convert.ToDecimal(TPartnerCommission);
                objFlightBal.TSDiscount = Convert.ToDecimal(TSdiscount);
                objFlightBal.CreatedBy = Convert.ToInt32(Session["UserID"]);
                objFlightBal.TripMode = "One";
                objFlightBal.ocTax = ocTax;
                objFlightBal.Return = return1;
                objFlightBal.id = id;
                objFlightBal.key = key;

                DataTable dtflightBookingId = objFlightBal.AddDInternationalFlightBooking(objFlightBal);
                Session["BookingID"] = dtflightBookingId.Rows[0]["FlightBookingID"].ToString();

                //fegments

                string customerInfo = string.Empty;
                Table tbladults = (Table)this.UpdatePanel2.FindControl("tblAdultsInt");
                for (int l = 1; l <= Convert.ToInt32(Session["adultCntInt"]); l++)
                {

                    TextBox txtFn = (TextBox)tbladults.FindControl("txtFnInt" + l);
                    TextBox txtLn = (TextBox)tbladults.FindControl("txtLnInt" + l);
                    DropDownList ddlTitle = (DropDownList)tbladults.FindControl("ddlTitleInt" + l);

                    if (customerInfo == string.Empty)
                    {
                        customerInfo = ddlTitle.SelectedItem.Text + "|" + txtFn.Text + "|" + txtLn.Text + "|" + "adt" + "|" + "-";
                    }
                    else
                    {
                        customerInfo = customerInfo + ";" + ddlTitle.SelectedItem.Text + "|" + txtFn.Text + "|" + txtLn.Text + "|" + "adt" + "|" + "-";
                    }
                    //  xmlRequest = xmlRequest + "<CustomerInfo><givenName>" + txtFn.Text + "</givenName><surName>" + txtLn.Text + "</surName><nameReference>" + ddlTitle.SelectedItem.Value + "</nameReference><psgrtype>adt</psgrtype></CustomerInfo>";
                }

                Table tblChild = (Table)this.UpdatePanel2.FindControl("tblChildInt");
                for (int j = 1; j <= Convert.ToInt32(Session["childCntInt"]); j++)
                {
                    TextBox txtFn = (TextBox)tblChild.FindControl("txtCFnInt" + j);

                    TextBox txtLn = (TextBox)tblChild.FindControl("txtCLnInt" + j);

                    DropDownList ddlTitle = (DropDownList)tblChild.FindControl("ddlCTitleInt" + j);

                    TextBox txtBirthDate = (TextBox)tblChild.FindControl("txtCBirthDateInt" + j);

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

                    if (customerInfo == string.Empty)
                    {
                        customerInfo = ddlTitle.SelectedItem.Text + "|" + txtFn.Text + "|" + txtLn.Text + "|" + "chd" + "|" + age + "|" + txtBirthDate.Text;
                    }
                    else
                    {
                        customerInfo = customerInfo + ";" + ddlTitle.SelectedItem.Text + "|" + txtFn.Text + "|" + txtLn.Text + "|" + "chd" + "|" + age + "|" + txtBirthDate.Text;
                    }
                    //  xmlRequest = xmlRequest + "<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.UpdatePanel2.FindControl("tblInfantsInt");
                for (int k = 1; k <= Convert.ToInt32(Session["infantCntInt"]); k++)
                {
                    TextBox txtFn = (TextBox)tblInfants.FindControl("txtIFnInt" + k);

                    TextBox txtLn = (TextBox)tblInfants.FindControl("txtILnInt" + k);

                    DropDownList ddlTitle = (DropDownList)tblInfants.FindControl("ddlITitleInt" + k);

                    TextBox txtBirthDate = (TextBox)tblInfants.FindControl("txtIBirthDateInt" + k);
                    string age = string.Empty;
                    if (txtBirthDate != null)
                        age = (DateTime.Now.Year - Convert.ToDateTime(txtBirthDate.Text).Year).ToString();
                    else
                        age = "0";

                    if (customerInfo == string.Empty)
                    {
                        customerInfo = ddlTitle.SelectedItem.Text + "|" + txtFn.Text + "|" + txtLn.Text + "|" + "inf" + "|" + age + "|" + txtBirthDate.Text;
                    }
                    else
                    {
                        customerInfo = customerInfo + ";" + ddlTitle.SelectedItem.Text + "|" + txtFn.Text + "|" + txtLn.Text + "|" + "inf" + "|" + age + "|" + txtBirthDate.Text;
                    }
                    //  xmlRequest = xmlRequest + "<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>";
                }

                if (dtFlightSegment.Rows.Count > 0)
                {
                    DataRow[] rowFilghtSegment = dtFlightSegment.Select("FlightSegments_Id=" + FlightSegmentsID);
                    for (int j = 0; j < rowFilghtSegment.Length; j++)
                    {
                        AirEquipType = rowFilghtSegment[j]["AirEquipType"].ToString();
                        ArrivalAirportCode = rowFilghtSegment[j]["ArrivalAirportCode"].ToString();
                        ArrivalAirportName = rowFilghtSegment[j]["ArrivalAirportName"].ToString();
                        ArrivalDateTime = rowFilghtSegment[j]["ArrivalDateTime"].ToString();
                        DepartureAirportCode = rowFilghtSegment[j]["DepartureAirportCode"].ToString();
                        DepartureAirportName = rowFilghtSegment[j]["DepartureAirportName"].ToString();
                        DepartureDateTime = rowFilghtSegment[j]["DepartureDateTime"].ToString();
                        FlightNumber = rowFilghtSegment[j]["FlightNumber"].ToString();
                        MarketingAirlineCode = rowFilghtSegment[j]["MarketingAirlineCode"].ToString();
                        OperatingAirlineCode = rowFilghtSegment[j]["OperatingAirlineCode"].ToString();
                        OperatingAirlineName = rowFilghtSegment[j]["OperatingAirlineName"].ToString();
                        OperatingAirlineFlightNumber = rowFilghtSegment[j]["OperatingAirlineFlightNumber"].ToString();
                        NumStops = rowFilghtSegment[j]["NumStops"].ToString();
                        LinkSellAgrmnt = rowFilghtSegment[j]["LinkSellAgrmnt"].ToString();
                        Conx = rowFilghtSegment[j]["Conx"].ToString();
                        AirpChg = rowFilghtSegment[j]["AirpChg"].ToString();
                        InsideAvailOption = rowFilghtSegment[j]["InsideAvailOption"].ToString();
                        GenTrafRestriction = rowFilghtSegment[j]["GenTrafRestriction"].ToString();
                        DaysOperates = rowFilghtSegment[j]["DaysOperates"].ToString();
                        JrnyTm = rowFilghtSegment[j]["JrnyTm"].ToString();
                        EndDt = rowFilghtSegment[j]["EndDt"].ToString();
                        StartTerminal = rowFilghtSegment[j]["StartTerminal"].ToString();
                        EndTerminal = rowFilghtSegment[j]["EndTerminal"].ToString();
                        FltTm = rowFilghtSegment[j]["FltTm"].ToString();
                        LSAInd = rowFilghtSegment[j]["LSAInd"].ToString();
                        Mile = rowFilghtSegment[j]["Mile"].ToString();

                        DataTable dtBookingClass1 = dsIntFlights.Tables[13];
                        if (dtBookingClass1.Rows.Count > 0)
                        {
                            DataRow[] rowBookingClass = dtBookingClass1.Select("FlightSegment_Id=" + rowFilghtSegment[j]["FlightSegment_Id"].ToString());
                            Availability = rowBookingClass[0]["Availability"].ToString();
                            BIC = rowBookingClass[0]["BIC"].ToString();
                        }

                        DataTable dtBookingClassFare1 = dsIntFlights.Tables[14];
                        if (dtBookingClassFare1.Rows.Count > 0)
                        {
                            DataRow[] rowBookingClassFare = dtBookingClassFare1.Select("FlightSegment_Id=" + rowFilghtSegment[j]["FlightSegment_Id"].ToString());
                            bookingclass = rowBookingClassFare[0]["bookingclass"].ToString();
                            classType = rowBookingClassFare[0]["classType"].ToString();
                            farebasiscode = rowBookingClassFare[0]["farebasiscode"].ToString();
                            Rule = rowBookingClassFare[0]["Rule"].ToString();

                        }
                        //   bookingclass = rowFilghtSegment[j]["LSAInd"].ToString();
                        //   classType = rowFilghtSegment[j]["Mile"].ToString();

                        objFlightBal.FlightBookingID = dtflightBookingId.Rows[0]["FlightBookingID"].ToString();//Convert.ToString(Session["BookingID"]);
                        objFlightBal.AirEquipType = AirEquipType;
                        objFlightBal.ArrivalAirportCode = ArrivalAirportCode;
                        objFlightBal.ArrivalAirportName = ArrivalAirportName;
                        objFlightBal.ArrivalDateTime = ArrivalDateTime;
                        objFlightBal.DepartureAirportCode = DepartureAirportCode;
                        objFlightBal.DepartureAirportName = DepartureAirportName;
                        objFlightBal.DepartureDateTime = DepartureDateTime;
                        objFlightBal.FlightNumber = FlightNumber;
                        objFlightBal.MarketingAirlineCode = MarketingAirlineCode;
                        objFlightBal.OperatingAirlineCode = OperatingAirlineCode;
                        objFlightBal.OperatingAirlineName = OperatingAirlineName;
                        objFlightBal.OperatingAirlineFlightNumber = OperatingAirlineFlightNumber;
                        objFlightBal.NumStops = NumStops;
                        objFlightBal.LinkSellAgrmnt = LinkSellAgrmnt;
                        objFlightBal.Conx = Conx;
                        objFlightBal.AirpChg = AirpChg;
                        objFlightBal.InsideAvailOption = InsideAvailOption;
                        objFlightBal.GenTrafRestriction = GenTrafRestriction;
                        objFlightBal.DaysOperates = DaysOperates;
                        objFlightBal.JrnyTm = JrnyTm;
                        objFlightBal.EndDt = EndDt;
                        objFlightBal.StartTerminal = StartTerminal;
                        objFlightBal.EndTerminal = EndTerminal;
                        objFlightBal.FltTm = FltTm;
                        objFlightBal.LSAInd = LSAInd;
                        objFlightBal.Mile = Mile;
                        objFlightBal.Availability = Availability;
                        objFlightBal.BIC = BIC;
                        objFlightBal.emailAddress = txtEmailIDInt.Text.Trim();
                        Session["EmailID"] = txtEmailIDInt.Text.Trim();
                        objFlightBal.telephone = txtMobileNumberInt.Text;
                        Session["MobileNo"] = txtMobileNumberInt.Text;
                        objFlightBal.CreatedBy = Convert.ToInt32(Session["UserID"]);
                        objFlightBal.Customer_Details = customerInfo;
                        objFlightBal.Address = txtCityInt.Text + "," + txtStateInt.Text + "," + ddlCountryInt.SelectedValue + "," + txtPostalCodeInt.Text + ",";
                        Session["customerInfo"] = customerInfo;
                        Session["Address"] = txtCityInt.Text + "," + txtStateInt.Text + "," + ddlCountryInt.SelectedValue + "," + txtPostalCodeInt.Text + ",";
                        objFlightBal.bookingClass = bookingclass;
                        objFlightBal.ClassType = classType;
                        objFlightBal.farebasisCode = farebasiscode;
                        objFlightBal.Fare_Rule = Rule;
                        objFlightBal.PsgrType = FarePsgrType;
                        objFlightBal.BaseFare = FareBaseFare;
                        objFlightBal.psgrTax = FareTax1;
                        objFlightBal.BagInfo = BagInfo;
                        objFlightBal.FarePsgrType = faretype;

                        res1 = objFlightBal.AddInternationalFlightSegment(objFlightBal);

                    }
                }

                if (res1 == true)
                {
                    Response.Redirect("~/pay.aspx?val=true", false);
                }
                //db save end
            }
            else
            {

                FlightBAL objFlightsBal = new FlightBAL();

                #region Pricing
                //  string XmlPricingRequest = "<PriceRequest><noadults>" + ddlAdultsInt.SelectedValue + "</noadults><nochild>" + ddlChildsInt.SelectedValue + "</nochild><noinfant>" + ddlInfantsInt.SelectedValue + "</noinfant><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooINTLWS1.0</Clienttype><OriginDestinationOption><FareDetails><ActualBaseFare>" + ActualBaseFare + "</ActualBaseFare><Tax>" + Tax + "</Tax><STax>" + STax + "</STax><TCharge>" + TCharge + "</TCharge><SCharge>" + SCharge + "</SCharge><TDiscount>" + TDiscount + "</TDiscount><TMarkup>" + TMarkup + "</TMarkup><TPartnerCommission>" + TPartnerCommission + "</TPartnerCommission><TSdiscount>" + TSdiscount + "</TSdiscount><FareBreakup><FareAry><Fare><PsgrType>" + PsgrType + "</PsgrType><BaseFare>" + BaseFare + "</BaseFare><Tax>" + FareTax + "</Tax></Fare></FareAry></FareBreakup><ocTax>" + ocTax + "</ocTax></FareDetails>";
                string XmlPricingRequest = "<PriceRequest><noadults>" + ddlAdultsInt.SelectedValue + "</noadults><nochild>" + ddlChildsInt.SelectedValue + "</nochild><noinfant>" + ddlInfantsInt.SelectedValue + "</noinfant><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooINTLWS1.0</Clienttype><OriginDestinationOption><FareDetails><ActualBaseFare>" + ActualBaseFare + "</ActualBaseFare><Tax>" + Tax + "</Tax><STax>" + STax + "</STax><TCharge>" + TCharge + "</TCharge><SCharge>" + SCharge + "</SCharge><TDiscount>" + TDiscount + "</TDiscount><TMarkup>" + TMarkup + "</TMarkup><TPartnerCommission>" + TPartnerCommission + "</TPartnerCommission><TSdiscount>" + TSdiscount + "</TSdiscount><FareBreakup><FareAry>" + str + "</FareAry></FareBreakup><ocTax>" + ocTax + "</ocTax></FareDetails>";
                XmlPricingRequest = XmlPricingRequest + "<onward><FlightSegments>";

                if (dtFlightSegment.Rows.Count > 0)
                {
                    DataRow[] rowFilghtSegment = dtFlightSegment.Select("FlightSegments_Id=" + FlightSegmentsID);
                    for (int j = 0; j < rowFilghtSegment.Length; j++)
                    {
                        AirEquipType = rowFilghtSegment[j]["AirEquipType"].ToString();
                        ArrivalAirportCode = rowFilghtSegment[j]["ArrivalAirportCode"].ToString();
                        ArrivalAirportName = rowFilghtSegment[j]["ArrivalAirportName"].ToString();
                        ArrivalDateTime = rowFilghtSegment[j]["ArrivalDateTime"].ToString();
                        DepartureAirportCode = rowFilghtSegment[j]["DepartureAirportCode"].ToString();
                        DepartureAirportName = rowFilghtSegment[j]["DepartureAirportName"].ToString();
                        DepartureDateTime = rowFilghtSegment[j]["DepartureDateTime"].ToString();
                        FlightNumber = rowFilghtSegment[j]["FlightNumber"].ToString();
                        MarketingAirlineCode = rowFilghtSegment[j]["MarketingAirlineCode"].ToString();
                        OperatingAirlineCode = rowFilghtSegment[j]["OperatingAirlineCode"].ToString();
                        OperatingAirlineName = rowFilghtSegment[j]["OperatingAirlineName"].ToString();
                        OperatingAirlineFlightNumber = rowFilghtSegment[j]["OperatingAirlineFlightNumber"].ToString();
                        NumStops = rowFilghtSegment[j]["NumStops"].ToString();
                        LinkSellAgrmnt = rowFilghtSegment[j]["LinkSellAgrmnt"].ToString();
                        Conx = rowFilghtSegment[j]["Conx"].ToString();
                        AirpChg = rowFilghtSegment[j]["AirpChg"].ToString();
                        InsideAvailOption = rowFilghtSegment[j]["InsideAvailOption"].ToString();
                        GenTrafRestriction = rowFilghtSegment[j]["GenTrafRestriction"].ToString();
                        DaysOperates = rowFilghtSegment[j]["DaysOperates"].ToString();
                        JrnyTm = rowFilghtSegment[j]["JrnyTm"].ToString();
                        EndDt = rowFilghtSegment[j]["EndDt"].ToString();
                        StartTerminal = rowFilghtSegment[j]["StartTerminal"].ToString();
                        EndTerminal = rowFilghtSegment[j]["EndTerminal"].ToString();
                        FltTm = rowFilghtSegment[j]["FltTm"].ToString();
                        LSAInd = rowFilghtSegment[j]["LSAInd"].ToString();
                        Mile = rowFilghtSegment[j]["Mile"].ToString();

                        DataTable dtBookingClass1 = dsIntFlights.Tables[13];
                        if (dtBookingClass1.Rows.Count > 0)
                        {
                            DataRow[] rowBookingClass = dtBookingClass1.Select("FlightSegment_Id=" + rowFilghtSegment[j]["FlightSegment_Id"].ToString());
                            Availability = rowBookingClass[0]["Availability"].ToString();
                            BIC = rowBookingClass[0]["BIC"].ToString();
                        }

                        DataTable dtBookingClassFare1 = dsIntFlights.Tables[14];
                        if (dtBookingClassFare1.Rows.Count > 0)
                        {
                            DataRow[] rowBookingClassFare = dtBookingClassFare1.Select("FlightSegment_Id=" + rowFilghtSegment[j]["FlightSegment_Id"].ToString());
                            bookingclass = rowBookingClassFare[0]["bookingclass"].ToString();
                            classType = rowBookingClassFare[0]["classType"].ToString();
                            farebasiscode = rowBookingClassFare[0]["farebasiscode"].ToString();
                            Rule = rowBookingClassFare[0]["Rule"].ToString();

                        }

                        XmlPricingRequest = XmlPricingRequest + "<FlightSegment><AirEquipType>" + AirEquipType + "</AirEquipType><ArrivalAirportCode>" + ArrivalAirportCode + "</ArrivalAirportCode><ArrivalAirportName>" + ArrivalAirportName + "</ArrivalAirportName><ArrivalDateTime>" + ArrivalDateTime + "</ArrivalDateTime><DepartureAirportCode>" + DepartureAirportCode + "</DepartureAirportCode><DepartureAirportName>" + DepartureAirportName + "</DepartureAirportName><DepartureDateTime>" + DepartureDateTime + "</DepartureDateTime><FlightNumber>" + FlightNumber + "</FlightNumber>";
                        XmlPricingRequest = XmlPricingRequest + "<MarketingAirlineCode>" + MarketingAirlineCode + "</MarketingAirlineCode><OperatingAirlineCode>" + OperatingAirlineCode + "</OperatingAirlineCode><OperatingAirlineName>" + OperatingAirlineName + "</OperatingAirlineName><OperatingAirlineFlightNumber>" + OperatingAirlineFlightNumber + "</OperatingAirlineFlightNumber><NumStops>" + NumStops + "</NumStops><LinkSellAgrmnt>" + LinkSellAgrmnt + "</LinkSellAgrmnt><Conx>" + Conx + "</Conx><AirpChg>" + AirpChg + "</AirpChg><InsideAvailOption>" + InsideAvailOption + "</InsideAvailOption><GenTrafRestriction>" + GenTrafRestriction + "</GenTrafRestriction><DaysOperates>" + DaysOperates + "</DaysOperates><JrnyTm>" + JrnyTm + "</JrnyTm><EndDt>" + EndDt + "</EndDt><StartTerminal>" + StartTerminal + "</StartTerminal><EndTerminal>" + EndTerminal + "</EndTerminal>";
                        // XmlPricingRequest = XmlPricingRequest + "<FltTm>" + FltTm + "</FltTm><LSAInd>" + LSAInd + "</LSAInd><Mile>" + Mile + "</Mile><BookingClass><Availability>" + Availability + "</Availability><BIC>" + BIC + "</BIC></BookingClass><BookingClassFare><bookingclass>" + bookingclass + "</bookingclass><classType>" + classType + "</classType><farebasiscode>" + farebasiscode + "</farebasiscode><Rule>" + Rule.Replace("<", "&lt;").Replace(">", "&gt;") + "</Rule><PsgrBreakup><PsgrAry><Psgr><PsgrType>" + FarePsgrType + "</PsgrType><BaseFare>" + FareBaseFare + "</BaseFare><Tax>" + FareTax1 + "</Tax><BagInfo></BagInfo></Psgr></PsgrAry></PsgrBreakup></BookingClassFare></FlightSegment>";
                        XmlPricingRequest = XmlPricingRequest + "<FltTm>" + FltTm + "</FltTm><LSAInd>" + LSAInd + "</LSAInd><Mile>" + Mile + "</Mile><BookingClass><Availability>" + Availability + "</Availability><BIC>" + BIC + "</BIC></BookingClass><BookingClassFare><bookingclass>" + bookingclass + "</bookingclass><classType>" + classType + "</classType><farebasiscode>" + farebasiscode + "</farebasiscode><Rule>" + Rule.Replace("<", "&lt;").Replace(">", "&gt;") + "</Rule>";
                        if (dtBookingClassFare.Columns.Contains("bookingclassFare_Id"))
                        {
                            XmlPricingRequest = XmlPricingRequest + "<PsgrBreakup><PsgrAry>" + taxdatapsgr + "</PsgrAry></PsgrBreakup>";
                        }
                        XmlPricingRequest = XmlPricingRequest + "</BookingClassFare></FlightSegment>";
                    }
                }
                XmlPricingRequest = XmlPricingRequest + "</FlightSegments></onward><Return>" + return1 + "</Return><id>" + id + "</id><key>" + key + "</key>";
                XmlPricingRequest = XmlPricingRequest + "</OriginDestinationOption></PriceRequest>";

                DataSet dsPricingResponse = objFlightsBal.GetDatasetFromAPI(XmlPricingRequest, "http://live.arzoo.com:9302/Pricing");

                if (dsPricingResponse.Tables[0].Rows[0]["error"] == string.Empty)
                {
                    //  DataTable dtpricingflightsegment = dsPricingResponse.Tables

                    DataTable dtpricingFlightSegment = dsPricingResponse.Tables["FlightSegment"];
                    if (dtpricingFlightSegment.Rows.Count > 0)
                    {
                        DataRow[] rowFilghtSegment = dtpricingFlightSegment.Select("FlightSegment_ID=" + Convert.ToInt32(lblIntFlightSegmentId.Text));
                        FlightSegmentsID = rowFilghtSegment[0]["FlightSegments_Id"].ToString();

                    }
                    DataTable dtpricingFlightSegments = dsPricingResponse.Tables["FlightSegments"];
                    if (dtpricingFlightSegments.Rows.Count > 0)
                    {
                        DataRow[] rowFilghtSegments = dtpricingFlightSegments.Select("FlightSegments_ID=" + FlightSegmentsID);
                        onwardId = rowFilghtSegments[0]["Onward_Id"].ToString();
                    }
                    DataTable dtpricingOnward = dsPricingResponse.Tables["onward"];
                    if (dtpricingOnward.Rows.Count > 0)
                    {
                        DataRow[] rowOnward = dtpricingOnward.Select("Onward_Id=" + onwardId);
                        OriginDestinationOption_Id = rowOnward[0]["OriginDestinationOption_Id"].ToString();
                    }
                    DataTable dtpricingFareDetails = dsIntFlights.Tables["FareDetails"];
                    if (dtFareDetails.Rows.Count > 0)
                    {
                        DataRow[] rowFareDetails = dtFareDetails.Select("OriginDestinationOption_Id=" + OriginDestinationOption_Id);
                        ActualBaseFare = rowFareDetails[0]["ActualBaseFare"].ToString();
                        Tax = rowFareDetails[0]["Tax"].ToString();
                        STax = rowFareDetails[0]["STax"].ToString();
                        TCharge = rowFareDetails[0]["TCharge"].ToString();
                        SCharge = rowFareDetails[0]["SCharge"].ToString();
                        TDiscount = rowFareDetails[0]["TDiscount"].ToString();
                        TMarkup = rowFareDetails[0]["TMarkup"].ToString();
                        TPartnerCommission = rowFareDetails[0]["TPartnerCommission"].ToString();
                        TSdiscount = rowFareDetails[0]["TSdiscount"].ToString();
                        ocTax = rowFareDetails[0]["ocTax"].ToString();
                        FareDetails_id = rowFareDetails[0]["FareDetails_id"].ToString();
                    }
                }

                #endregion

                string ref1 = Common.GetFlightsReferenceNo("LJIF");

                string xmlRequest = "<Bookingrequest><noadults>" + ddlAdultsInt.SelectedValue + "</noadults><nochild>" + ddlChildsInt.SelectedValue + "</nochild><noinfant>" + ddlInfantsInt.SelectedValue + "</noinfant><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooINTLWS1.0</Clienttype><creditcardno></creditcardno><PartnerreferenceID>" + ref1 + "</PartnerreferenceID>";
                xmlRequest = xmlRequest + "<personName>";

                // Dynamic generation of names of adults, infants , Child
                Table tbladults = (Table)this.UpdatePanel2.FindControl("tblAdultsInt");
                for (int i = 1; i <= Convert.ToInt32(Session["adultCntInt"]); i++)
                {

                    TextBox txtFn = (TextBox)tbladults.FindControl("txtFnInt" + i);
                    TextBox txtLn = (TextBox)tbladults.FindControl("txtLnInt" + i);
                    DropDownList ddlTitle = (DropDownList)tbladults.FindControl("ddlTitleInt" + i);

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

                Table tblChild = (Table)this.UpdatePanel2.FindControl("tblChildInt");
                for (int i = 1; i <= Convert.ToInt32(Session["childCntInt"]); i++)
                {
                    TextBox txtFn = (TextBox)tblChild.FindControl("txtCFnInt" + i);

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

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

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

                    string age = (DateTime.Now.Year - Convert.ToDateTime(txtBirthDate.Text).Year).ToString();
                    //if (Convert.ToInt32(age) > 5)
                    //{
                    //    Literal lit = new Literal();
                    //    lit.Text = txtFn.Text + " Age  between 3 - 5 yrs.";
                    //    this.Controls.Add(lit);
                    //    break;
                    //}

                    xmlRequest = xmlRequest + "<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.UpdatePanel2.FindControl("tblInfantsInt");
                for (int i = 1; i <= Convert.ToInt32(Session["infantCntInt"]); i++)
                {
                    TextBox txtFn = (TextBox)tblInfants.FindControl("txtIFnInt" + i);

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

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

                    TextBox txtBirthDate = (TextBox)tblInfants.FindControl("txtIBirthDateInt" + i);
                    string age = string.Empty;
                    if (txtBirthDate != null)
                        age = (DateTime.Now.Year - Convert.ToDateTime(txtBirthDate.Text).Year).ToString();
                    else
                        age = "0";
                    //if (Convert.ToInt32(age) == 12)
                    //{
                    //    Literal lit = new Literal();
                    //    lit.Text = txtFn.Text + " Age should be below 1 yr.";
                    //    this.Controls.Add(lit);
                    //    break;
                    //}

                    xmlRequest = xmlRequest + "<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>";
                }

                xmlRequest = xmlRequest + "</personName><telePhone><phoneNumber>" + txtMobileNumInt.Text + "</phoneNumber></telePhone><email><emailAddress>" + txtEmailIDInt.Text + "</emailAddress></email>";
                //xmlRequest = xmlRequest + "<OriginDestinationOption><FareDetails><ActualBaseFare>" + ActualBaseFare + "</ActualBaseFare><Tax>" + Tax + "</Tax><STax>" + STax + "</STax><TCharge>" + TCharge + "</TCharge><SCharge>" + SCharge + "</SCharge><TDiscount>" + TDiscount + "</TDiscount><TMarkup>" + TMarkup + "</TMarkup><TPartnerCommission>" + TPartnerCommission + "</TPartnerCommission><TSdiscount>" + TSdiscount + "</TSdiscount><FareBreakup><FareAry><Fare><PsgrType>" + PsgrType + "</PsgrType><BaseFare>" + BaseFare + "</BaseFare><Tax>" + FareTax + "</Tax><TaxDataAry>";
                //xmlRequest = xmlRequest + taxData + "</TaxDataAry></Fare></FareAry></FareBreakup><ocTax>" + ocTax + "</ocTax></FareDetails><onward><FlightSegments>";
                xmlRequest = xmlRequest + "<OriginDestinationOption><FareDetails><ActualBaseFare>" + ActualBaseFare + "</ActualBaseFare><Tax>" + Tax + "</Tax><STax>" + STax + "</STax><TCharge>" + TCharge + "</TCharge><SCharge>" + SCharge + "</SCharge><TDiscount>" + TDiscount + "</TDiscount><TMarkup>" + TMarkup + "</TMarkup><TPartnerCommission>" + TPartnerCommission + "</TPartnerCommission><TSdiscount>" + TSdiscount + "</TSdiscount><FareBreakup><FareAry>";
                xmlRequest = xmlRequest + str + "</FareAry></FareBreakup><ocTax>" + ocTax + "</ocTax></FareDetails><onward><FlightSegments>";

                if (dtFlightSegment.Rows.Count > 0)
                {
                    DataRow[] rowFilghtSegment = dtFlightSegment.Select("FlightSegments_Id=" + FlightSegmentsID);
                    for (int j = 0; j < rowFilghtSegment.Length; j++)
                    {
                        AirEquipType = rowFilghtSegment[j]["AirEquipType"].ToString();
                        ArrivalAirportCode = rowFilghtSegment[j]["ArrivalAirportCode"].ToString();
                        ArrivalAirportName = rowFilghtSegment[j]["ArrivalAirportName"].ToString();
                        ArrivalDateTime = rowFilghtSegment[j]["ArrivalDateTime"].ToString();
                        DepartureAirportCode = rowFilghtSegment[j]["DepartureAirportCode"].ToString();
                        DepartureAirportName = rowFilghtSegment[j]["DepartureAirportName"].ToString();
                        DepartureDateTime = rowFilghtSegment[j]["DepartureDateTime"].ToString();
                        FlightNumber = rowFilghtSegment[j]["FlightNumber"].ToString();
                        MarketingAirlineCode = rowFilghtSegment[j]["MarketingAirlineCode"].ToString();
                        OperatingAirlineCode = rowFilghtSegment[j]["OperatingAirlineCode"].ToString();
                        OperatingAirlineName = rowFilghtSegment[j]["OperatingAirlineName"].ToString();
                        OperatingAirlineFlightNumber = rowFilghtSegment[j]["OperatingAirlineFlightNumber"].ToString();
                        NumStops = rowFilghtSegment[j]["NumStops"].ToString();
                        LinkSellAgrmnt = rowFilghtSegment[j]["LinkSellAgrmnt"].ToString();
                        Conx = rowFilghtSegment[j]["Conx"].ToString();
                        AirpChg = rowFilghtSegment[j]["AirpChg"].ToString();
                        InsideAvailOption = rowFilghtSegment[j]["InsideAvailOption"].ToString();
                        GenTrafRestriction = rowFilghtSegment[j]["GenTrafRestriction"].ToString();
                        DaysOperates = rowFilghtSegment[j]["DaysOperates"].ToString();
                        JrnyTm = rowFilghtSegment[j]["JrnyTm"].ToString();
                        EndDt = rowFilghtSegment[j]["EndDt"].ToString();
                        StartTerminal = rowFilghtSegment[j]["StartTerminal"].ToString();
                        EndTerminal = rowFilghtSegment[j]["EndTerminal"].ToString();
                        FltTm = rowFilghtSegment[j]["FltTm"].ToString();
                        LSAInd = rowFilghtSegment[j]["LSAInd"].ToString();
                        Mile = rowFilghtSegment[j]["Mile"].ToString();

                        DataTable dtBookingClass1 = dsIntFlights.Tables[13];
                        if (dtBookingClass1.Rows.Count > 0)
                        {
                            DataRow[] rowBookingClass = dtBookingClass1.Select("FlightSegment_Id=" + rowFilghtSegment[j]["FlightSegment_Id"].ToString());
                            Availability = rowBookingClass[0]["Availability"].ToString();
                            BIC = rowBookingClass[0]["BIC"].ToString();
                        }

                        DataTable dtBookingClassFare1 = dsIntFlights.Tables[14];
                        if (dtBookingClassFare1.Rows.Count > 0)
                        {
                            DataRow[] rowBookingClassFare = dtBookingClassFare1.Select("FlightSegment_Id=" + rowFilghtSegment[j]["FlightSegment_Id"].ToString());
                            bookingclass = rowBookingClassFare[0]["bookingclass"].ToString();
                            classType = rowBookingClassFare[0]["classType"].ToString();
                            farebasiscode = rowBookingClassFare[0]["farebasiscode"].ToString();
                            Rule = rowBookingClassFare[0]["Rule"].ToString();

                        }

                        xmlRequest = xmlRequest + "<FlightSegment><AirEquipType>" + AirEquipType + "</AirEquipType><ArrivalAirportCode>" + ArrivalAirportCode + "</ArrivalAirportCode><ArrivalAirportName>" + ArrivalAirportName + "</ArrivalAirportName><ArrivalDateTime>" + ArrivalDateTime + "</ArrivalDateTime><DepartureAirportCode>" + DepartureAirportCode + "</DepartureAirportCode><DepartureAirportName>" + DepartureAirportName + "</DepartureAirportName><DepartureDateTime>" + DepartureDateTime + "</DepartureDateTime><FlightNumber>" + FlightNumber + "</FlightNumber>";
                        xmlRequest = xmlRequest + "<MarketingAirlineCode>" + MarketingAirlineCode + "</MarketingAirlineCode><OperatingAirlineCode>" + OperatingAirlineCode + "</OperatingAirlineCode><OperatingAirlineName>" + OperatingAirlineName + "</OperatingAirlineName><OperatingAirlineFlightNumber>" + OperatingAirlineFlightNumber + "</OperatingAirlineFlightNumber><NumStops>" + NumStops + "</NumStops><LinkSellAgrmnt>" + LinkSellAgrmnt + "</LinkSellAgrmnt><Conx>" + Conx + "</Conx><AirpChg>" + AirpChg + "</AirpChg><InsideAvailOption>" + InsideAvailOption + "</InsideAvailOption><GenTrafRestriction>" + GenTrafRestriction + "</GenTrafRestriction><DaysOperates>" + DaysOperates + "</DaysOperates><JrnyTm>" + JrnyTm + "</JrnyTm><EndDt>" + EndDt + "</EndDt><StartTerminal>" + StartTerminal + "</StartTerminal><EndTerminal>" + EndTerminal + "</EndTerminal>";
                        xmlRequest = xmlRequest + "<FltTm>" + FltTm + "</FltTm><LSAInd>" + LSAInd + "</LSAInd><Mile>" + Mile + "</Mile><BookingClass><Availability>" + Availability + "</Availability><BIC>" + BIC + "</BIC></BookingClass><BookingClassFare><bookingclass>" + bookingclass + "</bookingclass><classType>" + classType + "</classType><farebasiscode>" + farebasiscode + "</farebasiscode><Rule>" + Rule.Replace("<", "&lt;").Replace(">", "&gt;") + "</Rule>";
                        if (dtBookingClassFare.Columns.Contains("bookingclassFare_Id"))
                        {
                            xmlRequest = xmlRequest + "<PsgrBreakup><PsgrAry><Psgr><PsgrType>" + FarePsgrType + "</PsgrType><BaseFare>" + FareBaseFare + "</BaseFare><Tax>" + FareTax1 + "</Tax><BagInfo></BagInfo></Psgr></PsgrAry></PsgrBreakup>";
                        }
                        xmlRequest = xmlRequest + "</BookingClassFare></FlightSegment>";
                    }
                }
                xmlRequest = xmlRequest + "</FlightSegments></onward><Return>" + return1 + "</Return><id>" + id + "</id><key>" + key + "</key>";
                xmlRequest = xmlRequest + "</OriginDestinationOption></Bookingrequest>";

                StringBuilder stt = new StringBuilder();

                stt.Append("xmlRequest");
                stt.Append("=");
                stt.Append(Server.UrlEncode(xmlRequest));
                // stt.Append((xmlRequest).Replace("+", "%2B"));

                byte[] requestData = Encoding.UTF8.GetBytes(stt.ToString());

                //byte[] requestData = System.Text.Encoding.UTF8.GetBytes(xmlRequest.Replace("+","%2B"));

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://live.arzoo.com:9302/Booking");

                //request.Accept = @"text/plain,application/xml";
                //request.ContentType = @"application/xml";
                //request.Method = @"POST";
                request.Method = "POST";
                request.ContentType = "application/x-www-form-urlencoded";
                request.Accept = "application/json";
                // request.Accept = "en-us,en;q=0.5";

                //request.ContentType = "multipart/form-data";
                request.ContentLength = requestData.Length;

                using (Stream requestStream = request.GetRequestStream())
                {
                    requestStream.Write(requestData, 0, requestData.Length);
                }
                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                {
                    using (Stream stream = response.GetResponseStream())
                    {
                        using (StreamReader reader = new StreamReader(stream, Encoding.ASCII))
                            result = reader.ReadToEnd();
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml(result);
                        XmlNodeReader xmlReader = new XmlNodeReader(doc);

                        ds.ReadXml(xmlReader);
                    }
                }

                //result = "<Bookingresponse><OriginDestinationOption><FareDetails><ActualBaseFare>85035</ActualBaseFare><Tax>4079</Tax><STax>1055</STax><TCharge>0</TCharge><SCharge>0</SCharge><TDiscount>0</TDiscount><TMarkup>150</TMarkup><TPartnerCommission>0</TPartnerCommission><TSdiscount>0</TSdiscount><FareBreakup><FareAry><Fare><PsgrType>ADT</PsgrType><BaseFare>85035</BaseFare><Tax>4079</Tax></Fare></FareAry></FareBreakup></FareDetails><onward><FlightSegments><FlightSegment><AirEquipType>77W</AirEquipType><ArrivalAirportCode>LHR</ArrivalAirportCode><ArrivalAirportName>LONDON&lt;BR&gt; (HEATHROW)</ArrivalAirportName><ArrivalDateTime>2010-02-26T06:35:00</ArrivalDateTime><DepartureAirportCode>BOM</DepartureAirportCode><DepartureAirportName>MUMBAI&lt;BR&gt; (CHHATRAPATI SHIVAJI INTERNATIONAL)</DepartureAirportName><DepartureDateTime>2010-02-26T02:05:00</DepartureDateTime><FlightNumber>4131</FlightNumber><MarketingAirlineCode>BD</MarketingAirlineCode><OperatingAirlineCode>BD</OperatingAirlineCode><OperatingAirlineName>British Midland</OperatingAirlineName><OperatingAirlineFlightNumber>4131</OperatingAirlineFlightNumber><NumStops>0</NumStops><LinkSellAgrmnt></LinkSellAgrmnt><Conx>N</Conx><AirpChg>N</AirpChg><InsideAvailOption>C</InsideAvailOption><GenTrafRestriction>?</GenTrafRestriction><DaysOperates>NA</DaysOperates><JrnyTm></JrnyTm><EndDt></EndDt><StartTerminal></StartTerminal><EndTerminal></EndTerminal><FltTm>0</FltTm><LSAInd>R</LSAInd><Mile>0</Mile><BookingClass><Availability>9</Availability><BIC>Y</BIC></BookingClass><BookingClassFare><bookingclass>Y</bookingclass><classType>Economy</classType><farebasiscode>rb8QAsvpFIPpZo9gBUBg+6BMOP0MtJ7L</farebasiscode><Rule></Rule><PsgrBreakup><PsgrAry><Psgr><PsgrType>ADT</PsgrType><BaseFare>85035</BaseFare><Tax>4079</Tax><BagInfo></BagInfo></Psgr></PsgrAry></PsgrBreakup></BookingClassFare></FlightSegment><FlightSegment><AirEquipType>346</AirEquipType><ArrivalAirportCode>JFK</ArrivalAirportCode><ArrivalAirportName>NEW YORK&lt;BR&gt; (JOHN F KENNEDY INTL)</ArrivalAirportName><ArrivalDateTime>2010-02-26T12:20:00</ArrivalDateTime><DepartureAirportCode>LHR</DepartureAirportCode><DepartureAirportName>LONDON&lt;BR&gt; (HEATHROW)</DepartureAirportName><DepartureDateTime>2010-02-26T09:20:00</DepartureDateTime><FlightNumber>8223</FlightNumber><MarketingAirlineCode>CO</MarketingAirlineCode><OperatingAirlineCode>CO</OperatingAirlineCode><OperatingAirlineName>Continental Airlines </OperatingAirlineName><OperatingAirlineFlightNumber>8223</OperatingAirlineFlightNumber><NumStops>0</NumStops><LinkSellAgrmnt></LinkSellAgrmnt><Conx>N</Conx><AirpChg>N</AirpChg><InsideAvailOption>C</InsideAvailOption><GenTrafRestriction>?</GenTrafRestriction><DaysOperates>NA</DaysOperates><JrnyTm></JrnyTm><EndDt></EndDt><StartTerminal></StartTerminal><EndTerminal></EndTerminal><FltTm>0</FltTm><LSAInd>R</LSAInd><Mile>0</Mile><BookingClass><Availability>4</Availability><BIC>L</BIC></BookingClass><BookingClassFare><bookingclass>L</bookingclass><classType>Economy</classType><farebasiscode>rb8QAsvpFIPpZo9gBUBg+6BMOP0MtJ7L</farebasiscode><Rule></Rule><PsgrBreakup><PsgrAry><Psgr><PsgrType>ADT</PsgrType><BaseFare>85035</BaseFare><Tax>4079</Tax><BagInfo></BagInfo></Psgr></PsgrAry></PsgrBreakup></BookingClassFare></FlightSegment></FlightSegments></onward><Return/><id>arzoo100</id><key>ayCbutV8CZjQweTiPhdGIT52/cnXSmDtWDF6uoVa0Yx+dIrODcZqUYV1i7vZuywrXxtmsFOjbi9n4urlPHf4zxGFVKSEVPuglBZfw/aOkGOFdYu72bssKyww8nhfPbQTtwJT+FL3EYT6Z0r5IgK9i8O9cVe5sN0jK6gQR/0VsA3jPu65QFu4leESvkw2tYVo0MHk4j4XRiFoKIn0f2tgo+sVQZmUH8fjjct7YYgqWIoUUZ48kBq4e/0pg3DmQVVVo2Q3a0AUQSXLUP1Wu6PBd4V1i7vZuywrSdRter3iPenjPu65QFu4lbsv+JV45WPGtyljvg7883Sh2gnY0OmCJCn868u75ToLhXWLu9m7LCuMmusGneSEdRuxNaSOsudhnGqNtXQ916PjPu65QFu4lU2r9RVG+D9a0MHk4j4XRiFoKIn0f2tgozK2rkfhSWEWx6xZaH0ssx82RPW27flqmu5f2a5HBe02z/lJy0jWbT0M1G6o3Y+hzWfi6uU8d/jPAJdXKqYIvc5G93zQPY0iVQD8L1fsyfdm6xVBmZQfx+ONy3thiCpYihlAiI3xsTJF4z7uuUBbuJUEGsOfbTr3UF/rxHYOApxUsDfYCka6IQumFoD34DG1PbcCU/hS9xGEMwKsr63khSb3Qspj6nxBZe9bfmEZ7GUgEriX6+12U2wkVz4JY1XabcCU/hS9xGEcUGtscRHmuLDvXFXubDdIz12g5QheQXO4z7uuUBbuJVmadCAqLb2y2fi6uU8d/jPS1i6Qoti3wtoJoL9ZE4l6rEu1ZiKp4vJfk8fwf1jcc9f68R2DgKcVK1lGTAnSPxSl9HJUgz+eC+FdYu72bssKzNAqSxshbWRYUz9VFYzmixqeExNPowVA78GaMTl9BYe0fUDu2DE3rHDvXFXubDdI3dYiTg2zkNgU+gGkoFGtlfAPC2FpjoIsV/rxHYOApxURZOpRI/EzoEVg7MnTiMjPoV1i7vZuywrp7AOSJb8tei2GAYztr4tGO6Udvv6goYtX+vEdg4CnFThuwJPu5BuYitpzzDzl21bJ/v5/y98kwILsR2pjhA21YV1i7vZuywrGJgEwhHzH+9n4urlPHf4zwMsIQITsGsy0MHk4j4XRiFoKIn0f2tgowznwUkbWS71w71xV7mw3SOi9DZLo5De59CaB/YiXgfO40U/DdrAcfnP5jcg4z9RPIZB8/lb/sd5w71xV7mw3SNZoQyFRfkMl+M+7rlAW7iVOm7uM/9yhhNn4urlPHf4z7kR+x0lYQ5LX+vEdg4CnFRKt+2PZYo+CjOuGPE4fK4oZ+Lq5Tx3+M9KeFGbag7+buM+7rlAW7iVdKLgjh+EGg8Mv3JUr8Yz2NNESEN0N1nFqHicn8G1rgW8dJypOMfNAYV1i7vZuywrLDDyeF89tBO3AlP4UvcRhPpnSvkiAr2L00RIQ3Q3WcWoeJyfwbWuBfSvd+pfPzkTw71xV7mw3SNdcG/zHitfN1rAgZFeAikBjct7YYgqWIpXyYBKr/eg5uM+7rlAW7iVygQsiztYTQ9f68R2DgKcVBCq+RQJHE/z</key></OriginDestinationOption><telePhone><phoneNumber>9879961339</phoneNumber></telePhone><email><emailAddress>[email protected]</emailAddress></email><noadults>1</noadults><nochild>0</nochild><noinfant>0</noinfant><Clientid>Given By Arzoo.com</Clientid><Clienttype>ArzooINTLWS1.0</Clienttype><creditcardno>1234567890123456</creditcardno><error></error><personName><CustomerInfo><givenName>Sagar</givenName><surName>Arora</surName><nameReference>Mr.</nameReference><psgrtype>adt</psgrtype></CustomerInfo></personName><status>SUCCESS</status><transid>A396009</transid></Bookingresponse>";

                //   XmlDocument doc = new XmlDocument();
                //   doc.LoadXml(result);
                //   XmlNodeReader xmlReader = new XmlNodeReader(doc);

                //   ds.ReadXml(xmlReader);

            }
        }

        catch (Exception ex)
        {
            if (ex.Message.Contains("409"))
            {
                lblerror.Text = "Please contact administrator";
                lblerror.Visible = true;
            }
        }
        return ds;
    }
        public bool UpdateDomesticFlightCancelStatus(FlightBAL objFlightBAL)
        {
            try
            {
                ObjDAL = new clsDataLayer();
                SqlParameter[] p = new SqlParameter[9];
                p[0] = new SqlParameter("@tableName", "UpdateCancelStatus");
                p[1] = new SqlParameter("@TransId", objFlightBAL.TransId);
                p[2] = new SqlParameter("@Status", objFlightBAL.Status);
                p[3] = new SqlParameter("@CancellationProcessDateTime", objFlightBAL.CancellationProcessDateTime);
                p[4] = new SqlParameter("@CancellationCharges", objFlightBAL.CancellationCharges);
                p[5] = new SqlParameter("@RefundStatus", objFlightBAL.RefundStatus);
                p[6] = new SqlParameter("@FinalRefundAmount", objFlightBAL.FinalRefundAmount);
                p[7] = new SqlParameter("@RefundDateTime", objFlightBAL.RefundDateTime);
                p[8] = new SqlParameter("@ModifiedBy", objFlightBAL.CreatedBy);

                return ObjDAL.fnExecuteStoredProcedure("sp_DomesticFlightCancel", p);
            }
            catch (Exception ex)
            {
                throw new ArgumentException(ex.Message);
            }
        }
 public bool UpdateInternationalFlightBookingStatus(FlightBAL objFlightBAL)
 {
     try
     {
         ObjDAL = new clsDataLayer();
         SqlParameter[] p = new SqlParameter[9];
         p[0] = new SqlParameter("@tableName", "UpdateBookingStatus");
         p[1] = new SqlParameter("@TransId", objFlightBAL.TransId);
         p[2] = new SqlParameter("@Status", objFlightBAL.Status);
         p[3] = new SqlParameter("@ReferenceNo", objFlightBAL.ReferenceNo);
         p[4] = new SqlParameter("@AirlinePNR", objFlightBAL.AirlinePNR);
         p[5] = new SqlParameter("@GDFPNRNo", objFlightBAL.GDFPNRNo);
         p[6] = new SqlParameter("@eticketNo", objFlightBAL.eticketNo);
         p[7] = new SqlParameter("@Flightuid", objFlightBAL.Flightuid);
         p[8] = new SqlParameter("@passuid", objFlightBAL.passuid);
         return ObjDAL.fnExecuteStoredProcedure("sp_InternationalFlightBooking", p);
     }
     catch (Exception ex)
     {
         throw new ArgumentException(ex.Message);
     }
 }
 public DataSet UpdateDomesticFlightBooking(FlightBAL objFlightBAL)
 {
     try
     {
         ObjDAL = new clsDataLayer();
         SqlParameter[] p = new SqlParameter[4];
         p[0] = new SqlParameter("@ReferenceNo", objFlightBAL.ReferenceNo);
         p[1] = new SqlParameter("@TransId", objFlightBAL.TransId);
         p[2] = new SqlParameter("@Status", objFlightBAL.Status);
         p[3] = new SqlParameter("@tableName", "UpdateDomFlightBooking");
         return ObjDAL.fnExecuteDataset("sp_DomesticFlightBooking", p);
     }
     catch (Exception ex)
     {
         throw new ArgumentException(ex.Message);
     }
 }
        //Get Airport Codes from Database
        public DataSet GetGuestReports(FlightBAL objFlightBAL)
        {
            try
            {

                ObjDAL = new clsDataLayer();

                SqlParameter[] p = new SqlParameter[4];

                p[0] = new SqlParameter("@DateOfJourney", objFlightBAL.DateOfJourney);

                p[1] = new SqlParameter("@RefNo", objFlightBAL.RefNo);

                p[2] = new SqlParameter("@TableName", objFlightBAL.TableName);

                p[3] = new SqlParameter("@DateOfIssue", objFlightBAL.DateOfIssue);

                return ObjDAL.fnExecuteDataset("sp_AllGuestReports", p);

            }

            catch (Exception ex)
            {

                throw ex;

            }
        }
    protected void btnSignIn_Click(object sender, EventArgs e)
    {
        pnlFlightTicket.Visible = false;
        pnlViewticket.Visible = false;
        pnlhotelTicket.Visible = false;
        Panel1.Visible = false;
        Panel10.Visible = false;

        if (ddlType.SelectedItem.Text == "Bus")
        {
            pnlFlightTicket.Visible = false;
            pnlViewticket.Visible = false;
            pnlhotelTicket.Visible = false;
            Panel1.Visible = true;

            try
            {
                #region Bitla
                ////objBitlaAPILayer.TicketNumber = txtMBRefNo.Text.ToString();
                ////DataSet dsBitla = objBitlaAPILayer.GetTicketDetails();
                ////GridView1.DataSource = dsBitla;
                ////GridView1.DataBind();
                //#endregion

                //#region Kesneni
                //DataSet dsKesineni = objKesineniAPILayer.CancelTickets("843254",
                //    "RajuKatare", "RajuKatare", "05/25/2012", "2,1");
                //GridView1.DataSource = dsKesineni;
                //GridView1.DataBind();
                //#endregion

                //#region AbhiBus
                //DataTable dsAbhiBus = objAbhiBusAPILayer.GetTicketInfo("RajuKatare");
                //GridView1.DataSource = dsAbhiBus;
                //GridView1.DataBind();
                #endregion
                objManabusBAL = new ClsBAL();
                objManabusBAL.manabusRefNo = txtMBRefNo.Text;
                ObjDataset = (DataSet)objManabusBAL.GetTicketIdByOnewayManabusRefNo();
                if (ObjDataset != null)
                {
                    if (ObjDataset.Tables.Count > 0)
                    {
                        if (ObjDataset.Tables[0].Rows.Count > 0)
                        {
                            string travelName = ObjDataset.Tables[0].Rows[0]["TravelOPName"].ToString();
                            string api = ObjDataset.Tables[0].Rows[0]["APIName"].ToString();
                            gvView.DataSource = ObjDataset.Tables[0];
                            GetCancellationPolicy(travelName);
                            if (api == "Kesineni")
                            {
                                imgKesineni.Visible = true;
                            }
                            gvView.DataBind();
                            Panel1.Visible = false;
                            pnlViewticket.Visible = true;
                        }
                        else
                        {
                            lblMsg.Text = "Invalid Ref NO";
                            lblMsg.ForeColor = System.Drawing.Color.Red;
                            Panel1.Visible = true;
                            pnlViewticket.Visible = false;
                        }
                    }
                    else
                    {
                        lblMsg.Text = "Invalid Ref NO";
                        lblMsg.ForeColor = System.Drawing.Color.Red;
                        Panel1.Visible = true;
                        pnlViewticket.Visible = false;
                    }
                }
                else
                {
                    lblMsg.Text = "Invalid Ref NO";
                    lblMsg.ForeColor = System.Drawing.Color.Red;
                    Panel1.Visible = true;
                    pnlViewticket.Visible = false;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {

                if (ObjDataset != null)
                {
                    ObjDataset = null;
                }

            }
        }
        else if (ddlType.SelectedItem.Text == "Flight")
        {

            pnlFlightTicket.Visible = true;
            pnlViewticket.Visible = false;
            pnlhotelTicket.Visible = false;
            Panel1.Visible = false;
            Panel10.Visible = false;

            try
            {
                DataSet dsFlights = new DataSet();
                FlightBAL objFlightsBAL = new FlightBAL();
                dsFlights = objFlightsBAL.GetDomesticFlightDetails(txtMBRefNo.Text.Trim());
                if (dsFlights.Tables[0].Rows.Count > 0)
                {
                    string customerDetails = dsFlights.Tables[0].Rows[0]["Customer_Details"].ToString();
                    string[] strArryCustDet = customerDetails.Split('|');
                    lblName.Text = strArryCustDet[0] + strArryCustDet[1] + "  " + strArryCustDet[2];
                    lblTel.Text = dsFlights.Tables[0].Rows[0]["telephone"].ToString();
                    lblEmailAddress.Text = dsFlights.Tables[0].Rows[0]["emailAddress"].ToString();
                    Session["EmailId"] = dsFlights.Tables[0].Rows[0]["emailAddress"].ToString();
                    lblPNR.Text = dsFlights.Tables[0].Rows[0]["ReferenceNo"].ToString();
                    lblOrigin.Text = dsFlights.Tables[0].Rows[0]["DepartureAirportCode"].ToString();
                    lblDestination.Text = dsFlights.Tables[0].Rows[0]["ArrivalAirportCode"].ToString();
                    lblAirlineName.Text = dsFlights.Tables[0].Rows[0]["airlineName"].ToString();
                    img.ImageUrl = dsFlights.Tables[0].Rows[0]["imageFileName"].ToString();
                    lblBookingTime.Text = dsFlights.Tables[0].Rows[0]["CreatedDate"].ToString();
                    lblFlightNumber.Text = dsFlights.Tables[0].Rows[0]["FlightNumber"].ToString();
                    string DepartureDatetime = dsFlights.Tables[0].Rows[0]["DepartureDateTime"].ToString();
                    string[] strArryDeptDatetime = DepartureDatetime.Split('T');

                    DateTime dt = Convert.ToDateTime(strArryDeptDatetime[0].ToString());
                    string date = dt.ToString("dd/MM/yyyy");
                    lblDepartureDate.Text = date.ToString();
                    // lblDepartureDate.Text = strArryDeptDatetime[0].ToString();

                    lblDepartureTime.Text = strArryDeptDatetime[1].ToString();

                    string ArrivalDatetime = dsFlights.Tables[0].Rows[0]["ArrivalDateTime"].ToString();
                    string[] strArrivalDatetime = ArrivalDatetime.Split('T');

                    DateTime dt1 = Convert.ToDateTime(strArrivalDatetime[0].ToString());
                    string date1 = dt1.ToString("dd/MM/yyyy");
                    lblArrivalDate.Text = date1.ToString();
                    // lblArrivalDate.Text = strArryDeptDatetime[0].ToString();

                    lblArrivalTime.Text = strArrivalDatetime[1].ToString();
                    lblPNRNo.Text = dsFlights.Tables[0].Rows[0]["ReferenceNo"].ToString();
                    lblAirlinePNR.Text = dsFlights.Tables[0].Rows[0]["AirlinePNR"].ToString();
                    lblPsngrMobileNo.Text = dsFlights.Tables[0].Rows[0]["telephone"].ToString();

                    string[] strCusDetArr = customerDetails.Split(';');
                    string indCustDet = string.Empty;
                    DataTable dtPsgrDet = new DataTable();
                    dtPsgrDet.Columns.Add("Name", typeof(string));
                    dtPsgrDet.Columns.Add("Type", typeof(string));
                    dtPsgrDet.Columns.Add("Age", typeof(string));

                    for (int i = 0; i < strCusDetArr.Length; i++)
                    {
                        indCustDet = strCusDetArr[i];
                        string[] strArryCustDet1 = indCustDet.Split('|');
                        DataRow dr = dtPsgrDet.NewRow();
                        dr["Name"] = strArryCustDet1[0] + strArryCustDet1[1] + "  " + strArryCustDet1[2];
                        dr["Type"] = strArryCustDet1[3];
                        dr["Age"] = "-";
                        dtPsgrDet.Rows.Add(dr);
                    }

                    gdvPassengerDetails.DataSource = dtPsgrDet;
                    gdvPassengerDetails.DataBind();
                    lblPassengerType.Text = strArryCustDet[3];
                    lblPassengerCnt.Text = strCusDetArr.Length.ToString();
                    lblBasicFare.Text = dsFlights.Tables[0].Rows[0]["ActualBasefare"].ToString();
                    lblTaxes.Text = dsFlights.Tables[0].Rows[0]["Tax"].ToString();
                    string Tcharge = dsFlights.Tables[0].Rows[0]["Tcharge"].ToString();

                    lblServiceTax.Text = (Convert.ToDouble(dsFlights.Tables[0].Rows[0]["STax"]) + Convert.ToDouble(Tcharge) + Convert.ToDouble(dsFlights.Tables[0].Rows[0]["TMarkUp"])).ToString();
                    lblTotal.Text = (Convert.ToDouble(lblTaxes.Text) + Convert.ToDouble(lblServiceTax.Text) + Convert.ToDouble(lblBasicFare.Text)).ToString();

                    //  + Convert.ToDouble(Tcharge)).ToString();
                    //- Convert.ToDouble(dsFlights.Tables[0].Rows[0]["TDiscount"].ToString())).ToString();
                    // pnlViewticket.Visible = true;
                    printroundtrip.Visible = false;

                    lblMsg.Text = "";
                    if (dsFlights.Tables[0].Rows.Count == 2)
                    {
                        //return

                        if (dsFlights.Tables[0].Rows.Count > 0)
                        {
                            lblMainMSg.Text = "";
                            printroundtrip.Visible = true;
                            lblAirlineNamereturn.Text = dsFlights.Tables[0].Rows[1]["airlineName"].ToString();
                            //img.ImageUrl = dsFlights.Tables[0].Rows[0]["imageFileName"].ToString();
                            lblFlightNumberreturn.Text = dsFlights.Tables[0].Rows[1]["FlightNumber"].ToString();
                            lblOriginRet.Text = dsFlights.Tables[0].Rows[1]["DepartureAirportCode"].ToString();
                            lblDestinationRet.Text = dsFlights.Tables[0].Rows[1]["ArrivalAirportCode"].ToString();

                            string DepartureDatetimeRet = dsFlights.Tables[0].Rows[1]["DepartureDateTime"].ToString();
                            string[] strArryDeptDatetimeRet = DepartureDatetimeRet.Split('T');
                            DateTime dt3 = Convert.ToDateTime(strArryDeptDatetimeRet[0].ToString());
                            string date3 = dt3.ToString("dd/MM/yyyy");
                            lblDepartureDatereturn.Text = date3.ToString();
                            //  lblDepartureDatereturn.Text = dt3.ToLongDateString();
                            lblDepartureTimereturn.Text = strArryDeptDatetimeRet[1].ToString();
                            string ArrivalDatetimeRet = dsFlights.Tables[0].Rows[1]["ArrivalDateTime"].ToString();
                            string[] strArrivalDatetimeRet = ArrivalDatetimeRet.Split('T');
                            DateTime dt4 = Convert.ToDateTime(strArrivalDatetimeRet[0].ToString());
                            string date4 = dt4.ToString("dd/MM/yyyy");
                            lblArrivalDatereturn.Text = date4.ToString();
                            lblArrivalTimereturn.Text = strArrivalDatetimeRet[1].ToString();
                            // lblPNRNoreturn.Text = dsFlights.Tables[0].Rows[1]["ReferenceNo"].ToString();
                            string Afareret = dsFlights.Tables[0].Rows[0]["ActualBasefareRet"].ToString();
                            string Tret = dsFlights.Tables[0].Rows[0]["TaxRet"].ToString();
                            string Sts = (Convert.ToDouble(dsFlights.Tables[0].Rows[0]["STaxRet"]) + Convert.ToDouble(dsFlights.Tables[0].Rows[0]["TchargeRet"])).ToString();
                            string totret = (Convert.ToDouble(Afareret) + Convert.ToDouble(Tret) + Convert.ToDouble(Sts)).ToString(); //+ Convert.ToDouble(dsFlights.Tables[0].Rows[0]["Tcharge"].ToString())).ToString();
                            //- Convert.ToDouble(dsFlights.Tables[0].Rows[0]["TDiscountRet"].ToString())).ToString();
                            lblBasicFare.Text = (Convert.ToDecimal(lblBasicFare.Text) + Convert.ToDecimal(Afareret)).ToString();
                            lblTaxes.Text = (Convert.ToDecimal(lblTaxes.Text) + Convert.ToDecimal(Tret)).ToString();
                            lblServiceTax.Text = (Convert.ToDecimal(lblServiceTax.Text) + Convert.ToDecimal(Sts)).ToString();
                            lblTotal.Text = (Convert.ToDecimal(lblTotal.Text) + Convert.ToDecimal(totret)).ToString("####0.00");
                        }

                    }
                }
                else
                {
                    lblMsg.Text = "Invalid Reference No";
                    lblMsg.ForeColor = System.Drawing.Color.Red;
                    pnlViewticket.Visible = false;
                }

            }
            catch (Exception ex)
            {

                throw;
            }

        }
        else if (ddlType.SelectedItem.Text == "Hotel")
        {
            pnlFlightTicket.Visible = false;
            pnlViewticket.Visible = false;
            pnlhotelTicket.Visible = true;
            Panel1.Visible = false;
            Panel10.Visible = false;

            try
            {
                HotelBAL objTicket = new HotelBAL();
                objTicket.ReferenceNo = txtMBRefNo.Text.ToString().Trim().ToString();
                DataSet dsTicket = objTicket.GetHotelProvisional();
                if (dsTicket == null) { lblMsg.Text = "Invalid Ref No."; return; }
                if (dsTicket.Tables.Count == 0) { lblMsg.Text = "Invalid Ref No."; return; }
                if (dsTicket.Tables[0].Rows.Count == 0) { lblMsg.Text = "Invalid Ref No."; return; }
                DataRow drTicketRow = dsTicket.Tables[0].Rows[0];
                lblHotelRefNo.Text = drTicketRow["ReferenceNo"].ToString();
                lblStatus.Text = drTicketRow["Status"].ToString();
                lblHotelName.Text = drTicketRow["HotelName"].ToString();
                lblarzoorefno.Text = drTicketRow["BookingRefNo"].ToString();

                lblAddress.Text = drTicketRow["HotelAddress"].ToString();

                lblHotelCity.Text = drTicketRow["HotelCity"].ToString();
                lblCheckIn.Text = drTicketRow["CheckInDate"].ToString();
                lblCheckOut.Text = drTicketRow["CheckOutDate"].ToString();
                lblRoomType.Text = drTicketRow["RoomType"].ToString();

                lblStar.Text = drTicketRow["HotelStar"].ToString() + " Star";

                lblNoOfRooms.Text = drTicketRow["NoOfRooms"].ToString();
                lblPaxGreaterThan12.Text = drTicketRow["NoOfAdults"].ToString();
                lblPaxLessThan12.Text = drTicketRow["NoOfChildren"].ToString();

                lblBookedDate.Text = drTicketRow["BookedDate"].ToString();
                lblHotelContactDetails.Text = drTicketRow["ContactNumbers"].ToString() + " , Fax Nos: " + drTicketRow["FaxNumbers"].ToString();

                lblTotalPrice.Text = drTicketRow["HotelTotalFare"].ToString() + "~" + drTicketRow["HotelTotlaFareDetails"].ToString();/////////////

                lblTitle.Text = drTicketRow["Title"].ToString();
                lblFirstName.Text = drTicketRow["FirstName"].ToString();
                lblMiddleName.Text = drTicketRow["MiddleName"].ToString();
                lblLastName.Text = drTicketRow["LastName"].ToString();
                lblMobileNo.Text = drTicketRow["MobileNumber"].ToString();
                lblEmailId.Text = drTicketRow["EmailId"].ToString();
                lblAdd.Text = drTicketRow["CustAddressLine"].ToString();
                lblState.Text = drTicketRow["CustState"].ToString();
                lblPinCode.Text = drTicketRow["CustZipCode"].ToString();

                lblCity.Text = drTicketRow["CustCity"].ToString();

            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.Message;

                throw;
            }
        }

        else if (ddlType.SelectedItem.Text == "Cabs")
        {
            pnlFlightTicket.Visible = false;
            pnlViewticket.Visible = false;
            pnlhotelTicket.Visible = false;
            Panel1.Visible = false;
            Panel10.Visible = false;
            pnlCabTicket.Visible = true;
            Panel2.Visible = true;

            try
            {
                FlightBAL objFlightsBAL = new FlightBAL();
                DataSet dsFlights = new DataSet();
                dsFlights = objFlightsBAL.GetCarDetaisl(txtMBRefNo.Text, "");
                if (dsFlights.Tables[0].Rows.Count > 0)
                {

                    //lblCarName.Text = dsFlights.Tables[0].Rows[1]["CarName"].ToString();
                    lblCarRefNo.Text = dsFlights.Tables[0].Rows[0]["ReferanceId"].ToString();
                    lblCabstatus.Text = dsFlights.Tables[0].Rows[0]["Status"].ToString();
                    //if (dsFlights.Tables[0].Rows[0]["ReferenceNo"].ToString() == "1")
                    //{
                    //    lblStatus.Text ="Booked";
                    //}

                    lblCabAddress.Text = dsFlights.Tables[0].Rows[0]["Address"].ToString();
                    lblCity1.Text = dsFlights.Tables[0].Rows[0]["City_Car"].ToString();
                    lblJourneyDate.Text = dsFlights.Tables[0].Rows[0]["TravelDate"].ToString();
                    lblCabName.Text = dsFlights.Tables[0].Rows[0]["CarName"].ToString();
                    lblCabMobile.Text = dsFlights.Tables[0].Rows[0]["MobileNo"].ToString();
                    lblCabEmail.Text = dsFlights.Tables[0].Rows[0]["EmailId"].ToString();
                    lblCabAddress1.Text = dsFlights.Tables[0].Rows[0]["Address"].ToString();
                    lblCabCity.Text = dsFlights.Tables[0].Rows[0]["City"].ToString();
                    lblCabPincode.Text = dsFlights.Tables[0].Rows[0]["ZipCode"].ToString();
                    lblCabState.Text = dsFlights.Tables[0].Rows[0]["State"].ToString();
                    lblPickupTime.Text = dsFlights.Tables[0].Rows[0]["PickupTime"].ToString();
                    lblCarName.Text = dsFlights.Tables[0].Rows[0]["CarName"].ToString();

                }
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.Message;

                throw;
            }
        }
    }
 public DataSet GetAgentFlights(FlightBAL objFlightBAL)
 {
     try
     {
         ObjDAL = new clsDataLayer();
         SqlParameter[] p = new SqlParameter[2];
         p[0] = new SqlParameter("@TableName", objFlightBAL.FlightName);
         p[1] = new SqlParameter("@userid", objFlightBAL.CreatedBy);
         return ObjDAL.fnExecuteDataset("SP_GetAgentReport", p);
     }
     catch (Exception ex)
     {
         throw new ArgumentException(ex.Message);
     }
 }
        public bool UpdateInternationalFlightSegment(FlightBAL objFlightBAL)
        {
            try
            {
                ObjDAL = new clsDataLayer();
                SqlParameter[] p = new SqlParameter[10];

                p[0] = new SqlParameter("@bookingclass", objFlightBAL.bookingClass);
                p[1] = new SqlParameter("@classType", objFlightBAL.ClassType);
                p[2] = new SqlParameter("@farebasiscode", objFlightBAL.farebasisCode);
                p[3] = new SqlParameter("@Fare_Rule", objFlightBAL.Fare_Rule);
                p[4] = new SqlParameter("@PsgrType", objFlightBAL.PsgrType);
                p[5] = new SqlParameter("@BaseFare", objFlightBAL.BaseFare);
                p[6] = new SqlParameter("@psgrTax", objFlightBAL.psgrTax);
                p[7] = new SqlParameter("@BagInfo", objFlightBAL.BagInfo);
                p[8] = new SqlParameter("@FlightBookingID", objFlightBAL.FlightBookingID);
                p[9] = new SqlParameter("@tableName", "UpdateIntFlightSegment");
                return ObjDAL.fnExecuteStoredProcedure("sp_InternationalFlightSegments", p);
            }
            catch (Exception ex)
            {
                throw new ArgumentException(ex.Message);
            }
        }
        public DataSet GetAgentFlightSearch(FlightBAL objFlightBAL)
        {
            try
            {
                ObjDAL = new clsDataLayer();
                SqlParameter[] p = new SqlParameter[13];
                p[0] = new SqlParameter("@Source", objFlightBAL.Source);
                p[1] = new SqlParameter("@Destinations", objFlightBAL.Destinations);
                p[2] = new SqlParameter("@DateOfJourney", objFlightBAL.DateOfJourney);
                p[3] = new SqlParameter("@DateOfIssue", objFlightBAL.DateOfIssue);
                p[4] = new SqlParameter("@Name", objFlightBAL.Name);
                p[5] = new SqlParameter("@EmailId", objFlightBAL.EmailId);
                p[6] = new SqlParameter("@RefNo", objFlightBAL.RefNo);
                p[7] = new SqlParameter("@Operator", objFlightBAL.Operator);
                p[8] = new SqlParameter("@ContactNo", objFlightBAL.ContactNo);
                p[9] = new SqlParameter("@Status", objFlightBAL.Status);
                //p[10] = new SqlParameter("@PageSize", objFlightBAL.PageSize);
                p[10] = new SqlParameter("@TableName", objFlightBAL.TableName);
                p[11] = new SqlParameter("@FlightName", objFlightBAL.FlightName);
                p[12] = new SqlParameter("@userid", objFlightBAL.CreatedBy);
                return ObjDAL.fnExecuteDataset("SP_GetAgentReport", p);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
        public DataTable AddDInternationalFlightBooking(FlightBAL objFlightBAL)
        {
            try
            {
                ObjDAL = new clsDataLayer();
                SqlParameter[] p = new SqlParameter[24];
                p[0] = new SqlParameter("@ReferenceNo", objFlightBAL.ReferenceNo);
                p[1] = new SqlParameter("@TransId", objFlightBAL.TransId);
                p[2] = new SqlParameter("@Status", objFlightBAL.Status);
                p[3] = new SqlParameter("@AdultPax", objFlightBAL.AdultPax);
                p[4] = new SqlParameter("@InfantPax", objFlightBAL.InfantPax);
                p[5] = new SqlParameter("@ChildPax", objFlightBAL.ChildPax);
                p[6] = new SqlParameter("@Origin_Destination_Id", objFlightBAL.Origin_Destination_Id);
                p[7] = new SqlParameter("@Origin_Destination_Key", objFlightBAL.Origin_Destination_Key);
                p[8] = new SqlParameter("@ActualBasefare", objFlightBAL.ActualBasefare);
                p[9] = new SqlParameter("@Tax", objFlightBAL.Tax);
                p[10] = new SqlParameter("@STax", objFlightBAL.STax);
                p[11] = new SqlParameter("@Scharge", objFlightBAL.Scharge);
                p[12] = new SqlParameter("@TDiscount", objFlightBAL.TDiscount);
                p[13] = new SqlParameter("@TPartnerCommission", objFlightBAL.TPartnerCommission);
                p[14] = new SqlParameter("@TCharge", objFlightBAL.TCharge);
                p[15] = new SqlParameter("@TMarkUp", objFlightBAL.TMarkUp);
                p[16] = new SqlParameter("@TSDiscount", objFlightBAL.TSDiscount);
                p[17] = new SqlParameter("@tableName", "InsertIntFlightBooking");
                p[18] = new SqlParameter("@CreatedBy", objFlightBAL.CreatedBy);
                p[19] = new SqlParameter("@TripMode", objFlightBAL.TripMode);
                p[20] = new SqlParameter("@Octax", objFlightBAL.ocTax);

                p[21] = new SqlParameter("@Return1", objFlightBAL.Return);
                p[22] = new SqlParameter("@id", objFlightBAL.id);
                p[23] = new SqlParameter("@Key", objFlightBAL.key);
                //p[18] = new SqlParameter("@FlightBookingID",SqlDbType.Int);
                //p[18].Direction = ParameterDirection.Output;
                return ObjDAL.fnExecuteDataSet("sp_InternationalFlightBooking", p).Tables[0];
            }
            catch (Exception ex)
            {
                throw new ArgumentException(ex.Message);
            }
        }
    protected void GetBookingStatus(string ReferenceNo)
    {
        try
        {
            string AirlinePNR = string.Empty; // ConfirmationId
            string GDFPNRNumber = string.Empty; //PNRNumber
            string eticketNo = string.Empty;
            string flightUid = string.Empty;
            string passuid = string.Empty;

            FlightBAL objFlightBal = new FlightBAL();
            DataSet dsGetTransId = new DataSet();
            dsGetTransId = objFlightBal.GetTransID(ReferenceNo);
            transId = dsGetTransId.Tables[0].Rows[0]["transid"].ToString();
            //remove
            //  transId = "A015663";
            if (transId != "")
            {
                String xmlRequestData = "<EticketRequest><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooFWS1.1</Clienttype><transid>" + transId + "</transid><partnerRefId>100214</partnerRefId></EticketRequest>";
                DataSet dsFlightBookStatus = objFlights.GetBookingStatusDetails(xmlRequestData);

                if (dsFlightBookStatus.Tables.Contains("requestedPNR"))
                {
                    DataTable dtOriDestPNRRequest = dsFlightBookStatus.Tables["OriDestPNRRequest"];
                    for (int i = 0; i < dtOriDestPNRRequest.Rows.Count; i++)
                    {
                        AirlinePNR = (AirlinePNR == string.Empty) ? dtOriDestPNRRequest.Rows[i]["confirmationid"].ToString() : AirlinePNR + "|" + dtOriDestPNRRequest.Rows[i]["confirmationid"].ToString();
                        GDFPNRNumber = (GDFPNRNumber == string.Empty) ? dtOriDestPNRRequest.Rows[i]["pnrnumber"].ToString() : AirlinePNR + "|" + dtOriDestPNRRequest.Rows[i]["pnrnumber"].ToString();
                    }

                    DataTable dtETicket = dsFlightBookStatus.Tables["ETicket"];
                    for (int i = 0; i < dtETicket.Rows.Count; i++)
                    {
                        eticketNo = (eticketNo == string.Empty) ? dtETicket.Rows[i]["eticketNo"].ToString() : eticketNo + "|" + dtETicket.Rows[i]["eticketNo"].ToString();
                        flightUid = (flightUid == string.Empty) ? dtETicket.Rows[i]["flightuid"].ToString() : flightUid + "|" + dtETicket.Rows[i]["flightuid"].ToString();
                        passuid = (passuid == string.Empty) ? dtETicket.Rows[i]["passuid"].ToString() : passuid + "|" + dtETicket.Rows[i]["passuid"].ToString();
                    }

                    objFlightBal.AirlinePNR = AirlinePNR;
                    objFlightBal.GDFPNRNo = GDFPNRNumber;
                    objFlightBal.eticketNo = eticketNo;
                    objFlightBal.Flightuid = flightUid;
                    objFlightBal.passuid = passuid;
                    objFlightBal.Status = dsFlightBookStatus.Tables["requestedPNR"].Rows[0]["status"].ToString();
                    //remove
                    //dsGetTransId = objFlightBal.GetTransID(ReferenceNo);
                    //transId = dsGetTransId.Tables[0].Rows[0]["transid"].ToString();
                    //remove
                    objFlightBal.TransId = transId;
                    objFlightBal.ReferenceNo = ReferenceNo;

                    if (objFlightBal.Status == "SUCCESS")
                    {
                        statusCnt++;
                        if (statusCnt < 3)
                        {
                            GetBookingStatus(ReferenceNo);
                        }
                        else
                        {
                            bool res = objFlightBal.UpdateDomesticFlightBookingStatus(objFlightBal);
                            if (res)
                            {
                                lblStatus.Text = "Updated the status";
                                lblStatus.ForeColor = System.Drawing.Color.Green;
                            }
                        }

                    }
                    else
                    {
                        bool res = objFlightBal.UpdateDomesticFlightBookingStatus(objFlightBal);
                        if (res)
                        {
                            lblStatus.Text = "Updated the status";
                            lblStatus.ForeColor = System.Drawing.Color.Green;
                        }
                    }
                }
                else
                {
                    string status = dsFlightBookStatus.Tables[0].Rows[0]["Status"].ToString();
                    if (status == "SUCCESS")
                    {
                        lblStatus.Text = "Your Ticket is still under booking process";
                    }
                }
            }
            else
            {

                lblStatus.Text = "Invalid Request";
            }

        }
        catch (Exception ex)
        {

        }
    }
 public DataTable AddDomesticFlightBooking(FlightBAL objFlightBAL)
 {
     try
     {
         ObjDAL = new clsDataLayer();
         SqlParameter[] p = new SqlParameter[38];
         p[0] = new SqlParameter("@ReferenceNo", objFlightBAL.ReferenceNo);
         p[1] = new SqlParameter("@TransId", objFlightBAL.TransId);
         p[2] = new SqlParameter("@Status", objFlightBAL.Status);
         p[3] = new SqlParameter("@AdultPax", objFlightBAL.AdultPax);
         p[4] = new SqlParameter("@InfantPax", objFlightBAL.InfantPax);
         p[5] = new SqlParameter("@ChildPax", objFlightBAL.ChildPax);
         p[6] = new SqlParameter("@Origin_Destination_Id", objFlightBAL.Origin_Destination_Id);
         p[7] = new SqlParameter("@Origin_Destination_Key", objFlightBAL.Origin_Destination_Key);
         p[8] = new SqlParameter("@ActualBasefare", objFlightBAL.ActualBasefare);
         p[9] = new SqlParameter("@Tax", objFlightBAL.Tax);
         p[10] = new SqlParameter("@STax", objFlightBAL.STax);
         p[11] = new SqlParameter("@Scharge", objFlightBAL.Scharge);
         p[12] = new SqlParameter("@TDiscount", objFlightBAL.TDiscount);
         p[13] = new SqlParameter("@TPartnerCommission", objFlightBAL.TPartnerCommission);
         p[14] = new SqlParameter("@TCharge", objFlightBAL.TCharge);
         p[15] = new SqlParameter("@TMarkUp", objFlightBAL.TMarkUp);
         p[16] = new SqlParameter("@TSDiscount", objFlightBAL.TSDiscount);
         p[17] = new SqlParameter("@Customer_Details", objFlightBAL.Customer_Details);
         p[18] = new SqlParameter("@telephone", objFlightBAL.telephone);
         p[19] = new SqlParameter("@emailAddress", objFlightBAL.emailAddress);
         p[20] = new SqlParameter("@tableName", "InsertDomFlightBooking");
         p[21] = new SqlParameter("@CreatedBy", objFlightBAL.CreatedBy);
         p[22] = new SqlParameter("@TripMode", objFlightBAL.TripMode);
         p[23] = new SqlParameter("@address", objFlightBAL.Address);
         p[24] = new SqlParameter("@Type", objFlightBAL.Type);
         p[25] = new SqlParameter("@id", objFlightBAL.id);
         p[26] = new SqlParameter("@key", objFlightBAL.key);
         p[27] = new SqlParameter("@ActualBasefareRet", objFlightBAL.ActualBasefareRet);
         p[28] = new SqlParameter("@TaxRet", objFlightBAL.TaxRet);
         p[29] = new SqlParameter("@STaxRet", objFlightBAL.STaxRet);
         p[30] = new SqlParameter("@SchargeRet", objFlightBAL.SchargeRet);
         p[31] = new SqlParameter("@TDiscountRet", objFlightBAL.TDiscountRet);
         p[32] = new SqlParameter("@TPartnerCommissionRet", objFlightBAL.TPartnerCommissionRet);
         p[33] = new SqlParameter("@TChargeRet", objFlightBAL.TChargeRet);
         p[34] = new SqlParameter("@TMarkUpRet", objFlightBAL.TMarkUpRet);
         p[35] = new SqlParameter("@TSDiscountRet", objFlightBAL.TSDiscountRet);
         p[36] = new SqlParameter("@idRet", objFlightBAL.idRet);
         p[37] = new SqlParameter("@keyRet", objFlightBAL.keyRet);
         return ObjDAL.fnExecuteDataSet("sp_DomesticFlightBooking", p).Tables[0];
     }
     catch (Exception ex)
     {
         throw new ArgumentException(ex.Message);
     }
 }
    protected void btnSignInInt_Click(object sender, EventArgs e)
    {
        try
        {
            FlightBAL objFlightsBAL = new FlightBAL();
            DataSet dsFlights = new DataSet();
            dsFlights = objFlightsBAL.GetInternationalFlightDetails(txtRefNo.Text.Trim());
            if (dsFlights.Tables[0].Rows.Count > 0)
            {
                string customerDetails = dsFlights.Tables[0].Rows[0]["CustomerDetails"].ToString();
                string[] strArryCustDet = customerDetails.Split('|');
                lblName.Text = strArryCustDet[0] + strArryCustDet[1] + "  " + strArryCustDet[2];
                lblTel.Text = dsFlights.Tables[0].Rows[0]["Telephone"].ToString();
                lblEmailAddress.Text = dsFlights.Tables[0].Rows[0]["EmailAddress"].ToString();
                lblPNR.Text = dsFlights.Tables[0].Rows[0]["ReferenceNo"].ToString();
                lblOrigin.Text = dsFlights.Tables[0].Rows[0]["DepartureAirportName"].ToString();
                lblDestination.Text = dsFlights.Tables[0].Rows[0]["ArrivalAirportName"].ToString();
                lblAirlineName.Text = dsFlights.Tables[0].Rows[0]["OperatingAirlineName"].ToString();

                //img.ImageUrl = dsFlights.Tables[0].Rows[0]["imageFileName"].ToString();
                lblFlightNumber.Text = dsFlights.Tables[0].Rows[0]["FlightNumber"].ToString();
               lblBookingTime.Text = dsFlights.Tables[0].Rows[0]["CreatedDate"].ToString();
                string DepartureDatetime = dsFlights.Tables[0].Rows[0]["DepartureDateTime"].ToString();
                string[] strArryDeptDatetime = DepartureDatetime.Split('T');

                DateTime dt = Convert.ToDateTime(strArryDeptDatetime[0].ToString());
                string date = dt.ToString("dd/MM/yyyy");
                lblDepartureDate.Text = date.ToString();

              //  lblDepartureDate.Text = strArryDeptDatetime[0].ToString();
                lblDepartureTime.Text = strArryDeptDatetime[1].ToString();
                string ArrivalDatetime = dsFlights.Tables[0].Rows[0]["ArrivalDateTime"].ToString();
                string[] strArrivalDatetime = ArrivalDatetime.Split('T');

                DateTime dt1 = Convert.ToDateTime(strArrivalDatetime[0].ToString());
                string date1 = dt1.ToString("dd/MM/yyyy");
                lblArrivalDate.Text = date1.ToString();

               // lblArrivalDate.Text = strArryDeptDatetime[0].ToString();
                lblArrivalTime.Text = strArrivalDatetime[1].ToString();
                lblPNRNo.Text = dsFlights.Tables[0].Rows[0]["ReferenceNo"].ToString();
                lblAirlinePNR.Text = dsFlights.Tables[0].Rows[0]["AirlinePNR"].ToString();
                lblPsngrMobileNo.Text = dsFlights.Tables[0].Rows[0]["Telephone"].ToString();

                string[] strCusDetArr = customerDetails.Split(';');
                string indCustDet = string.Empty;
                DataTable dtPsgrDet = new DataTable();
                dtPsgrDet.Columns.Add("Name", typeof(string));
                dtPsgrDet.Columns.Add("Type", typeof(string));
                dtPsgrDet.Columns.Add("Age", typeof(string));

                for (int i = 0; i < strCusDetArr.Length; i++)
                {
                    indCustDet = strCusDetArr[i];
                    string[] strArryCustDet1 = indCustDet.Split('|');
                    DataRow dr = dtPsgrDet.NewRow();
                    dr["Name"] = strArryCustDet1[0] + strArryCustDet1[1] + "  " + strArryCustDet1[2];
                    dr["Type"] = strArryCustDet1[3];
                    dr["Age"] = "-";
                    dtPsgrDet.Rows.Add(dr);
                }

                gdvPassengerDetails.DataSource = dtPsgrDet;
                gdvPassengerDetails.DataBind();
                lblPassengerType.Text = strArryCustDet[3];
                lblPassengerCnt.Text = strCusDetArr.Length.ToString();
                lblBasicFare.Text = dsFlights.Tables[0].Rows[0]["ActualBasefare"].ToString();
                lblTaxes.Text = dsFlights.Tables[0].Rows[0]["Tax"].ToString();

                lblServiceTax.Text = (Convert.ToDouble(dsFlights.Tables[0].Rows[0]["STax"])).ToString(); //+ Convert.ToDouble(dsFlights.Tables[0].Rows[0]["Tcharge"])).ToString();
                lblTotal.Text = (Convert.ToDouble(lblBasicFare.Text) + (Convert.ToDouble(lblTaxes.Text) + Convert.ToDouble(lblServiceTax.Text))).ToString(); //- Convert.ToDouble(dsFlights.Tables[0].Rows[0]["TDiscount"].ToString())).ToString();
                pnlViewticket.Visible = true;
                printroundtrip.Visible = false;
                if (dsFlights.Tables[0].Rows.Count == 2)
                {
                    //return

                    if (dsFlights.Tables[0].Rows.Count > 0)
                    {
                        lblMainMSg.Text = "";
                        printroundtrip.Visible = true;
                        lblAirlineNamereturn.Text = dsFlights.Tables[0].Rows[1]["OperatingAirlineName"].ToString();
                        //img.ImageUrl = dsFlights.Tables[0].Rows[0]["imageFileName"].ToString();
                        lblFlightNumberreturn.Text = dsFlights.Tables[0].Rows[1]["FlightNumber"].ToString();

                        lblOriginRet.Text = dsFlights.Tables[0].Rows[1]["DepartureAirportCode"].ToString();
                        lblDestinationRet.Text = dsFlights.Tables[0].Rows[1]["ArrivalAirportCode"].ToString();

                        string DepartureDatetimeRet = dsFlights.Tables[0].Rows[1]["DepartureDateTime"].ToString();
                        string[] strArryDeptDatetimeRet = DepartureDatetimeRet.Split('T');
                        DateTime dt3 = Convert.ToDateTime(strArryDeptDatetimeRet[0].ToString());
                        string date3 = dt3.ToString("dd/MM/yyyy");
                        lblDepartureDatereturn.Text = date3.ToString();
                        lblDepartureTimereturn.Text = strArryDeptDatetimeRet[1].ToString();
                        string ArrivalDatetimeRet = dsFlights.Tables[0].Rows[1]["ArrivalDateTime"].ToString();
                        string[] strArrivalDatetimeRet = ArrivalDatetimeRet.Split('T');
                        DateTime dt4 = Convert.ToDateTime(strArrivalDatetimeRet[0].ToString());
                        string date4 = dt4.ToString("dd/MM/yyyy");
                        lblArrivalDatereturn.Text = date4.ToString();
                        lblArrivalTimereturn.Text = strArrivalDatetimeRet[1].ToString();
                        // lblPNRNoreturn.Text = dsFlights.Tables[0].Rows[1]["ReferenceNo"].ToString();

                        //string Afareret = dsFlights.Tables[0].Rows[0]["ActualBasefareRet"].ToString();
                        //string Tret = dsFlights.Tables[0].Rows[0]["TaxRet"].ToString();
                        //string Sts = (Convert.ToDouble(dsFlights.Tables[0].Rows[0]["STaxRet"]) + Convert.ToDouble(dsFlights.Tables[0].Rows[0]["SchargeRet"])).ToString();
                        //string totret = (Convert.ToDouble(Afareret) + Convert.ToDouble(Tret) + Convert.ToDouble(Sts) - Convert.ToDouble(dsFlights.Tables[0].Rows[0]["TDiscountRet"].ToString())).ToString();
                        //lblBasicFare.Text = (Convert.ToDecimal(lblBasicFare.Text) + Convert.ToDecimal(Afareret)).ToString();
                        //lblTaxes.Text = (Convert.ToDecimal(lblTaxes.Text) + Convert.ToDecimal(Tret)).ToString();
                        //lblServiceTax.Text = (Convert.ToDecimal(lblServiceTax.Text) + Convert.ToDecimal(Sts)).ToString();
                        //lblTotal.Text = (Convert.ToDecimal(lblTotal.Text) + Convert.ToDecimal(totret)).ToString("####0.00");

                    }

                }

            }
            else
            {
                pnlViewticket.Visible = false;
                lblMsg.Text = "Invalid Request";
                lblMsg.ForeColor = System.Drawing.Color.Red;
            }
        }
        catch (Exception ex)
        {

            throw;
        }
    }
        public bool AddDomesticFlightBookingsegments(FlightBAL objFlightBAL)
        {
            try
            {
                ObjDAL = new clsDataLayer();
                SqlParameter[] p = new SqlParameter[35];
                p[0] = new SqlParameter("@AirEquipType", objFlightBAL.AirEquipType);
                p[1] = new SqlParameter("@ArrivalAirportCode", objFlightBAL.ArrivalAirportCode);
                p[2] = new SqlParameter("@ArrivalDateTime", objFlightBAL.ArrivalDateTime);
                p[3] = new SqlParameter("@DepartureAirportCode", objFlightBAL.DepartureAirportCode);
                p[4] = new SqlParameter("@DepartureDateTime", objFlightBAL.DepartureDateTime);
                p[5] = new SqlParameter("@FlightNumber", objFlightBAL.FlightNumber);
                p[6] = new SqlParameter("@OperatingAirlineCode", objFlightBAL.OperatingAirlineCode);
                p[7] = new SqlParameter("@OperatingAirlineFlightNumber", objFlightBAL.OperatingAirlineFlightNumber);
                p[8] = new SqlParameter("@RPH", objFlightBAL.RPH);
                p[9] = new SqlParameter("@StopQuantity", objFlightBAL.StopQuantity);
                p[10] = new SqlParameter("@airlineName", objFlightBAL.airlineName);
                p[11] = new SqlParameter("@airportTax", objFlightBAL.airportTax);
                p[12] = new SqlParameter("@imageFileName", objFlightBAL.imageFileName);
                p[13] = new SqlParameter("@Discount", objFlightBAL.Discount);
                p[14] = new SqlParameter("@airportTaxChild", objFlightBAL.airportTaxChild);
                p[15] = new SqlParameter("@airportTaxInfant", objFlightBAL.airportTaxInfant);
                p[16] = new SqlParameter("@adultTaxBreakUp", objFlightBAL.adultTaxBreakUp);
                p[17] = new SqlParameter("@ChildTaxBreakUp", objFlightBAL.ChildTaxBreakUp);
                p[18] = new SqlParameter("@InfantTaxBreakUp", objFlightBAL.InfantTaxBreakUp);
                p[19] = new SqlParameter("@ocTax", objFlightBAL.ocTax);
                p[20] = new SqlParameter("@Availability", (objFlightBAL.Availability == "") ? 0 : Convert.ToInt32(objFlightBAL.Availability));
                p[21] = new SqlParameter("@ResBookingCode", objFlightBAL.ResBookingCode);
                p[22] = new SqlParameter("@adultFare",(objFlightBAL.adultFare == "") ? 0 : Convert.ToDecimal(objFlightBAL.adultFare));
                p[23] = new SqlParameter("@bookingClass", objFlightBAL.bookingClass);
                p[24] = new SqlParameter("@ChildFare", (objFlightBAL.ChildFare == "") ? 0 : Convert.ToDecimal(objFlightBAL.ChildFare));
                p[25] = new SqlParameter("@ClassType", objFlightBAL.ClassType);
                p[26] = new SqlParameter("@farebasisCode", objFlightBAL.farebasisCode);
                p[27] = new SqlParameter("@infantFare", (objFlightBAL.infantFare == "" ) ? 0 : Convert.ToDecimal(objFlightBAL.infantFare));
                p[28] = new SqlParameter("@Fare_Rule", objFlightBAL.Fare_Rule);
                p[29] = new SqlParameter("@adultCommission",(objFlightBAL.adultCommission == "") ?  0 : Convert.ToDecimal(objFlightBAL.adultCommission));
                p[30] = new SqlParameter("@childCommission", (objFlightBAL.childCommission == "") ? 0 : Convert.ToDecimal(objFlightBAL.childCommission));
                p[31] = new SqlParameter("@CommissionOnTCharge", (objFlightBAL.CommissionOnTCharge == "") ? 0 :Convert.ToDecimal(objFlightBAL.CommissionOnTCharge));
                p[32] = new SqlParameter("@FlightBookingID", Convert.ToInt32(objFlightBAL.FlightBookingID));
                p[33] = new SqlParameter("@tableName", "InsertDomFlightBookingsements");
                p[34] = new SqlParameter("@CreatedBy", objFlightBAL.CreatedBy);

                return ObjDAL.fnExecuteStoredProcedure("sp_DomesticFlightBookingsegments", p);
            }
            catch (Exception ex)
            {
                throw new ArgumentException(ex.Message);
            }
        }
    protected void GetIntBookingStatus(string refNo)
    {
        try
        {
            DataSet ds = new DataSet();
            FlightBAL objFlightBal = new FlightBAL();
            string result = string.Empty;
            string EticketDetailsId = string.Empty;
            string givenName = string.Empty;
            string surName = string.Empty;
            string nameReference = string.Empty;
            string psgrType = string.Empty;
            string originDestinationOptionId = string.Empty;
            string onwardId = string.Empty;
            string FlightSegmentsId = string.Empty;
            string FlightSegmentId = string.Empty;
            string eticketdto_Id = string.Empty;
            string AirlinePNR = string.Empty; // ConfirmationId
            string GDFPNRNumber = string.Empty; //PNRNumber
            string eticketNo = string.Empty;
            string flightUid = string.Empty;
            string passuid = string.Empty;

            DataSet dsGetTransId = new DataSet();
            dsGetTransId = objFlightBal.GetIntTransID(refNo);
            transId = dsGetTransId.Tables[0].Rows[0]["transid"].ToString();

            String xmlRequest = "<EticketRequest><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooINTLWS1.0</Clienttype><transid>" + transId + "</transid></EticketRequest>";
            ds = objFlightBal.GetDatasetFromAPI(xmlRequest, "http://live.arzoo.com:9302/BookingStatus");

            if (ds.Tables["EticketDetails"].Columns.Contains("EticketDetails_Id"))
            {
                EticketDetailsId = ds.Tables["EticketDetails"].Rows[0]["EticketDetails_Id"].ToString();

                DataTable dtOriginDestinationOption = (DataTable)ds.Tables["OriginDestinationOption"];
                if (dtOriginDestinationOption.Rows.Count > 0)
                {
                    DataRow[] rowOriginDestinationOption = dtOriginDestinationOption.Select("eticketDetails_Id=" + EticketDetailsId);
                    originDestinationOptionId = rowOriginDestinationOption[0]["originDestinationOption_Id"].ToString();
                }
                DataTable dtOnward = (DataTable)ds.Tables["onward"];
                if (dtOnward.Rows.Count > 0)
                {
                    DataRow[] rowOnward = dtOnward.Select("originDestinationOption_Id=" + originDestinationOptionId);
                    onwardId = rowOnward[0]["Onward_Id"].ToString();
                }
                DataTable dtFlightSegments = (DataTable)ds.Tables["FlightSegments"];
                if (dtFlightSegments.Rows.Count > 0)
                {
                    DataRow[] rowFlightSegments = dtFlightSegments.Select("Onward_Id=" + onwardId);
                    FlightSegmentsId = rowFlightSegments[0]["FlightSegments_Id"].ToString();
                }

                DataTable dtFlightSegment = (DataTable)ds.Tables["FlightSegment"];
                if (dtFlightSegment.Rows.Count > 0)
                {
                    for (int i = 0; i < dtFlightSegment.Rows.Count; i++)
                    {
                        DataRow[] rowFlightSegment = dtFlightSegment.Select("FlightSegments_Id=" + FlightSegmentsId);
                        FlightSegmentId = rowFlightSegment[i]["FlightSegment_Id"].ToString();
                        AirlinePNR = (AirlinePNR == "") ? rowFlightSegment[i]["confirmationid"].ToString() : AirlinePNR + "|" + rowFlightSegment[i]["confirmationid"].ToString();
                        GDFPNRNumber = (GDFPNRNumber == "") ? rowFlightSegment[i]["pnrnumber"].ToString() : GDFPNRNumber + "|" + rowFlightSegment[i]["pnrnumber"].ToString();

                        DataTable dtEticketDto = (DataTable)ds.Tables["Eticketdto"];
                        if (dtEticketDto.Rows.Count > 0)
                        {
                            DataRow[] rowEticketdto = dtEticketDto.Select("FlightSegment_Id=" + FlightSegmentId);
                            eticketdto_Id = rowEticketdto[0]["eticketdto_id"].ToString();
                            eticketNo = (eticketNo == "") ? rowEticketdto[i]["eticketno"].ToString() : eticketNo + "|" + rowEticketdto[i]["eticketno"].ToString();
                            flightUid = (flightUid == "") ? rowEticketdto[i]["flightuid"].ToString() : flightUid + "|" + rowEticketdto[i]["flightuid"].ToString();
                            passuid = (passuid == "") ? rowEticketdto[i]["passuid"].ToString() : passuid + "|" + rowEticketdto[i]["passuid"].ToString();

                        }
                    }
                }
                string status = ds.Tables[0].Rows[0]["status"].ToString();

                objFlightBal.Status = status;
                objFlightBal.TransId = transId;
                objFlightBal.ReferenceNo = refNo;
                objFlightBal.AirlinePNR = AirlinePNR;
                objFlightBal.GDFPNRNo = GDFPNRNumber;
                objFlightBal.passuid = passuid;
                objFlightBal.Flightuid = flightUid;
                objFlightBal.eticketNo = eticketNo;

                if (objFlightBal.Status == "SUCCESS")
                {
                    statusCnt++;
                    if (statusCnt < 3)
                    {
                        GetIntBookingStatus(refNo);
                    }
                    else
                    {
                        bool res = objFlightBal.UpdateInternationalFlightBookingStatus(objFlightBal);
                        if (res)
                        {
                            lblStatus.Text = "Your ticket status is " + objFlightBal.Status;
                            lblStatus.ForeColor = System.Drawing.Color.Green;
                        }
                    }
                }

            }
            else
            {
                lblStatus.Text = "Your ticket is under booking process";
            }

        }
        catch (Exception ex)
        {

        }
    }
    protected void btnRoundTripSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            try
            {
                // if (Session["UserID"] == null) { Response.Redirect("~/Default.aspx", false); return; }

                #region Variables

                string FlightSegmentsID = string.Empty;
                string originDestination_Id = string.Empty;
                string fareDetailsId = string.Empty;
                string TotalFare = string.Empty;
                string AirEquipType = string.Empty;
                string ArrivalAirportCode = string.Empty;
                string ArrivalDateTime = string.Empty;
                string DepartureAirportCode = string.Empty;
                string DepartureDateTime = string.Empty;
                string FlightNumber = string.Empty;
                string OperatingAirlineCode = string.Empty;
                string OperatingAirlineFlightNumber = string.Empty;
                string RPH = string.Empty;
                string StopQuantity = string.Empty;
                string airLineName = string.Empty;
                string airportTax = string.Empty;
                string imageFileName = string.Empty;
                string BookingClassAvailability = string.Empty;
                string BookingClassResBookDesigCode = string.Empty;
                string adultFare = string.Empty;
                string bookingclass = string.Empty;
                string childFare = string.Empty;
                string classType = string.Empty;
                string farebasiscode = string.Empty;
                string infantfare = string.Empty;
                string Rule = string.Empty;
                string adultCommission = string.Empty;
                string childCommission = string.Empty;
                string commissionOnTCharge = string.Empty;
                string Discount = string.Empty;
                string airportTaxChild = string.Empty;
                string airportTaxInfant = string.Empty;
                string adultTaxBreakup = string.Empty;
                string childTaxBreakup = string.Empty;
                string infantTaxBreakup = string.Empty;
                string octax = string.Empty;
                string id = string.Empty;
                string key = string.Empty;
                string TCharge = string.Empty;
                string TMarkup = string.Empty;
                string TSdiscount = string.Empty;
                string TPartnerCommission = string.Empty;
                string actualBaseFare = string.Empty;
                string tax = string.Empty;
                string Stax = string.Empty;
                string SCharge = string.Empty;
                string TDiscount = string.Empty;

                string responseDepartId = string.Empty;
                string responseReturnId = string.Empty;
                string OriginDestinationOptionsId = string.Empty;

                #endregion
                dsFilghts = (DataSet)Session["dsDomFlights"];

                DataTable dtFlightSegment = dsFilghts.Tables["FlightSegment"];

                if (dtFlightSegment.Rows.Count > 0)
                {
                    DataRow[] rowFlightSegment = dtFlightSegment.Select("FlightSegment_Id=" + lblonwardFlightSegmentId.Text);
                    AirEquipType = rowFlightSegment[0]["AirEquipType"].ToString();
                    ArrivalAirportCode = rowFlightSegment[0]["ArrivalAirportCode"].ToString();
                    ArrivalDateTime = rowFlightSegment[0]["ArrivalDateTime"].ToString();
                    DepartureAirportCode = rowFlightSegment[0]["DepartureAirportCode"].ToString();
                    DepartureDateTime = rowFlightSegment[0]["DepartureDateTime"].ToString();
                    FlightNumber = rowFlightSegment[0]["FlightNumber"].ToString();
                    OperatingAirlineCode = rowFlightSegment[0]["OperatingAirlineCode"].ToString();
                    OperatingAirlineFlightNumber = rowFlightSegment[0]["OperatingAirlineFlightNumber"].ToString();
                    RPH = rowFlightSegment[0]["RPH"].ToString();
                    StopQuantity = rowFlightSegment[0]["StopQuantity"].ToString();
                    airLineName = rowFlightSegment[0]["airLineName"].ToString();
                    airportTax = rowFlightSegment[0]["airportTax"].ToString();
                    imageFileName = rowFlightSegment[0]["imageFileName"].ToString();
                    Discount = rowFlightSegment[0]["Discount"].ToString();
                    airportTaxChild = rowFlightSegment[0]["airportTaxChild"].ToString();
                    airportTaxInfant = rowFlightSegment[0]["airportTaxInfant"].ToString();
                    adultTaxBreakup = rowFlightSegment[0]["adultTaxBreakup"].ToString();
                    childTaxBreakup = rowFlightSegment[0]["childTaxBreakup"].ToString();
                    infantTaxBreakup = rowFlightSegment[0]["infantTaxBreakup"].ToString();
                    octax = rowFlightSegment[0]["octax"].ToString();
                    FlightSegmentsID = rowFlightSegment[0]["FlightSegments_Id"].ToString();
                }

                DataTable dtFlightSegments = dsFilghts.Tables["FlightSegments"];

                if (dtFlightSegments.Rows.Count > 0)
                {
                    DataRow[] rowFlightSegments = dtFlightSegments.Select("FlightSegments_Id=" + FlightSegmentsID);
                    originDestination_Id = rowFlightSegments[0]["originDestinationoption_Id"].ToString();
                }
                DataTable dtoriginDestinationoption = dsFilghts.Tables["originDestinationoption"];

                if (dtoriginDestinationoption.Rows.Count > 0)
                {
                    DataRow[] roworiginDestinationoption = dtoriginDestinationoption.Select("originDestinationoption_Id=" + originDestination_Id);
                    id = roworiginDestinationoption[0]["id"].ToString();
                    key = roworiginDestinationoption[0]["key"].ToString();
                }

                DataTable dtFareDetails = dsFilghts.Tables["FareDetails"];

                if (dtFareDetails.Rows.Count > 0)
                {
                    DataRow[] rowFareDetails = dtFareDetails.Select("originDestinationoption_Id=" + originDestination_Id);
                    fareDetailsId = rowFareDetails[0]["FareDetails_Id"].ToString();
                }

                DataTable dtChargeableFares = dsFilghts.Tables["ChargeableFares"];
                if (dtChargeableFares.Rows.Count > 0)
                {
                    DataRow[] rowChargeableFares = dtChargeableFares.Select("FareDetails_Id=" + fareDetailsId);
                    actualBaseFare = rowChargeableFares[0]["ActualBaseFare"].ToString();
                    tax = rowChargeableFares[0]["tax"].ToString();
                    Stax = rowChargeableFares[0]["Stax"].ToString();
                    SCharge = rowChargeableFares[0]["SCharge"].ToString();
                    TDiscount = rowChargeableFares[0]["TDiscount"].ToString();
                    TPartnerCommission = rowChargeableFares[0]["TPartnerCommission"].ToString();

                }

                DataTable dtNonChargeableFares = dsFilghts.Tables["NonChargeableFares"];
                if (dtNonChargeableFares.Rows.Count > 0)
                {
                    DataRow[] rowNonChargeableFares = dtNonChargeableFares.Select("FareDetails_Id=" + fareDetailsId);
                    TCharge = rowNonChargeableFares[0]["TCharge"].ToString();
                    TSdiscount = rowNonChargeableFares[0]["TSdiscount"].ToString();
                    TMarkup = rowNonChargeableFares[0]["TMarkup"].ToString();
                }
                DataTable dtBookingClass = dsFilghts.Tables["BookingClass"];
                if (dtBookingClass.Rows.Count > 0)
                {
                    DataRow[] rowBookingClass = dtBookingClass.Select("FlightSegment_Id=" + lblonwardFlightSegmentId.Text);
                    BookingClassAvailability = rowBookingClass[0]["Availability"].ToString();
                    BookingClassResBookDesigCode = rowBookingClass[0]["ResBookDesigCode"].ToString();

                }

                DataTable dtBookingClassfare = dsFilghts.Tables["BookingClassFare"];
                if (dtBookingClassfare.Rows.Count > 0)
                {
                    DataRow[] rowBookingClassFare = dtBookingClassfare.Select("FlightSegment_Id=" + lblonwardFlightSegmentId.Text);
                    adultFare = rowBookingClassFare[0]["adultFare"].ToString();
                    if (dtBookingClassfare.Columns.Contains("childFare"))
                    {
                        childFare = rowBookingClassFare[0]["childFare"].ToString();
                    }
                    if (dtBookingClassfare.Columns.Contains("infantfare"))
                    {
                        infantfare = rowBookingClassFare[0]["infantfare"].ToString();
                    }
                    bookingclass = rowBookingClassFare[0]["bookingclass"].ToString();
                    classType = rowBookingClassFare[0]["classType"].ToString();
                    farebasiscode = rowBookingClassFare[0]["farebasiscode"].ToString();
                    Rule = rowBookingClassFare[0]["Rule"].ToString().Replace("<", "&lt;").Replace(">", "&gt;");
                    adultCommission = rowBookingClassFare[0]["adultCommission"].ToString();
                    childCommission = rowBookingClassFare[0]["childCommission"].ToString();
                    commissionOnTCharge = rowBookingClassFare[0]["commissionOnTCharge"].ToString();
                }

                #region ReturnOriginDestionOptionDetails

                DataTable dtFlightSegmentRet = dsFilghts.Tables["FlightSegment"];

                if (dtFlightSegmentRet.Rows.Count > 0)
                {
                    DataRow[] rowFlightSegmentRet = dtFlightSegmentRet.Select("FlightSegment_Id=" + lblReturnFlightSegment.Text);
                    AirEquipTypeRet = rowFlightSegmentRet[0]["AirEquipType"].ToString();
                    ArrivalAirportCodeRet = rowFlightSegmentRet[0]["ArrivalAirportCode"].ToString();
                    ArrivalDateTimeRet = rowFlightSegmentRet[0]["ArrivalDateTime"].ToString();
                    DepartureAirportCodeRet = rowFlightSegmentRet[0]["DepartureAirportCode"].ToString();
                    DepartureDateTimeRet = rowFlightSegmentRet[0]["DepartureDateTime"].ToString();
                    FlightNumberRet = rowFlightSegmentRet[0]["FlightNumber"].ToString();
                    OperatingAirlineCodeRet = rowFlightSegmentRet[0]["OperatingAirlineCode"].ToString();
                    OperatingAirlineFlightNumberRet = rowFlightSegmentRet[0]["OperatingAirlineFlightNumber"].ToString();
                    RPHRet = rowFlightSegmentRet[0]["RPH"].ToString();
                    StopQuantityRet = rowFlightSegmentRet[0]["StopQuantity"].ToString();
                    airLineNameRet = rowFlightSegmentRet[0]["airLineName"].ToString();
                    airportTaxRet = rowFlightSegmentRet[0]["airportTax"].ToString();
                    imageFileNameRet = rowFlightSegmentRet[0]["imageFileName"].ToString();
                    DiscountRet = rowFlightSegmentRet[0]["Discount"].ToString();
                    airportTaxChildRet = rowFlightSegmentRet[0]["airportTaxChild"].ToString();
                    airportTaxInfantRet = rowFlightSegmentRet[0]["airportTaxInfant"].ToString();
                    adultTaxBreakupRet = rowFlightSegmentRet[0]["adultTaxBreakup"].ToString();
                    childTaxBreakupRet = rowFlightSegmentRet[0]["childTaxBreakup"].ToString();
                    infantTaxBreakupRet = rowFlightSegmentRet[0]["infantTaxBreakup"].ToString();

                    octaxRet = rowFlightSegmentRet[0]["octax"].ToString();
                    FlightSegmentsIDRet = rowFlightSegmentRet[0]["FlightSegments_Id"].ToString();
                }

                DataTable dtFlightSegmentsRet = dsFilghts.Tables["FlightSegments"];

                if (dtFlightSegmentsRet.Rows.Count > 0)
                {
                    DataRow[] rowFlightSegmentsRet = dtFlightSegmentsRet.Select("FlightSegments_Id=" + FlightSegmentsIDRet);
                    originDestination_IdRet = rowFlightSegmentsRet[0]["originDestinationoption_Id"].ToString();
                }
                DataTable dtoriginDestinationoptionRet = dsFilghts.Tables["originDestinationoption"];

                if (dtoriginDestinationoptionRet.Rows.Count > 0)
                {
                    DataRow[] roworiginDestinationoptionRet = dtoriginDestinationoptionRet.Select("originDestinationoption_Id=" + originDestination_IdRet);
                    idRet = roworiginDestinationoptionRet[0]["id"].ToString();
                    keyRet = roworiginDestinationoptionRet[0]["key"].ToString();
                }

                DataTable dtFareDetailsRet = dsFilghts.Tables["FareDetails"];

                if (dtFareDetailsRet.Rows.Count > 0)
                {
                    DataRow[] rowFareDetailsRet = dtFareDetailsRet.Select("originDestinationoption_Id=" + originDestination_IdRet);
                    fareDetailsIdRet = rowFareDetailsRet[0]["FareDetails_Id"].ToString();
                }

                DataTable dtChargeableFaresRet = dsFilghts.Tables["ChargeableFares"];
                if (dtChargeableFaresRet.Rows.Count > 0)
                {
                    DataRow[] rowChargeableFaresRet = dtChargeableFaresRet.Select("FareDetails_Id=" + fareDetailsIdRet);
                    actualBaseFareRet = rowChargeableFaresRet[0]["ActualBaseFare"].ToString();
                    taxRet = rowChargeableFaresRet[0]["tax"].ToString();
                    StaxRet = rowChargeableFaresRet[0]["Stax"].ToString();
                    SChargeRet = rowChargeableFaresRet[0]["SCharge"].ToString();
                    TDiscountRet = rowChargeableFaresRet[0]["TDiscount"].ToString();
                    TPartnerCommissionRet = rowChargeableFaresRet[0]["TPartnerCommission"].ToString();

                }

                DataTable dtNonChargeableFaresRet = dsFilghts.Tables["NonChargeableFares"];
                if (dtNonChargeableFaresRet.Rows.Count > 0)
                {
                    DataRow[] rowNonChargeableFaresRet = dtNonChargeableFaresRet.Select("FareDetails_Id=" + fareDetailsIdRet);
                    TChargeRet = rowNonChargeableFaresRet[0]["TCharge"].ToString();
                    TSdiscountRet = rowNonChargeableFaresRet[0]["TSdiscount"].ToString();
                    TMarkupRet = rowNonChargeableFaresRet[0]["TMarkup"].ToString();
                }
                DataTable dtBookingClassRet = dsFilghts.Tables["BookingClass"];
                if (dtBookingClassRet.Rows.Count > 0)
                {
                    DataRow[] rowBookingClassRet = dtBookingClassRet.Select("FlightSegment_Id=" + lblReturnFlightSegment.Text);
                    BookingClassAvailabilityRet = rowBookingClassRet[0]["Availability"].ToString();
                    BookingClassResBookDesigCodeRet = rowBookingClassRet[0]["ResBookDesigCode"].ToString();

                }

                DataTable dtBookingClassfareRet = dsFilghts.Tables["BookingClassFare"];
                if (dtBookingClassfareRet.Rows.Count > 0)
                {
                    DataRow[] rowBookingClassFareRet = dtBookingClassfareRet.Select("FlightSegment_Id=" + lblReturnFlightSegment.Text);
                    adultFareRet = rowBookingClassFareRet[0]["adultFare"].ToString();
                    if (dtBookingClassfareRet.Columns.Contains("childFare"))
                    {
                        childFareRet = rowBookingClassFareRet[0]["childFare"].ToString();
                    }
                    if (dtBookingClassfareRet.Columns.Contains("infantfare"))
                    {
                        infantfareRet = rowBookingClassFareRet[0]["infantfare"].ToString();
                    }
                    bookingclassRet = rowBookingClassFareRet[0]["bookingclass"].ToString();
                    classTypeRet = rowBookingClassFareRet[0]["classType"].ToString();
                    farebasiscodeRet = rowBookingClassFareRet[0]["farebasiscode"].ToString();
                    RuleRet = rowBookingClassFareRet[0]["Rule"].ToString().Replace("<", "&lt;").Replace(">", "&gt;");
                    adultCommissionRet = rowBookingClassFareRet[0]["adultCommission"].ToString();
                    childCommissionRet = rowBookingClassFareRet[0]["childCommission"].ToString();
                    commissionOnTChargeRet = rowBookingClassFareRet[0]["commissionOnTCharge"].ToString();

                }

                // string flightBookingId = dtflightBookingId.Rows[0]["FlightBookingID"].ToString();
                // Session["BookingID"] = dtflightBookingId.Rows[0]["FlightBookingID"].ToString();
                string refNo = Common.GetFlightsReferenceNo("LJDF");
                Session["Order_Id"] = refNo.ToString();
                FlightBAL objFlightBal = new FlightBAL();

                objFlightBal.ReferenceNo = refNo;
                objFlightBal.TransId = string.Empty;
                objFlightBal.Status = "Pending";
                objFlightBal.AdultPax = Convert.ToInt32(ddlAdult.SelectedValue);
                objFlightBal.InfantPax = Convert.ToInt32(ddlInfant.SelectedValue);
                objFlightBal.ChildPax = Convert.ToInt32(ddlChild.SelectedValue);
                objFlightBal.Origin_Destination_Id = id;
                objFlightBal.Origin_Destination_Key = key;
                objFlightBal.ActualBasefare = Convert.ToDecimal(actualBaseFare);
                objFlightBal.Tax = Convert.ToDecimal(tax);
                objFlightBal.STax = Convert.ToDecimal(Stax);
                objFlightBal.Scharge = Convert.ToDecimal(SCharge);
                objFlightBal.TDiscount = Convert.ToDecimal(TDiscount);
                objFlightBal.TPartnerCommission = Convert.ToDecimal(TPartnerCommission);
                objFlightBal.TCharge = Convert.ToDecimal(TCharge);
                objFlightBal.TMarkUp = Convert.ToDecimal(TMarkup);
                objFlightBal.TSDiscount = Convert.ToDecimal(TSdiscount);
                objFlightBal.ActualBasefareRet = Convert.ToDecimal(actualBaseFareRet);
                objFlightBal.TaxRet = Convert.ToDecimal(taxRet);
                objFlightBal.STaxRet = Convert.ToDecimal(StaxRet);
                objFlightBal.SchargeRet = Convert.ToDecimal(SChargeRet);
                objFlightBal.TDiscountRet = Convert.ToDecimal(TDiscountRet);
                objFlightBal.TPartnerCommissionRet = Convert.ToDecimal(TPartnerCommissionRet);
                objFlightBal.TChargeRet = Convert.ToDecimal(TChargeRet);
                objFlightBal.TMarkUpRet = Convert.ToDecimal(TMarkupRet);
                objFlightBal.TSDiscountRet = Convert.ToDecimal(TSdiscountRet);
                string givenName = string.Empty;
                string surName = string.Empty;
                string namereference = string.Empty;
                string psgrType = string.Empty;
                string Age = string.Empty;
                string customerInfo = string.Empty;
                #region customer

                Table tbladults1 = (Table)this.UpdatePanel1.FindControl("tblAdults");
                for (int l = 1; l <= Convert.ToInt32(Session["adultcnt"]); l++)
                {

                    TextBox txtFn = (TextBox)tbladults1.FindControl("txtFn" + l);
                    TextBox txtLn = (TextBox)tbladults1.FindControl("txtLn" + l);
                    DropDownList ddlTitle = (DropDownList)tbladults1.FindControl("ddlTitle" + l);

                    if (customerInfo == string.Empty)
                    {
                        customerInfo = ddlTitle.SelectedItem.Text + "|" + txtFn.Text + "|" + txtLn.Text + "|" + "Adt" + "|" + "-";
                    }
                    else
                    {
                        customerInfo = customerInfo + ";" + ddlTitle.SelectedItem.Text + "|" + txtFn.Text + "|" + txtLn.Text + "|" + "Adt" + "|" + "-";
                    }
                    //  xmlRequest = xmlRequest + "<CustomerInfo><givenName>" + txtFn.Text + "</givenName><surName>" + txtLn.Text + "</surName><nameReference>" + ddlTitle.SelectedItem.Value + "</nameReference><psgrtype>adt</psgrtype></CustomerInfo>";
                }

                Table tblChild1 = (Table)this.UpdatePanel1.FindControl("tblChild");
                for (int j = 1; j <= Convert.ToInt32(Session["childCnt"]); j++)
                {
                    TextBox txtFn = (TextBox)tblChild1.FindControl("txtCFn" + j);

                    TextBox txtLn = (TextBox)tblChild1.FindControl("txtCLn" + j);

                    DropDownList ddlTitle = (DropDownList)tblChild1.FindControl("ddlCTitle" + j);

                    TextBox txtBirthDate = (TextBox)tblChild1.FindControl("txtCBirthDate" + j);

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

                    if (customerInfo == string.Empty)
                    {
                        customerInfo = ddlTitle.SelectedItem.Text + "|" + txtFn.Text + "|" + txtLn.Text + "|" + "Chd" + "|" + age + "|" + txtBirthDate.Text.ToString();
                    }
                    else
                    {
                        customerInfo = customerInfo + ";" + ddlTitle.SelectedItem.Text + "|" + txtFn.Text + "|" + txtLn.Text + "|" + "Chd" + "|" + age + "|" + txtBirthDate.Text.ToString();
                    }
                    //  xmlRequest = xmlRequest + "<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 tblInfants1 = (Table)this.UpdatePanel1.FindControl("tblInfants");
                for (int k = 1; k <= Convert.ToInt32(Session["infantCnt"]); k++)
                {
                    TextBox txtFn = (TextBox)tblInfants1.FindControl("txtIFn" + k);

                    TextBox txtLn = (TextBox)tblInfants1.FindControl("txtILn" + k);

                    DropDownList ddlTitle = (DropDownList)tblInfants1.FindControl("ddlITitle" + k);

                    TextBox txtBirthDate = (TextBox)tblInfants1.FindControl("txtIBirthDate" + k);
                    string age = string.Empty;
                    if (txtBirthDate != null)
                        age = (DateTime.Now.Year - Convert.ToDateTime(txtBirthDate.Text).Year).ToString();
                    else
                        age = "0";

                    if (customerInfo == string.Empty)
                    {
                        customerInfo = ddlTitle.SelectedItem.Text + "|" + txtFn.Text + "|" + txtLn.Text + "|" + "Inf" + "|" + age + "|" + txtBirthDate.Text.ToString();
                    }
                    else
                    {
                        customerInfo = customerInfo + ";" + ddlTitle.SelectedItem.Text + "|" + txtFn.Text + "|" + txtLn.Text + "|" + "Inf" + "|" + age + "|" + txtBirthDate.Text.ToString();
                    }
                    //  xmlRequest = xmlRequest + "<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
                objFlightBal.Address = txtCity.Text + "," + txtState.Text + "," + ddlcountry.SelectedValue + "," + txtPostalCode.Text + ",";
                objFlightBal.Customer_Details = customerInfo;
                //objFlightBal.Customer_Details = "Mr.|rajini|reguri|Adt|";
                objFlightBal.telephone = txtMobileNum.Text;
                objFlightBal.emailAddress = lblEmailAddress.Text = txtEmailID.Text;
                objFlightBal.TripMode = "Round";
                objFlightBal.CreatedBy = Convert.ToInt32(Session["UserID"]);
                if (Session["Role"] == null)
                {
                    objFlightBal.Type = "Guest";
                }
                else
                {
                    objFlightBal.Type = Session["Role"].ToString();
                }
                objFlightBal.id = id;
                objFlightBal.key = key;
                objFlightBal.idRet = idRet;
                objFlightBal.keyRet = keyRet;
                DataTable dtflightBookingId = objFlightBal.AddDomesticFlightBooking(objFlightBal);

                string flightBookingId = dtflightBookingId.Rows[0]["FlightBookingID"].ToString();
                Session["BookingID"] = dtflightBookingId.Rows[0]["FlightBookingID"].ToString();

                objFlightBal.FlightBookingID = flightBookingId.ToString();
                objFlightBal.AirEquipType = AirEquipType;
                objFlightBal.ArrivalAirportCode = ArrivalAirportCode;
                objFlightBal.ArrivalDateTime = ArrivalDateTime;
                objFlightBal.DepartureAirportCode = DepartureAirportCode;
                objFlightBal.DepartureDateTime = DepartureDateTime;
                objFlightBal.FlightNumber = FlightNumber;
                objFlightBal.OperatingAirlineCode = OperatingAirlineCode;
                objFlightBal.OperatingAirlineFlightNumber = OperatingAirlineFlightNumber;
                objFlightBal.RPH = RPH;
                objFlightBal.StopQuantity = StopQuantity;
                objFlightBal.airlineName = airLineName;
                objFlightBal.airportTax = airportTax;
                objFlightBal.imageFileName = imageFileName;
                objFlightBal.Discount = Discount;
                objFlightBal.airportTaxChild = airportTaxChild;
                objFlightBal.airportTaxInfant = airportTaxInfant;
                objFlightBal.adultTaxBreakUp = adultTaxBreakup;
                objFlightBal.ChildTaxBreakUp = childTaxBreakup;
                objFlightBal.InfantTaxBreakUp = infantTaxBreakup;
                objFlightBal.ocTax = octax;
                objFlightBal.Availability = BookingClassAvailability;
                objFlightBal.ResBookingCode = BookingClassResBookDesigCode;
                objFlightBal.adultFare = adultFare;
                objFlightBal.bookingClass = bookingclass;
                objFlightBal.ChildFare = childFare;
                objFlightBal.ClassType = classType;
                objFlightBal.farebasisCode = farebasiscode;
                objFlightBal.infantFare = infantfare;
                objFlightBal.Fare_Rule = Rule;
                objFlightBal.adultCommission = adultCommission;
                objFlightBal.childCommission = childCommission;
                objFlightBal.CommissionOnTCharge = commissionOnTCharge;
                objFlightBal.CreatedBy = Convert.ToInt32(Session["UserID"]);

                bool res = objFlightBal.AddDomesticFlightBookingsegments(objFlightBal);

                objFlightBal.FlightBookingID = flightBookingId.ToString();
                objFlightBal.AirEquipType = AirEquipTypeRet;
                objFlightBal.ArrivalAirportCode = ArrivalAirportCodeRet;
                objFlightBal.ArrivalDateTime = ArrivalDateTimeRet;
                objFlightBal.DepartureAirportCode = DepartureAirportCodeRet;
                objFlightBal.DepartureDateTime = DepartureDateTimeRet;
                objFlightBal.FlightNumber = FlightNumberRet;
                objFlightBal.OperatingAirlineCode = OperatingAirlineCodeRet;
                objFlightBal.OperatingAirlineFlightNumber = OperatingAirlineFlightNumberRet;
                objFlightBal.RPH = RPHRet;
                objFlightBal.StopQuantity = StopQuantityRet;
                objFlightBal.airlineName = airLineNameRet;
                objFlightBal.airportTax = airportTaxRet;
                objFlightBal.imageFileName = imageFileNameRet;
                objFlightBal.Discount = DiscountRet;
                objFlightBal.airportTaxChild = airportTaxChildRet;
                objFlightBal.airportTaxInfant = airportTaxInfantRet;
                objFlightBal.adultTaxBreakUp = adultTaxBreakupRet;
                objFlightBal.ChildTaxBreakUp = childTaxBreakupRet;
                objFlightBal.InfantTaxBreakUp = infantTaxBreakupRet;
                objFlightBal.ocTax = octaxRet;
                objFlightBal.Availability = BookingClassAvailabilityRet;
                objFlightBal.ResBookingCode = BookingClassResBookDesigCodeRet;
                objFlightBal.adultFare = adultFareRet;
                objFlightBal.bookingClass = bookingclassRet;
                objFlightBal.ChildFare = childFareRet;
                objFlightBal.ClassType = classTypeRet;
                objFlightBal.farebasisCode = farebasiscodeRet;
                objFlightBal.infantFare = infantfareRet;
                objFlightBal.Fare_Rule = RuleRet;
                objFlightBal.adultCommission = adultCommissionRet;
                objFlightBal.childCommission = childCommissionRet;
                objFlightBal.CommissionOnTCharge = commissionOnTChargeRet;
                objFlightBal.CreatedBy = Convert.ToInt32(Session["UserID"]);

                res = objFlightBal.AddDomesticFlightBookingsegments(objFlightBal);

                if (res)
                {
                    try
                    {

                        //  Response.Redirect("~/pay.aspx?val=Dom", false);
                        #region Checking the roles and booking the tickets

                        TotalFare = (Convert.ToDouble(lblTotalAmtreturn) + Convert.ToDouble(lblTotalAmt)).ToString();
                        Session["Amount"] = TotalFare;
                          if (Session["Role"] == null)
                        {
                            Response.Redirect("~/pay.aspx?val=Dom", false);
                        }
                          else if (Session["Role"].ToString() == "User")
                        {
                            objBAL = new ClsBAL();
                            DataSet dsBalance = objBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"].ToString()));
                            Session["AgentId_Agent"] = dsBalance.Tables[0].Rows[0]["AgentId"].ToString();

                            Response.Redirect("~/pay.aspx?val=Dom", false);
                        }
                        else if (Session["Role"].ToString() == "Admin")
                        {
                            saveround(sender, e);
                        }
                        else if (Session["Role"].ToString() == "Agent")
                        {
                            DataSet dsBalance = objBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"].ToString()));
                            DataSet dsCommSlab = objBAL.GetCommissionSlab(Session["Role"].ToString(), "DomesticFlights", airLineName.ToString()); // Change it
                            string commisionPercentage = string.Empty;
                            if (dsCommSlab.Tables[0].Rows.Count > 0)
                                commisionPercentage = dsCommSlab.Tables[0].Rows[0]["Commission"].ToString();// Change it
                            else
                                commisionPercentage = "0";
                            string balance = dsBalance.Tables[0].Rows[0]["Balance"].ToString();
                            string agentId = dsBalance.Tables[0].Rows[0]["AgentId"].ToString();
                            TotalFare = (Convert.ToDouble(lblTotalAmtreturn.Text) + Convert.ToDouble(lblTotalAmt.Text)).ToString();
                            string actualFare = TotalFare;
                            string deductAmount = Convert.ToString(Convert.ToDouble(actualFare.ToString()) -
                                ((Convert.ToDouble(actualFare.ToString()) * Convert.ToDouble(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))
                            {
                                saveround(sender, e);
                            }
                            else
                            {
                                mp3.Show();

                                lblerror.Text = "Your balance is too low to book the ticket.So,please contact administrator";

                                return;
                            }
                        }
                        else if (Session["Role"].ToString() == "Distributor")
                        {
                            DataSet dsBalance = objBAL.GetAgentByUserId(Convert.ToInt32(Session["UserID"].ToString()));
                            DataSet dsCommSlab = objBAL.GetCommissionSlab(Session["Role"].ToString(), "DomesticFlights", airLineName.ToString()); // Change it
                            string commisionPercentage = string.Empty;
                            if (dsCommSlab.Tables[0].Rows.Count > 0)
                                commisionPercentage = dsCommSlab.Tables[0].Rows[0]["Commission"].ToString();// Change it
                            else
                                commisionPercentage = "0";
                            string balance = dsBalance.Tables[0].Rows[0]["Balance"].ToString();
                            string agentId = dsBalance.Tables[0].Rows[0]["AgentId"].ToString();
                            TotalFare = (Convert.ToDouble(lblTotalAmtreturn.Text) + Convert.ToDouble(lblTotalAmt.Text)).ToString();
                            string actualFare = TotalFare;
                            string deductAmount = Convert.ToString(Convert.ToDouble(actualFare.ToString()) -
                                ((Convert.ToDouble(actualFare.ToString()) * Convert.ToDouble(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))
                            {
                                saveround(sender, e);
                            }
                            else
                            {
                                mp3.Show();

                                lblerror.Text = "Your balance is too low to book the ticket.So, please contact administrator";

                                return;
                            }
                        }

                        #endregion
                    }
                    catch (Exception ex)
                    {
                        //  LogError("frmSearchBus.aspx", "paymentgateway", DateTime.Now, ex.Message.ToString());
                        // lblMsg1.Visible = true;
                        // lblMsg1.Text = "Error in the payment gateway";
                    }
                }
                #endregion
            }
            catch (NullReferenceException)
            {
                Response.Redirect("~/Default.aspx", false);
            }
        }
        catch (Exception ex)
        {
            mp3.Show();
            lblerror.Text = ex.Message;
        }
    }
    private DataSet GetRoundtripIntBookingRequest()
    {
        DataSet dsResponse = new DataSet();
        dsIntFlights = (DataSet)Session["dsIntFlights"];
        string result = string.Empty;
        try
        {
            #region Variables
            string str = string.Empty;
            string FlightSegmentsID = string.Empty;
            string DepartureAirportCode = string.Empty;
            string ArrivalDateTime = string.Empty;
            string DepartureAirportName = string.Empty;
            string DepartureDateTime = string.Empty;
            string FlightNumber = string.Empty;
            string MarketingAirlineCode = string.Empty;
            string OperatingAirlineCode = string.Empty;
            string OperatingAirlineName = string.Empty;
            string OperatingAirlineFlightNumber = string.Empty;
            string NumStops = string.Empty;
            string LinkSellAgrmnt = string.Empty;
            string Conx = string.Empty;
            string AirpChg = string.Empty;
            string InsideAvailOption = string.Empty;
            string GenTrafRestriction = string.Empty;
            string DaysOperates = string.Empty;
            string JrnyTm = string.Empty;
            string EndDt = string.Empty;
            string StartTerminal = string.Empty;
            string EndTerminal = string.Empty;
            string FltTm = string.Empty;
            string LSAInd = string.Empty;
            string Mile = string.Empty;
            string Availability = string.Empty;
            string BIC = string.Empty;
            string bookingclass = string.Empty;
            string classType = string.Empty;
            string farebasiscode = string.Empty;
            string Rule = string.Empty;
            string PsgrType = string.Empty;
            string BaseFare = string.Empty;
            string Tax = string.Empty;
            string BagInfo = string.Empty;
            string AirEquipType = string.Empty;
            string ArrivalAirportCode = string.Empty;
            string ArrivalAirportName = string.Empty;
            string return1 = string.Empty;
            string id = string.Empty;
            string key = string.Empty;
            string ActualBaseFare = string.Empty;
            string FareTax = string.Empty;
            string STax = string.Empty;
            string TCharge = string.Empty;
            string SCharge = string.Empty;
            string TDiscount = string.Empty;
            string TMarkup = string.Empty;
            string TPartnerCommission = string.Empty;
            string TSdiscount = string.Empty;
            string FarePsgrType = string.Empty;
            string FareBaseFare = string.Empty;
            string FareTax1 = string.Empty;
            string Country = string.Empty;
            string Amt = string.Empty;
            string ocTax = string.Empty;
            string onwardId = string.Empty;
            string OriginDestinationOption_Id = string.Empty;
            string FareDetails_id = string.Empty;
            string FareBreakUp_Id = string.Empty;
            string FareAry_id = string.Empty;
            string FareId = string.Empty;
            string bookingclassFareId = string.Empty;
            string psgrBreakUp_Id = string.Empty;
            string psgrAy_id = string.Empty;
            string country = string.Empty;
            string taxAmt = string.Empty;
            string taxData = string.Empty;
            string taxDataAry_id = string.Empty;
            string returnId = string.Empty;

            string FlightSegmentsIDRet = string.Empty;
            string DepartureAirportCodeRet = string.Empty;
            string ArrivalDateTimeRet = string.Empty;
            string DepartureAirportNameRet = string.Empty;
            string DepartureDateTimeRet = string.Empty;
            string FlightNumberRet = string.Empty;
            string MarketingAirlineCodeRet = string.Empty;
            string OperatingAirlineCodeRet = string.Empty;
            string OperatingAirlineNameRet = string.Empty;
            string OperatingAirlineFlightNumberRet = string.Empty;
            string NumStopsRet = string.Empty;
            string LinkSellAgrmntRet = string.Empty;
            string ConxRet = string.Empty;
            string AirpChgRet = string.Empty;
            string InsideAvailOptionRet = string.Empty;
            string GenTrafRestrictionRet = string.Empty;
            string DaysOperatesRet = string.Empty;
            string JrnyTmRet = string.Empty;
            string EndDtRet = string.Empty;
            string StartTerminalRet = string.Empty;
            string EndTerminalRet = string.Empty;
            string FltTmRet = string.Empty;
            string LSAIndRet = string.Empty;
            string MileRet = string.Empty;
            string AvailabilityRet = string.Empty;
            string BICRet = string.Empty;
            string bookingclassRet = string.Empty;
            string classTypeRet = string.Empty;
            string farebasiscodeRet = string.Empty;
            string RuleRet = string.Empty;
            string PsgrTypeRet = string.Empty;
            string BaseFareRet = string.Empty;
            string TaxRet = string.Empty;
            string BagInfoRet = string.Empty;
            string AirEquipTypeRet = string.Empty;
            string ArrivalAirportCodeRet = string.Empty;
            string ArrivalAirportNameRet = string.Empty;

            string idRet = string.Empty;
            string keyRet = string.Empty;
            string ActualBaseFareRet = string.Empty;
            string FareTaxRet = string.Empty;
            string STaxRet = string.Empty;
            string TChargeRet = string.Empty;
            string SChargeRet = string.Empty;
            string TDiscountRet = string.Empty;
            string TMarkupRet = string.Empty;
            string TPartnerCommissionRet = string.Empty;
            string TSdiscountRet = string.Empty;
            string FarePsgrTypeRet = string.Empty;
            string FareBaseFareRet = string.Empty;
            string FareTax1Ret = string.Empty;
            string CountryRet = string.Empty;
            string AmtRet = string.Empty;
            string ocTaxRet = string.Empty;
            string onwardIdRet = string.Empty;
            string OriginDestinationOption_IdRet = string.Empty;
            string FareDetails_idRet = string.Empty;
            string FareBreakUp_IdRet = string.Empty;
            string FareAry_idRet = string.Empty;
            string FareIdRet = string.Empty;
            string bookingclassFareIdRet = string.Empty;
            string psgrBreakUp_IdRet = string.Empty;
            string psgrAy_idRet = string.Empty;
            string countryRet = string.Empty;
            string taxAmtRet = string.Empty;
            string taxDataRet = string.Empty;
            string taxDataAry_idRet = string.Empty;
            string returnIdRet = string.Empty;

            string taxdatapsgr = string.Empty;
            string taxdatapsgrRet = string.Empty;
            #endregion

            #region Pricing

            DataTable dtPricingreqOriginDestinationOption = dsIntFlights.Tables["OriginDestinationOption"];
            if (dtPricingreqOriginDestinationOption.Rows.Count > 0)
            {
                DataRow[] rowOriginDestinationOption = dtPricingreqOriginDestinationOption.Select("OriginDestinationOption_Id=" + lblOriginDestinationRoundTrip.Text);
                id = rowOriginDestinationOption[0]["id"].ToString();
                key = rowOriginDestinationOption[0]["key"].ToString();

            }

            //Get Details From roundtrip response
            DataTable dtPricingreqFareDetails = dsIntFlights.Tables["FareDetails"];
            if (dtPricingreqFareDetails.Rows.Count > 0)
            {
                DataRow[] rowFareDetails = dtPricingreqFareDetails.Select("OriginDestinationOption_Id=" + lblOriginDestinationRoundTrip.Text);
                ActualBaseFare = rowFareDetails[0]["ActualBaseFare"].ToString();
                Tax = rowFareDetails[0]["Tax"].ToString();
                STax = rowFareDetails[0]["STax"].ToString();
                TCharge = rowFareDetails[0]["TCharge"].ToString();
                SCharge = rowFareDetails[0]["SCharge"].ToString();
                TDiscount = rowFareDetails[0]["TDiscount"].ToString();
                TMarkup = rowFareDetails[0]["TMarkup"].ToString();
                TPartnerCommission = rowFareDetails[0]["TPartnerCommission"].ToString();
                TSdiscount = rowFareDetails[0]["TSdiscount"].ToString();
                ocTax = rowFareDetails[0]["ocTax"].ToString();
                FareDetails_id = rowFareDetails[0]["FareDetails_id"].ToString();
            }
            DataTable dtPricingreqFareBreakUp = dsIntFlights.Tables["FareBreakUp"];
            if (dtPricingreqFareBreakUp.Rows.Count > 0)
            {
                DataRow[] rowFareBreakUp = dtPricingreqFareBreakUp.Select("FareDetails_Id=" + FareDetails_id);
                FareBreakUp_Id = rowFareBreakUp[0]["FareBreakUp_Id"].ToString();

            }
            DataTable dtPricingreqFareAry = dsIntFlights.Tables["FareAry"];
            if (dtPricingreqFareAry.Rows.Count > 0)
            {
                DataRow[] rowFareAry = dtPricingreqFareAry.Select("FareBreakUp_Id=" + FareBreakUp_Id);
                FareAry_id = rowFareAry[0]["FareAry_id"].ToString();
            }
            DataTable dtPricingreqFare = dsIntFlights.Tables["Fare"];
            if (dtPricingreqFare.Rows.Count > 0)
            {
                DataRow[] rowFare = dtPricingreqFare.Select("FareAry_id=" + FareAry_id);
                PsgrType = rowFare[0]["PsgrType"].ToString();
                BaseFare = rowFare[0]["BaseFare"].ToString();
                FareTax = rowFare[0]["Tax"].ToString();
                FareId = rowFare[0]["Fare_Id"].ToString();
            }

            if (dtPricingreqFare.Rows.Count > 0)
            {
                DataRow[] rowFare = dtPricingreqFare.Select("FareAry_id=" + FareAry_id);
                foreach (DataRow row in rowFare)
                {
                    if (row.Table.Rows.Count == 0)
                    {
                        str = "<Fare><PsgrType>" + row["PsgrType"].ToString() + "</PsgrType><BaseFare>" + row["BaseFare"].ToString() + "</BaseFare><Tax>" + row["Tax"].ToString() + "</Tax></Fare>";
                    }
                    else
                    {
                        str = str + "<Fare><PsgrType>" + row["PsgrType"].ToString() + "</PsgrType><BaseFare>" + row["BaseFare"].ToString() + "</BaseFare><Tax>" + row["Tax"].ToString() + "</Tax></Fare>";//<TaxDataAry>" + str + "</TaxDataAry>
                    }
                }
            }

            FlightBAL objFlightsBal = new FlightBAL();
            string xmlpricingrequestforInt = "<PriceRequest><noadults>" + ddlAdultsInt.SelectedValue + "</noadults><nochild>" + ddlChildsInt.SelectedValue + "</nochild><noinfant>" + ddlInfantsInt.SelectedValue + "</noinfant><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooINTLWS1.0</Clienttype>";
            xmlpricingrequestforInt = xmlpricingrequestforInt + "<OriginDestinationOption><FareDetails><ActualBaseFare>" + ActualBaseFare + "</ActualBaseFare><Tax>" + Tax + "</Tax><STax>" + STax + "</STax><TCharge>" + TCharge + "</TCharge><SCharge>" + SCharge + "</SCharge><TDiscount>" + TDiscount + "</TDiscount><TMarkup>" + TMarkup + "</TMarkup><TPartnerCommission>" + TPartnerCommission + "</TPartnerCommission><TSdiscount>" + TSdiscount + "</TSdiscount><FareBreakup><FareAry>" + str + "</FareAry></FareBreakup><ocTax>" + ocTax + "</ocTax></FareDetails>";//<Fare><PsgrType>" + PsgrType + "</PsgrType><BaseFare>" + BaseFare + "</BaseFare><Tax>" + FareTax + "</Tax></Fare>
            xmlpricingrequestforInt = xmlpricingrequestforInt + "<onward><FlightSegments>";

            DataTable dtpricingreqOnward = dsIntFlights.Tables["Onward"];
            if (dtpricingreqOnward.Rows.Count > 0)
            {
                DataRow[] rowOnward = dtpricingreqOnward.Select("OriginDestinationOption_Id=" + lblOriginDestinationRoundTrip.Text);
                onwardId = rowOnward[0]["onward_id"].ToString();
            }
            DataTable dtpricingreqFlightSegments = dsIntFlights.Tables["FlightSegments"];
            if (dtpricingreqFlightSegments.Rows.Count > 0)
            {
                DataRow[] rowFlightSegments = dtpricingreqFlightSegments.Select("onward_id=" + onwardId);
                FlightSegmentsID = rowFlightSegments[0]["FlightSegments_Id"].ToString();
            }
            DataTable dtpricingreqFlightSegment = dsIntFlights.Tables["FlightSegment"];
            DataTable dtpricingreqBookingClass = dsIntFlights.Tables["BookingClass"];
            DataTable dtpricingreqBookingClassFare = dsIntFlights.Tables["BookingClassFare"];
            DataTable dtpricingreqPsgrBreakUp = dsIntFlights.Tables["PsgrBreakUp"];
            DataTable dtpricingreqPsgrAry = dsIntFlights.Tables["PsgrAry"];
            DataTable dtpricingreqPsgr = dsIntFlights.Tables["Psgr"];
            DataTable dtpricingreqTaxDataAry = dsIntFlights.Tables["TaxDataAry"];
            DataTable dtpricingreqTaxData = dsIntFlights.Tables["TaxData"];

            if (dtpricingreqFlightSegment.Rows.Count > 0)
            {
                DataRow[] rowFlightSegment = dtpricingreqFlightSegment.Select("FlightSegments_Id=" + FlightSegmentsID);
                for (int i = 0; i < rowFlightSegment.Length; i++)
                {

                    AirEquipType = rowFlightSegment[i]["AirEquipType"].ToString();
                    ArrivalAirportCode = rowFlightSegment[i]["ArrivalAirportCode"].ToString();
                    ArrivalAirportName = rowFlightSegment[i]["ArrivalAirportName"].ToString();
                    ArrivalDateTime = rowFlightSegment[i]["ArrivalDateTime"].ToString();
                    DepartureAirportCode = rowFlightSegment[i]["DepartureAirportCode"].ToString();
                    DepartureAirportName = rowFlightSegment[i]["DepartureAirportName"].ToString();
                    DepartureDateTime = rowFlightSegment[i]["DepartureDateTime"].ToString();
                    FlightNumber = rowFlightSegment[i]["FlightNumber"].ToString();
                    MarketingAirlineCode = rowFlightSegment[i]["MarketingAirlineCode"].ToString();
                    OperatingAirlineCode = rowFlightSegment[i]["OperatingAirlineCode"].ToString();
                    OperatingAirlineName = rowFlightSegment[i]["OperatingAirlineName"].ToString();
                    OperatingAirlineFlightNumber = rowFlightSegment[i]["OperatingAirlineFlightNumber"].ToString();
                    NumStops = rowFlightSegment[i]["NumStops"].ToString();
                    LinkSellAgrmnt = rowFlightSegment[i]["LinkSellAgrmnt"].ToString();
                    Conx = rowFlightSegment[i]["Conx"].ToString();
                    AirpChg = rowFlightSegment[i]["AirpChg"].ToString();
                    InsideAvailOption = rowFlightSegment[i]["InsideAvailOption"].ToString();
                    GenTrafRestriction = rowFlightSegment[i]["GenTrafRestriction"].ToString();
                    DaysOperates = rowFlightSegment[i]["DaysOperates"].ToString();
                    JrnyTm = rowFlightSegment[i]["JrnyTm"].ToString();
                    EndDt = rowFlightSegment[i]["EndDt"].ToString();
                    StartTerminal = rowFlightSegment[i]["StartTerminal"].ToString();
                    EndTerminal = rowFlightSegment[i]["EndTerminal"].ToString();
                    FltTm = rowFlightSegment[i]["FltTm"].ToString();
                    LSAInd = rowFlightSegment[i]["LSAInd"].ToString();
                    Mile = rowFlightSegment[i]["Mile"].ToString();

                    if (dtpricingreqBookingClass.Rows.Count > 0)
                    {
                        DataRow[] rowBookingClass = dtpricingreqBookingClass.Select("FlightSegment_Id=" + rowFlightSegment[i]["FlightSegment_Id"].ToString());
                        Availability = rowBookingClass[0]["Availability"].ToString();
                        BIC = rowBookingClass[0]["BIC"].ToString();
                    }

                    if (dtpricingreqBookingClassFare.Rows.Count > 0)
                    {
                        DataRow[] rowBookingClassFare = dtpricingreqBookingClassFare.Select("FlightSegment_Id=" + rowFlightSegment[i]["FlightSegment_Id"].ToString());
                        bookingclass = rowBookingClassFare[0]["bookingclass"].ToString();
                        classType = rowBookingClassFare[0]["classType"].ToString();
                        farebasiscode = rowBookingClassFare[0]["farebasiscode"].ToString();
                        Rule = rowBookingClassFare[0]["Rule"].ToString();
                        if (dtpricingreqBookingClassFare.Columns.Contains("bookingclassFare_Id"))
                        {
                            bookingclassFareId = rowBookingClassFare[0]["bookingclassFare_Id"].ToString();
                        }

                    }
                    if (dtpricingreqBookingClassFare.Columns.Contains("bookingclassFare_Id"))
                    {
                        if (dtpricingreqPsgrBreakUp.Rows.Count > 0)
                        {
                            DataRow[] rowPsgrBreakUp = dtpricingreqPsgrBreakUp.Select("bookingclassFare_Id=" + bookingclassFareId);
                            psgrBreakUp_Id = rowPsgrBreakUp[0]["psgrBreakUp_Id"].ToString();

                        }

                        if (dtpricingreqPsgrAry.Rows.Count > 0)
                        {
                            DataRow[] rowPsgrAry = dtpricingreqPsgrAry.Select("psgrBreakUp_Id=" + psgrBreakUp_Id);
                            psgrAy_id = rowPsgrAry[0]["psgrAry_Id"].ToString();

                        }

                        if (dtpricingreqPsgr.Rows.Count > 0)
                        {
                            DataRow[] rowPsgr = dtpricingreqPsgr.Select("psgrAry_Id=" + psgrAy_id);
                            FarePsgrType = rowPsgr[0]["psgrType"].ToString();
                            FareBaseFare = rowPsgr[0]["BaseFare"].ToString();
                            FareTax1 = rowPsgr[0]["Tax"].ToString();
                            BagInfo = rowPsgr[0]["BagInfo"].ToString();

                        }

                        if (dtpricingreqPsgr.Rows.Count > 0)
                        {
                            DataRow[] rowPsgr = dtpricingreqPsgr.Select("psgrAry_Id=" + psgrAy_id);
                            foreach (DataRow rows in rowPsgr)
                            {
                                if (rows.Table.Rows.Count == 0)
                                {
                                    taxdatapsgr = "<Psgr><PsgrType>" + rows["psgrType"].ToString() + "</PsgrType><BaseFare>" + rows["BaseFare"].ToString() + "</BaseFare><Tax>" + rows["Tax"].ToString() + "</Tax><BagInfo>" + rows["BagInfo"].ToString() + "</BagInfo></Psgr>";
                                }
                                else
                                {
                                    taxdatapsgr = taxdatapsgr + "<Psgr><PsgrType>" + rows["psgrType"].ToString() + "</PsgrType><BaseFare>" + rows["BaseFare"].ToString() + "</BaseFare><Tax>" + rows["Tax"].ToString() + "</Tax><BagInfo>" + rows["BagInfo"].ToString() + "</BagInfo></Psgr>";
                                }
                            }
                        }
                    }

                    if (dtpricingreqTaxDataAry.Rows.Count > 0)
                    {
                        DataRow[] rowTaxDataAry = dtpricingreqTaxDataAry.Select("Fare_id=" + FareId);
                        taxDataAry_id = rowTaxDataAry[0]["TaxdataAry_Id"].ToString();
                    }

                    if (dtpricingreqTaxData.Rows.Count > 0)
                    {
                        DataRow[] rowTaxData = dtpricingreqTaxData.Select("TaxdataAry_Id=" + taxDataAry_id);
                        for (int j = 0; j < rowTaxData.Length; j++)
                        {
                            if (rowTaxData.Length == 0)
                            {
                                taxData = "<TaxData><Country>" + rowTaxData[j]["Country"].ToString() + "</Country><Amt>" + rowTaxData[j]["Amt"].ToString() + "</Amt></TaxData>";
                            }
                            else
                            {
                                taxData = taxData + "<TaxData><Country>" + rowTaxData[j]["Country"].ToString() + "</Country><Amt>" + rowTaxData[j]["Amt"].ToString() + "</Amt></TaxData>";
                            }
                        }

                    }

                    xmlpricingrequestforInt = xmlpricingrequestforInt + "<FlightSegment><AirEquipType>" + AirEquipType + "</AirEquipType><ArrivalAirportCode>" + ArrivalAirportCode + "</ArrivalAirportCode><ArrivalAirportName>" + ArrivalAirportName + "</ArrivalAirportName><ArrivalDateTime>" + ArrivalDateTime + "</ArrivalDateTime><DepartureAirportCode>" + DepartureAirportCode + "</DepartureAirportCode><DepartureAirportName>" + DepartureAirportName + "</DepartureAirportName><DepartureDateTime>" + DepartureDateTime + "</DepartureDateTime><FlightNumber>" + FlightNumber + "</FlightNumber>";
                    xmlpricingrequestforInt = xmlpricingrequestforInt + "<MarketingAirlineCode>" + MarketingAirlineCode + "</MarketingAirlineCode><OperatingAirlineCode>" + OperatingAirlineCode + "</OperatingAirlineCode><OperatingAirlineName>" + OperatingAirlineName + "</OperatingAirlineName><OperatingAirlineFlightNumber>" + OperatingAirlineFlightNumber + "</OperatingAirlineFlightNumber><NumStops>" + NumStops + "</NumStops><LinkSellAgrmnt>" + LinkSellAgrmnt + "</LinkSellAgrmnt><Conx>" + Conx + "</Conx><AirpChg>" + AirpChg + "</AirpChg><InsideAvailOption>" + InsideAvailOption + "</InsideAvailOption><GenTrafRestriction>" + GenTrafRestriction + "</GenTrafRestriction><DaysOperates>" + DaysOperates + "</DaysOperates><JrnyTm>" + JrnyTm + "</JrnyTm><EndDt>" + EndDt + "</EndDt><StartTerminal>" + StartTerminal + "</StartTerminal><EndTerminal>" + EndTerminal + "</EndTerminal>";
                    xmlpricingrequestforInt = xmlpricingrequestforInt + "<FltTm>" + FltTm + "</FltTm><LSAInd>" + LSAInd + "</LSAInd><Mile>" + Mile + "</Mile><BookingClass><Availability>" + Availability + "</Availability><BIC>" + BIC + "</BIC></BookingClass><BookingClassFare><bookingclass>" + bookingclass + "</bookingclass><classType>" + classType + "</classType><farebasiscode>" + farebasiscode + "</farebasiscode><Rule>" + Rule.Replace("<", "&lt;").Replace(">", "&gt;") + "</Rule>";
                    if (dtpricingreqBookingClassFare.Columns.Contains("bookingclassFare_Id"))
                    {
                        xmlpricingrequestforInt = xmlpricingrequestforInt + "<PsgrBreakup><PsgrAry>" + taxdatapsgr + "</PsgrAry></PsgrBreakup>";
                    }
                    xmlpricingrequestforInt = xmlpricingrequestforInt + "</BookingClassFare></FlightSegment>";//<Psgr><PsgrType>" + FarePsgrType + "</PsgrType><BaseFare>" + FareBaseFare + "</BaseFare><Tax>" + FareTax1 + "</Tax><BagInfo></BagInfo></Psgr>

                }
            }

            xmlpricingrequestforInt = xmlpricingrequestforInt + "</FlightSegments></onward><Return><FlightSegments>";

            DataTable dtpricingreqReturn = dsIntFlights.Tables["Return"];
            if (dtpricingreqReturn.Rows.Count > 0)
            {
                DataRow[] rowReturn = dtpricingreqReturn.Select("OriginDestinationOption_Id=" + lblOriginDestinationRoundTrip.Text);
                returnId = rowReturn[0]["return_id"].ToString();
            }
            DataTable dtpricingreqFlightSegmentsRet = dsIntFlights.Tables["FlightSegments"];
            if (dtpricingreqFlightSegmentsRet.Rows.Count > 0)
            {
                DataRow[] rowFlightSegmentsRet = dtpricingreqFlightSegmentsRet.Select("return_id=" + returnId);
                FlightSegmentsIDRet = rowFlightSegmentsRet[0]["FlightSegments_Id"].ToString();
            }
            DataTable dtpricingreqFlightSegmentRet = dsIntFlights.Tables["FlightSegment"];
            DataTable dtpricingreqBookingClassRet = dsIntFlights.Tables["BookingClass"];
            DataTable dtpricingreqBookingClassFareRet = dsIntFlights.Tables["BookingClassFare"];
            DataTable dtpricingreqPsgrBreakUpRet = dsIntFlights.Tables["PsgrBreakUp"];
            DataTable dtpricingreqPsgrAryRet = dsIntFlights.Tables["PsgrAry"];
            DataTable dtpricingreqPsgrRet = dsIntFlights.Tables["Psgr"];
            DataTable dtpricingreqTaxDataAryRet = dsIntFlights.Tables["TaxDataAry"];
            DataTable dtpricingreqTaxDataRet = dsIntFlights.Tables["TaxData"];

            if (dtpricingreqFlightSegmentRet.Rows.Count > 0)
            {
                DataRow[] rowFlightSegmentRet = dtpricingreqFlightSegmentRet.Select("FlightSegments_Id=" + FlightSegmentsIDRet);
                for (int i = 0; i < rowFlightSegmentRet.Length; i++)
                {

                    AirEquipTypeRet = rowFlightSegmentRet[i]["AirEquipType"].ToString();
                    ArrivalAirportCodeRet = rowFlightSegmentRet[i]["ArrivalAirportCode"].ToString();
                    ArrivalAirportNameRet = rowFlightSegmentRet[i]["ArrivalAirportName"].ToString();
                    ArrivalDateTimeRet = rowFlightSegmentRet[i]["ArrivalDateTime"].ToString();
                    DepartureAirportCodeRet = rowFlightSegmentRet[i]["DepartureAirportCode"].ToString();
                    DepartureAirportNameRet = rowFlightSegmentRet[i]["DepartureAirportName"].ToString();
                    DepartureDateTimeRet = rowFlightSegmentRet[i]["DepartureDateTime"].ToString();
                    FlightNumberRet = rowFlightSegmentRet[i]["FlightNumber"].ToString();
                    MarketingAirlineCodeRet = rowFlightSegmentRet[i]["MarketingAirlineCode"].ToString();
                    OperatingAirlineCodeRet = rowFlightSegmentRet[i]["OperatingAirlineCode"].ToString();
                    OperatingAirlineNameRet = rowFlightSegmentRet[i]["OperatingAirlineName"].ToString();
                    OperatingAirlineFlightNumberRet = rowFlightSegmentRet[i]["OperatingAirlineFlightNumber"].ToString();
                    NumStopsRet = rowFlightSegmentRet[i]["NumStops"].ToString();
                    LinkSellAgrmntRet = rowFlightSegmentRet[i]["LinkSellAgrmnt"].ToString();
                    ConxRet = rowFlightSegmentRet[i]["Conx"].ToString();
                    AirpChgRet = rowFlightSegmentRet[i]["AirpChg"].ToString();
                    InsideAvailOptionRet = rowFlightSegmentRet[i]["InsideAvailOption"].ToString();
                    GenTrafRestrictionRet = rowFlightSegmentRet[i]["GenTrafRestriction"].ToString();
                    DaysOperatesRet = rowFlightSegmentRet[i]["DaysOperates"].ToString();
                    JrnyTmRet = rowFlightSegmentRet[i]["JrnyTm"].ToString();
                    EndDtRet = rowFlightSegmentRet[i]["EndDt"].ToString();
                    StartTerminalRet = rowFlightSegmentRet[i]["StartTerminal"].ToString();
                    EndTerminalRet = rowFlightSegmentRet[i]["EndTerminal"].ToString();
                    FltTmRet = rowFlightSegmentRet[i]["FltTm"].ToString();
                    LSAIndRet = rowFlightSegmentRet[i]["LSAInd"].ToString();
                    MileRet = rowFlightSegmentRet[i]["Mile"].ToString();

                    if (dtpricingreqBookingClassRet.Rows.Count > 0)
                    {
                        DataRow[] rowBookingClassRet = dtpricingreqBookingClassRet.Select("FlightSegment_Id=" + rowFlightSegmentRet[i]["FlightSegment_Id"].ToString());
                        AvailabilityRet = rowBookingClassRet[0]["Availability"].ToString();
                        BICRet = rowBookingClassRet[0]["BIC"].ToString();
                    }

                    if (dtpricingreqBookingClassFareRet.Rows.Count > 0)
                    {
                        DataRow[] rowBookingClassFareRet = dtpricingreqBookingClassFareRet.Select("FlightSegment_Id=" + rowFlightSegmentRet[i]["FlightSegment_Id"].ToString());
                        bookingclassRet = rowBookingClassFareRet[0]["bookingclass"].ToString();
                        classTypeRet = rowBookingClassFareRet[0]["classType"].ToString();
                        farebasiscodeRet = rowBookingClassFareRet[0]["farebasiscode"].ToString();
                        RuleRet = rowBookingClassFareRet[0]["Rule"].ToString();
                        if (dtpricingreqBookingClassFareRet.Columns.Contains("bookingclassFare_Id"))
                        {
                            bookingclassFareIdRet = rowBookingClassFareRet[0]["bookingclassFare_Id"].ToString();
                        }
                    }
                    if (dtpricingreqBookingClassFareRet.Columns.Contains("bookingclassFare_Id"))
                    {
                        if (dtpricingreqPsgrBreakUpRet.Rows.Count > 0)
                        {
                            DataRow[] rowPsgrBreakUpRet = dtpricingreqPsgrBreakUpRet.Select("bookingclassFare_Id=" + bookingclassFareIdRet);
                            psgrBreakUp_IdRet = rowPsgrBreakUpRet[0]["psgrBreakUp_Id"].ToString();

                        }

                        if (dtpricingreqPsgrAryRet.Rows.Count > 0)
                        {
                            DataRow[] rowPsgrAryRet = dtpricingreqPsgrAryRet.Select("psgrBreakUp_Id=" + psgrBreakUp_IdRet);
                            psgrAy_idRet = rowPsgrAryRet[0]["psgrAry_Id"].ToString();

                        }

                        if (dtpricingreqPsgrRet.Rows.Count > 0)
                        {
                            DataRow[] rowPsgrRet = dtpricingreqPsgrRet.Select("psgrAry_Id=" + psgrAy_idRet);
                            FarePsgrTypeRet = rowPsgrRet[0]["psgrType"].ToString();
                            FareBaseFareRet = rowPsgrRet[0]["BaseFare"].ToString();
                            FareTax1Ret = rowPsgrRet[0]["Tax"].ToString();
                            BagInfoRet = rowPsgrRet[0]["BagInfo"].ToString();

                        }

                        if (dtpricingreqPsgrRet.Rows.Count > 0)
                        {
                            DataRow[] rowPsgr = dtpricingreqPsgrRet.Select("psgrAry_Id=" + psgrAy_idRet);
                            foreach (DataRow rows in rowPsgr)
                            {
                                if (rows.Table.Rows.Count == 0)
                                {
                                    taxdatapsgrRet = "<Psgr><PsgrType>" + rows["psgrType"].ToString() + "</PsgrType><BaseFare>" + rows["BaseFare"].ToString() + "</BaseFare><Tax>" + rows["Tax"].ToString() + "</Tax><BagInfo>" + rows["BagInfo"].ToString() + "</BagInfo></Psgr>";
                                }
                                else
                                {
                                    taxdatapsgrRet = taxdatapsgrRet + "<Psgr><PsgrType>" + rows["psgrType"].ToString() + "</PsgrType><BaseFare>" + rows["BaseFare"].ToString() + "</BaseFare><Tax>" + rows["Tax"].ToString() + "</Tax><BagInfo>" + rows["BagInfo"].ToString() + "</BagInfo></Psgr>";
                                }
                            }
                        }
                    }
                    //if (dtTaxDataAryRet.Rows.Count > 0)
                    //{
                    //    DataRow[] rowTaxDataAryRet = dtTaxDataAryRet.Select("Fare_id=" + FareIdRet);
                    //    taxDataAry_id = rowTaxDataAryRet[0]["TaxdataAry_Id"].ToString();
                    //}

                    //if (dtTaxDataRet.Rows.Count > 0)
                    //{
                    //    DataRow[] rowTaxDataRet = dtTaxDataRet.Select("TaxdataAry_Id=" + taxDataAry_idRet);
                    //    for (int j = 0; j < rowTaxDataRet.Length; j++)
                    //    {
                    //        if (rowTaxDataRet.Length == 0)
                    //        {
                    //            taxDataRet = "<TaxData><Country>" + rowTaxDataRet[j]["Country"].ToString() + "</Country><Amt>" + rowTaxDataRet[j]["Amt"].ToString() + "</Amt></TaxData>";
                    //        }
                    //        else
                    //        {
                    //            taxDataRet = taxDataRet + "<TaxData><Country>" + rowTaxDataRet[j]["Country"].ToString() + "</Country><Amt>" + rowTaxDataRet[j]["Amt"].ToString() + "</Amt></TaxData>";
                    //        }
                    //    }

                    //}

                    xmlpricingrequestforInt = xmlpricingrequestforInt + "<FlightSegment><AirEquipType>" + AirEquipTypeRet + "</AirEquipType><ArrivalAirportCode>" + ArrivalAirportCodeRet + "</ArrivalAirportCode><ArrivalAirportName>" + ArrivalAirportNameRet + "</ArrivalAirportName><ArrivalDateTime>" + ArrivalDateTimeRet + "</ArrivalDateTime><DepartureAirportCode>" + DepartureAirportCodeRet + "</DepartureAirportCode><DepartureAirportName>" + DepartureAirportNameRet + "</DepartureAirportName><DepartureDateTime>" + DepartureDateTimeRet + "</DepartureDateTime><FlightNumber>" + FlightNumberRet + "</FlightNumber>";
                    xmlpricingrequestforInt = xmlpricingrequestforInt + "<MarketingAirlineCode>" + MarketingAirlineCodeRet + "</MarketingAirlineCode><OperatingAirlineCode>" + OperatingAirlineCodeRet + "</OperatingAirlineCode><OperatingAirlineName>" + OperatingAirlineNameRet + "</OperatingAirlineName><OperatingAirlineFlightNumber>" + OperatingAirlineFlightNumberRet + "</OperatingAirlineFlightNumber><NumStops>" + NumStopsRet + "</NumStops><LinkSellAgrmnt>" + LinkSellAgrmntRet + "</LinkSellAgrmnt><Conx>" + ConxRet + "</Conx><AirpChg>" + AirpChgRet + "</AirpChg><InsideAvailOption>" + InsideAvailOptionRet + "</InsideAvailOption><GenTrafRestriction>" + GenTrafRestrictionRet + "</GenTrafRestriction><DaysOperates>" + DaysOperatesRet + "</DaysOperates><JrnyTm>" + JrnyTmRet + "</JrnyTm><EndDt>" + EndDtRet + "</EndDt><StartTerminal>" + StartTerminalRet + "</StartTerminal><EndTerminal>" + EndTerminalRet + "</EndTerminal>";
                    xmlpricingrequestforInt = xmlpricingrequestforInt + "<FltTm>" + FltTmRet + "</FltTm><LSAInd>" + LSAIndRet + "</LSAInd><Mile>" + MileRet + "</Mile><BookingClass><Availability>" + AvailabilityRet + "</Availability><BIC>" + BICRet + "</BIC></BookingClass><BookingClassFare><bookingclass>" + bookingclassRet + "</bookingclass><classType>" + classTypeRet + "</classType><farebasiscode>" + farebasiscodeRet + "</farebasiscode><Rule>" + RuleRet.Replace("<", "&lt;").Replace(">", "&gt;") + "</Rule>";
                    if (dtpricingreqBookingClassFareRet.Columns.Contains("bookingclassFare_Id"))
                    {
                        xmlpricingrequestforInt = xmlpricingrequestforInt + "<PsgrBreakup><PsgrAry>" + taxdatapsgrRet + "</PsgrAry></PsgrBreakup>";

                    }
                    xmlpricingrequestforInt = xmlpricingrequestforInt + "</BookingClassFare></FlightSegment>";//<Psgr><PsgrType>" + FarePsgrTypeRet + "</PsgrType><BaseFare>" + FareBaseFareRet + "</BaseFare><Tax>" + FareTax1Ret + "</Tax><BagInfo></BagInfo></Psgr>

                }
            }
            xmlpricingrequestforInt = xmlpricingrequestforInt + "</FlightSegments></Return><id>" + id + "</id><key>" + key + "</key>";
            xmlpricingrequestforInt = xmlpricingrequestforInt + "</OriginDestinationOption></PriceRequest>";
            //                              <FlightSegment><AirEquipType>744</AirEquipType><ArrivalAirportCode>LHR</ArrivalAirportCode><ArrivalAirportName>LONDON&lt;BR&gt; (HEATHROW)</ArrivalAirportName><ArrivalDateTime>2010-02-24T06:55:00</ArrivalDateTime><DepartureAirportCode>BOM</DepartureAirportCode><DepartureAirportName>MUMBAI&lt;BR&gt;(CHHATRAPATI SHIVAJI INTERNATIONAL)</DepartureAirportName><DepartureDateTime>2010-02-24T02:45:00</DepartureDateTime><FlightNumber>138</FlightNumber><MarketingAirlineCode>BA</MarketingAirlineCode><OperatingAirlineCode>BA</OperatingAirlineCode><OperatingAirlineName>British Airways </OperatingAirlineName><OperatingAirlineFlightNumber>138</OperatingAirlineFlightNumber><NumStops>0</NumStops>" +
            //       "<LinkSellAgrmnt></LinkSellAgrmnt><Conx>N</Conx><AirpChg>N</AirpChg><InsideAvailOption>C</InsideAvailOption><GenTrafRestriction>?</GenTrafRestriction><DaysOperates>NA</DaysOperates><JrnyTm></JrnyTm><EndDt></EndDt><StartTerminal></StartTerminal><EndTerminal></EndTerminal><FltTm>0</FltTm><LSAInd>R</LSAInd><Mile>0</Mile><BookingClass><Availability>9</Availability><BIC>N</BIC></BookingClass><BookingClassFare><bookingclass>N</bookingclass><classType>Economy</classType><farebasiscode>NLRCAS|RP|V-BA|BOM-JFK</farebasiscode><Rule></Rule><PsgrBreakup><PsgrAry><Psgr><PsgrType>ADT</PsgrType><BaseFare>32000</BaseFare><Tax>21675</Tax><BagInfo></BagInfo></Psgr></PsgrAry></PsgrBreakup></BookingClassFare></FlightSegment><FlightSegment>" +
            // "<AirEquipType>777</AirEquipType><ArrivalAirportCode>JFK</ArrivalAirportCode><ArrivalAirportName>NEW YORK&lt;BR&gt;(JOHN F KENNEDY INTL)</ArrivalAirportName><ArrivalDateTime>2010-02-24T13:55:00</ArrivalDateTime><DepartureAirportCode>LHR</DepartureAirportCode><DepartureAirportName>LONDON&lt;BR&gt; (HEATHROW)</DepartureAirportName><DepartureDateTime>2010-02-24T11:00:00</DepartureDateTime><FlightNumber>175</FlightNumber><MarketingAirlineCode>BA</MarketingAirlineCode><OperatingAirlineCode>BA</OperatingAirlineCode><OperatingAirlineName>British Airways </OperatingAirlineName><OperatingAirlineFlightNumber>175</OperatingAirlineFlightNumber><NumStops>0</NumStops>" +
            //     "<LinkSellAgrmnt></LinkSellAgrmnt><Conx>N</Conx><AirpChg>N</AirpChg><InsideAvailOption>C</InsideAvailOption><GenTrafRestriction>?</GenTrafRestriction><DaysOperates>NA</DaysOperates><JrnyTm></JrnyTm><EndDt></EndDt><StartTerminal></StartTerminal><EndTerminal></EndTerminal><FltTm>0</FltTm><LSAInd>R</LSAInd><Mile>0</Mile><BookingClass><Availability>9</Availability><BIC>N</BIC></BookingClass><BookingClassFare><bookingclass>N</bookingclass><classType>Economy</classType><farebasiscode>NLRCAS|RP|V-BA|BOM-JFK</farebasiscode><Rule></Rule><PsgrBreakup><PsgrAry><Psgr><PsgrType>ADT</PsgrType><BaseFare>32000</BaseFare><Tax>21675</Tax><BagInfo></BagInfo></Psgr></PsgrAry></PsgrBreakup></BookingClassFare></FlightSegment></FlightSegments></onward>" +
            // "<Return><FlightSegments><FlightSegment><AirEquipType>777</AirEquipType><ArrivalAirportCode>LHR</ArrivalAirportCode><ArrivalAirportName>LONDON&lt;BR&gt; (HEATHROW)</ArrivalAirportName><ArrivalDateTime>2010-02-26T07:50:00</ArrivalDateTime><DepartureAirportCode>JFK</DepartureAirportCode><DepartureAirportName>NEW YORK&lt;BR&gt;(JOHN F KENNEDY INTL)</DepartureAirportName><DepartureDateTime>2010-02-25T19:40:00</DepartureDateTime><FlightNumber>176</FlightNumber>
            //<MarketingAirlineCode>BA</MarketingAirlineCode><OperatingAirlineCode>BA</OperatingAirlineCode>" +
            //    " <OperatingAirlineName>British Airways </OperatingAirlineName><OperatingAirlineFlightNumber>176</OperatingAirlineFlightNumber>
            //<NumStops>0</NumStops><LinkSellAgrmnt></LinkSellAgrmnt><Conx>N</Conx><AirpChg>N</AirpChg><InsideAvailOption>C</InsideAvailOption><GenTrafRestriction>?</GenTrafRestriction><DaysOperates>NA</DaysOperates><JrnyTm></JrnyTm><EndDt></EndDt><StartTerminal></StartTerminal><EndTerminal></EndTerminal><FltTm>0</FltTm><LSAInd>R</LSAInd><Mile>0</Mile><BookingClass><Availability>9</Availability><BIC>N</BIC></BookingClass><BookingClassFare><bookingclass>N</bookingclass><classType>Economy</classType><farebasiscode>NLRCAS|RP|V-BA|JFK-BOM</farebasiscode>" +
            // "<Rule></Rule><PsgrBreakup><PsgrAry><Psgr><PsgrType>ADT</PsgrType><BaseFare>32000</BaseFare><Tax>21675</Tax><BagInfo></BagInfo></Psgr></PsgrAry></PsgrBreakup></BookingClassFare></FlightSegment><FlightSegment><AirEquipType>744</AirEquipType><ArrivalAirportCode>BOM</ArrivalAirportCode><ArrivalAirportName>MUMBAI&lt;BR&gt;(CHHATRAPATI SHIVAJI INTERNATIONAL)</ArrivalAirportName><ArrivalDateTime>2010-02-27T00:45:00</ArrivalDateTime><DepartureAirportCode>LHR</DepartureAirportCode><DepartureAirportName>LONDON&lt;BR&gt;(HEATHROW)</DepartureAirportName><DepartureDateTime>2010-02-26T10:30:00</DepartureDateTime><FlightNumber>139</FlightNumber><MarketingAirlineCode>BA</MarketingAirlineCode><OperatingAirlineCode>BA</OperatingAirlineCode>" +
            //    " <OperatingAirlineName>British Airways </OperatingAirlineName><OperatingAirlineFlightNumber>139</OperatingAirlineFlightNumber><NumStops>0</NumStops><LinkSellAgrmnt></LinkSellAgrmnt><Conx>N</Conx><AirpChg>N</AirpChg><InsideAvailOption>C</InsideAvailOption><GenTrafRestriction>?</GenTrafRestriction><DaysOperates>NA</DaysOperates><JrnyTm></JrnyTm><EndDt></EndDt><StartTerminal></StartTerminal><EndTerminal></EndTerminal><FltTm>0</FltTm><LSAInd>R</LSAInd><Mile>0</Mile><BookingClass><Availability>9</Availability><BIC>N</BIC></BookingClass><BookingClassFare><bookingclass>N</bookingclass><classType>Economy</classType><farebasiscode>NLRCAS|RP|V-BA|JFK-BOM</farebasiscode><Rule></Rule>" +
            //" <PsgrBreakup><PsgrAry><Psgr><PsgrType>ADT</PsgrType><BaseFare>32000</BaseFare><Tax>21675</Tax><BagInfo></BagInfo></Psgr></PsgrAry></PsgrBreakup></BookingClassFare></FlightSegment></FlightSegments></Return><id>arzoo35</id><key>pG4C0YQykzzTREhDdDdZxah4nJ/Bta4FgUl36m3L9/Vn4uu9m7LCssMPJ4Xz20E7cCU/hS9xGEdUAkpDcwlKw=</key></OriginDestinationOption></PriceRequest>";

            DataSet dsPricingResponse = objFlightsBal.GetDatasetFromAPI(xmlpricingrequestforInt, "http://live.arzoo.com:9302/Pricing");

            if (!dsPricingResponse.Tables[0].Columns.Contains("error"))
            {
                DataTable dtpricingresFareDetails = dsPricingResponse.Tables["FareDetails"];
                if (dtpricingresFareDetails.Rows.Count > 0)
                {
                    DataRow[] rowFareDetails = dtpricingresFareDetails.Select("OriginDestinationOption_Id=" + lblOriginDestinationRoundTrip.Text);
                    ActualBaseFare = rowFareDetails[0]["ActualBaseFare"].ToString();
                    Tax = rowFareDetails[0]["Tax"].ToString();
                    STax = rowFareDetails[0]["STax"].ToString();
                    TCharge = rowFareDetails[0]["TCharge"].ToString();
                    SCharge = rowFareDetails[0]["SCharge"].ToString();
                    TDiscount = rowFareDetails[0]["TDiscount"].ToString();
                    TMarkup = rowFareDetails[0]["TMarkup"].ToString();
                    TPartnerCommission = rowFareDetails[0]["TPartnerCommission"].ToString();
                    TSdiscount = rowFareDetails[0]["TSdiscount"].ToString();
                    ocTax = rowFareDetails[0]["ocTax"].ToString();
                    FareDetails_id = rowFareDetails[0]["FareDetails_id"].ToString();
                }
            }

            #endregion

            string ref1 = Common.GetFlightsReferenceNo("LJIF");
            string xmlRequest = "<Bookingrequest><noadults>" + ddlAdultsInt.SelectedValue + "</noadults><nochild>" + ddlChildsInt.SelectedValue + "</nochild><noinfant>" + ddlInfantsInt.SelectedValue + "</noinfant><Clientid>" + FlightsConstants.USERID + "</Clientid><Clientpassword>" + FlightsConstants.PASSWORD + "</Clientpassword><Clienttype>ArzooINTLWS1.0</Clienttype><creditcardno></creditcardno><PartnerreferenceID>" + ref1 + "</PartnerreferenceID>";
            xmlRequest = xmlRequest + "<personName>";

            // Dynamic generation of names of adults, infants , Child
            Table tbladults = (Table)this.UpdatePanel2.FindControl("tblAdultsInt");
            for (int i = 1; i <= Convert.ToInt32(Session["adultCntInt"]); i++)
            {

                TextBox txtFn = (TextBox)tbladults.FindControl("txtFnInt" + i);
                TextBox txtLn = (TextBox)tbladults.FindControl("txtLnInt" + i);
                DropDownList ddlTitle = (DropDownList)tbladults.FindControl("ddlTitleInt" + i);

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

            Table tblChild = (Table)this.UpdatePanel2.FindControl("tblChildInt");
            for (int i = 1; i <= Convert.ToInt32(Session["childCntInt"]); i++)
            {
                TextBox txtFn = (TextBox)tblChild.FindControl("txtCFnInt" + i);

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

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

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

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

                //if (Convert.ToInt32(age) > 5)
                //{
                //    Literal lit = new Literal();
                //    lit.Text = "age is null";
                //    this.Page.Controls.Add(lit);
                //    break;
                //}

                xmlRequest = xmlRequest + "<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.UpdatePanel2.FindControl("tblInfantsInt");
            for (int i = 1; i <= Convert.ToInt32(Session["infantCntInt"]); i++)
            {
                TextBox txtFn = (TextBox)tblInfants.FindControl("txtIFnInt" + i);

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

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

                TextBox txtBirthDate = (TextBox)tblInfants.FindControl("txtIBirthDateInt" + i);
                string age = string.Empty;
                if (txtBirthDate != null)
                    age = (DateTime.Now.Year - Convert.ToDateTime(txtBirthDate.Text).Year).ToString();
                else
                    age = "0";
                xmlRequest = xmlRequest + "<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>";
            }

            DataTable dtOriginDestinationOption = dsIntFlights.Tables["OriginDestinationOption"];
            if (dtOriginDestinationOption.Rows.Count > 0)
            {
                DataRow[] rowOriginDestinationOption = dtOriginDestinationOption.Select("OriginDestinationOption_Id=" + lblOriginDestinationRoundTrip.Text);
                id = rowOriginDestinationOption[0]["id"].ToString();
                key = rowOriginDestinationOption[0]["key"].ToString();

            }

            //Get Details From roundtrip response
            DataTable dtFareDetails = dsIntFlights.Tables["FareDetails"];
            if (dtFareDetails.Rows.Count > 0)
            {
                DataRow[] rowFareDetails = dtFareDetails.Select("OriginDestinationOption_Id=" + lblOriginDestinationRoundTrip.Text);
                ActualBaseFare = rowFareDetails[0]["ActualBaseFare"].ToString();
                Tax = rowFareDetails[0]["Tax"].ToString();
                STax = rowFareDetails[0]["STax"].ToString();
                TCharge = rowFareDetails[0]["TCharge"].ToString();
                SCharge = rowFareDetails[0]["SCharge"].ToString();
                TDiscount = rowFareDetails[0]["TDiscount"].ToString();
                TMarkup = rowFareDetails[0]["TMarkup"].ToString();
                TPartnerCommission = rowFareDetails[0]["TPartnerCommission"].ToString();
                TSdiscount = rowFareDetails[0]["TSdiscount"].ToString();
                ocTax = rowFareDetails[0]["ocTax"].ToString();
                FareDetails_id = rowFareDetails[0]["FareDetails_id"].ToString();
            }
            DataTable dtFareBreakUp = dsIntFlights.Tables["FareBreakUp"];
            if (dtFareBreakUp.Rows.Count > 0)
            {
                DataRow[] rowFareBreakUp = dtFareBreakUp.Select("FareDetails_Id=" + FareDetails_id);
                FareBreakUp_Id = rowFareBreakUp[0]["FareBreakUp_Id"].ToString();

            }
            DataTable dtFareAry = dsIntFlights.Tables["FareAry"];
            if (dtFareAry.Rows.Count > 0)
            {
                DataRow[] rowFareAry = dtFareAry.Select("FareBreakUp_Id=" + FareBreakUp_Id);
                FareAry_id = rowFareAry[0]["FareAry_id"].ToString();
            }
            DataTable dtFare = dsIntFlights.Tables["Fare"];
            if (dtFare.Rows.Count > 0)
            {
                DataRow[] rowFare = dtFare.Select("FareAry_id=" + FareAry_id);
                PsgrType = rowFare[0]["PsgrType"].ToString();
                BaseFare = rowFare[0]["BaseFare"].ToString();
                FareTax = rowFare[0]["Tax"].ToString();
                FareId = rowFare[0]["Fare_Id"].ToString();
            }

            xmlRequest = xmlRequest + "</personName><telePhone><phoneNumber>" + txtMobileNumInt.Text + "</phoneNumber></telePhone><email><emailAddress>" + txtEmailIDInt.Text + "</emailAddress></email>";
            xmlRequest = xmlRequest + "<OriginDestinationOption><FareDetails><ActualBaseFare>" + ActualBaseFare + "</ActualBaseFare><Tax>" + Tax + "</Tax><STax>" + STax + "</STax><TCharge>" + TCharge + "</TCharge><SCharge>" + SCharge + "</SCharge><TDiscount>" + TDiscount + "</TDiscount><TMarkup>" + TMarkup + "</TMarkup><TPartnerCommission>" + TPartnerCommission + "</TPartnerCommission><TSdiscount>" + TSdiscount + "</TSdiscount><FareBreakup><FareAry>";//<Fare><PsgrType>" + PsgrType + "</PsgrType><BaseFare>" + BaseFare + "</BaseFare><Tax>" + FareTax + "</Tax>
            xmlRequest = xmlRequest + str + "</FareAry></FareBreakup><ocTax>" + ocTax + "</ocTax></FareDetails><onward><FlightSegments>";

            DataTable dtOnward = dsIntFlights.Tables["Onward"];
            if (dtOnward.Rows.Count > 0)
            {
                DataRow[] rowOnward = dtOnward.Select("OriginDestinationOption_Id=" + lblOriginDestinationRoundTrip.Text);
                onwardId = rowOnward[0]["onward_id"].ToString();
            }
            DataTable dtFlightSegments = dsIntFlights.Tables["FlightSegments"];
            if (dtFlightSegments.Rows.Count > 0)
            {
                DataRow[] rowFlightSegments = dtFlightSegments.Select("onward_id=" + onwardId);
                FlightSegmentsID = rowFlightSegments[0]["FlightSegments_Id"].ToString();
            }
            DataTable dtFlightSegment = dsIntFlights.Tables["FlightSegment"];
            DataTable dtBookingClass = dsIntFlights.Tables["BookingClass"];
            DataTable dtBookingClassFare = dsIntFlights.Tables["BookingClassFare"];
            DataTable dtPsgrBreakUp = dsIntFlights.Tables["PsgrBreakUp"];
            DataTable dtPsgrAry = dsIntFlights.Tables["PsgrAry"];
            DataTable dtPsgr = dsIntFlights.Tables["Psgr"];
            DataTable dtTaxDataAry = dsIntFlights.Tables["TaxDataAry"];
            DataTable dtTaxData = dsIntFlights.Tables["TaxData"];

            if (dtFlightSegment.Rows.Count > 0)
            {
                DataRow[] rowFlightSegment = dtFlightSegment.Select("FlightSegments_Id=" + FlightSegmentsID);
                for (int i = 0; i < rowFlightSegment.Length; i++)
                {

                    AirEquipType = rowFlightSegment[i]["AirEquipType"].ToString();
                    ArrivalAirportCode = rowFlightSegment[i]["ArrivalAirportCode"].ToString();
                    ArrivalAirportName = rowFlightSegment[i]["ArrivalAirportName"].ToString();
                    ArrivalDateTime = rowFlightSegment[i]["ArrivalDateTime"].ToString();
                    DepartureAirportCode = rowFlightSegment[i]["DepartureAirportCode"].ToString();
                    DepartureAirportName = rowFlightSegment[i]["DepartureAirportName"].ToString();
                    DepartureDateTime = rowFlightSegment[i]["DepartureDateTime"].ToString();
                    FlightNumber = rowFlightSegment[i]["FlightNumber"].ToString();
                    MarketingAirlineCode = rowFlightSegment[i]["MarketingAirlineCode"].ToString();
                    OperatingAirlineCode = rowFlightSegment[i]["OperatingAirlineCode"].ToString();
                    OperatingAirlineName = rowFlightSegment[i]["OperatingAirlineName"].ToString();
                    OperatingAirlineFlightNumber = rowFlightSegment[i]["OperatingAirlineFlightNumber"].ToString();
                    NumStops = rowFlightSegment[i]["NumStops"].ToString();
                    LinkSellAgrmnt = rowFlightSegment[i]["LinkSellAgrmnt"].ToString();
                    Conx = rowFlightSegment[i]["Conx"].ToString();
                    AirpChg = rowFlightSegment[i]["AirpChg"].ToString();
                    InsideAvailOption = rowFlightSegment[i]["InsideAvailOption"].ToString();
                    GenTrafRestriction = rowFlightSegment[i]["GenTrafRestriction"].ToString();
                    DaysOperates = rowFlightSegment[i]["DaysOperates"].ToString();
                    JrnyTm = rowFlightSegment[i]["JrnyTm"].ToString();
                    EndDt = rowFlightSegment[i]["EndDt"].ToString();
                    StartTerminal = rowFlightSegment[i]["StartTerminal"].ToString();
                    EndTerminal = rowFlightSegment[i]["EndTerminal"].ToString();
                    FltTm = rowFlightSegment[i]["FltTm"].ToString();
                    LSAInd = rowFlightSegment[i]["LSAInd"].ToString();
                    Mile = rowFlightSegment[i]["Mile"].ToString();

                    if (dtBookingClass.Rows.Count > 0)
                    {
                        DataRow[] rowBookingClass = dtBookingClass.Select("FlightSegment_Id=" + rowFlightSegment[i]["FlightSegment_Id"].ToString());
                        Availability = rowBookingClass[0]["Availability"].ToString();
                        BIC = rowBookingClass[0]["BIC"].ToString();
                    }

                    if (dtBookingClassFare.Rows.Count > 0)
                    {
                        DataRow[] rowBookingClassFare = dtBookingClassFare.Select("FlightSegment_Id=" + rowFlightSegment[i]["FlightSegment_Id"].ToString());
                        bookingclass = rowBookingClassFare[0]["bookingclass"].ToString();
                        classType = rowBookingClassFare[0]["classType"].ToString();
                        farebasiscode = rowBookingClassFare[0]["farebasiscode"].ToString();
                        Rule = rowBookingClassFare[0]["Rule"].ToString();
                        if (dtBookingClassFare.Columns.Contains("bookingclassFare_Id"))
                        {
                            bookingclassFareId = rowBookingClassFare[0]["bookingclassFare_Id"].ToString();
                        }

                    }
                    if (dtBookingClassFare.Columns.Contains("bookingclassFare_Id"))
                    {
                        if (dtPsgrBreakUp.Rows.Count > 0)
                        {
                            DataRow[] rowPsgrBreakUp = dtPsgrBreakUp.Select("bookingclassFare_Id=" + bookingclassFareId);
                            psgrBreakUp_Id = rowPsgrBreakUp[0]["psgrBreakUp_Id"].ToString();

                        }

                        if (dtPsgrAry.Rows.Count > 0)
                        {
                            DataRow[] rowPsgrAry = dtPsgrAry.Select("psgrBreakUp_Id=" + psgrBreakUp_Id);
                            psgrAy_id = rowPsgrAry[0]["psgrAry_Id"].ToString();

                        }

                        if (dtPsgr.Rows.Count > 0)
                        {
                            DataRow[] rowPsgr = dtPsgr.Select("psgrAry_Id=" + psgrAy_id);
                            FarePsgrType = rowPsgr[0]["psgrType"].ToString();
                            FareBaseFare = rowPsgr[0]["BaseFare"].ToString();
                            FareTax1 = rowPsgr[0]["Tax"].ToString();
                            BagInfo = rowPsgr[0]["BagInfo"].ToString();

                        }
                    }
                    if (dtTaxDataAry.Rows.Count > 0)
                    {
                        DataRow[] rowTaxDataAry = dtTaxDataAry.Select("Fare_id=" + FareId);
                        taxDataAry_id = rowTaxDataAry[0]["TaxdataAry_Id"].ToString();
                    }

                    if (dtTaxData.Rows.Count > 0)
                    {
                        DataRow[] rowTaxData = dtTaxData.Select("TaxdataAry_Id=" + taxDataAry_id);
                        for (int j = 0; j < rowTaxData.Length; j++)
                        {
                            if (rowTaxData.Length == 0)
                            {
                                taxData = "<TaxData><Country>" + rowTaxData[j]["Country"].ToString() + "</Country><Amt>" + rowTaxData[j]["Amt"].ToString() + "</Amt></TaxData>";
                            }
                            else
                            {
                                taxData = taxData + "<TaxData><Country>" + rowTaxData[j]["Country"].ToString() + "</Country><Amt>" + rowTaxData[j]["Amt"].ToString() + "</Amt></TaxData>";
                            }
                        }

                    }

                    xmlRequest = xmlRequest + "<FlightSegment><AirEquipType>" + AirEquipType + "</AirEquipType><ArrivalAirportCode>" + ArrivalAirportCode + "</ArrivalAirportCode><ArrivalAirportName>" + ArrivalAirportName + "</ArrivalAirportName><ArrivalDateTime>" + ArrivalDateTime + "</ArrivalDateTime><DepartureAirportCode>" + DepartureAirportCode + "</DepartureAirportCode><DepartureAirportName>" + DepartureAirportName + "</DepartureAirportName><DepartureDateTime>" + DepartureDateTime + "</DepartureDateTime><FlightNumber>" + FlightNumber + "</FlightNumber>";
                    xmlRequest = xmlRequest + "<MarketingAirlineCode>" + MarketingAirlineCode + "</MarketingAirlineCode><OperatingAirlineCode>" + OperatingAirlineCode + "</OperatingAirlineCode><OperatingAirlineName>" + OperatingAirlineName + "</OperatingAirlineName><OperatingAirlineFlightNumber>" + OperatingAirlineFlightNumber + "</OperatingAirlineFlightNumber><NumStops>" + NumStops + "</NumStops><LinkSellAgrmnt>" + LinkSellAgrmnt + "</LinkSellAgrmnt><Conx>" + Conx + "</Conx><AirpChg>" + AirpChg + "</AirpChg><InsideAvailOption>" + InsideAvailOption + "</InsideAvailOption><GenTrafRestriction>" + GenTrafRestriction + "</GenTrafRestriction><DaysOperates>" + DaysOperates + "</DaysOperates><JrnyTm>" + JrnyTm + "</JrnyTm><EndDt>" + EndDt + "</EndDt><StartTerminal>" + StartTerminal + "</StartTerminal><EndTerminal>" + EndTerminal + "</EndTerminal>";
                    xmlRequest = xmlRequest + "<FltTm>" + FltTm + "</FltTm><LSAInd>" + LSAInd + "</LSAInd><Mile>" + Mile + "</Mile><BookingClass><Availability>" + Availability + "</Availability><BIC>" + BIC + "</BIC></BookingClass><BookingClassFare><bookingclass>" + bookingclass + "</bookingclass><classType>" + classType + "</classType><farebasiscode>" + farebasiscode + "</farebasiscode><Rule>" + Rule.Replace("<", "&lt;").Replace(">", "&gt;") + "</Rule>";
                    if (dtBookingClassFare.Columns.Contains("bookingclassFare_Id"))
                    {

                        xmlRequest = xmlRequest + "<PsgrBreakup><PsgrAry>" + taxdatapsgr + "</PsgrAry></PsgrBreakup>";
                    }
                    xmlRequest = xmlRequest + "</BookingClassFare></FlightSegment>";//<Psgr><PsgrType>" + FarePsgrType + "</PsgrType><BaseFare>" + FareBaseFare + "</BaseFare><Tax>" + FareTax1 + "</Tax><BagInfo></BagInfo></Psgr>

                }
            }

            xmlRequest = xmlRequest + "</FlightSegments></onward><Return><FlightSegments>";

            DataTable dtReturn = dsIntFlights.Tables["Return"];
            if (dtReturn.Rows.Count > 0)
            {
                DataRow[] rowReturn = dtReturn.Select("OriginDestinationOption_Id=" + lblOriginDestinationRoundTrip.Text);
                returnId = rowReturn[0]["return_id"].ToString();
            }
            DataTable dtFlightSegmentsRet = dsIntFlights.Tables["FlightSegments"];
            if (dtFlightSegmentsRet.Rows.Count > 0)
            {
                DataRow[] rowFlightSegmentsRet = dtFlightSegmentsRet.Select("return_id=" + returnId);
                FlightSegmentsIDRet = rowFlightSegmentsRet[0]["FlightSegments_Id"].ToString();
            }
            DataTable dtFlightSegmentRet = dsIntFlights.Tables["FlightSegment"];
            DataTable dtBookingClassRet = dsIntFlights.Tables["BookingClass"];
            DataTable dtBookingClassFareRet = dsIntFlights.Tables["BookingClassFare"];
            DataTable dtPsgrBreakUpRet = dsIntFlights.Tables["PsgrBreakUp"];
            DataTable dtPsgrAryRet = dsIntFlights.Tables["PsgrAry"];
            DataTable dtPsgrRet = dsIntFlights.Tables["Psgr"];
            DataTable dtTaxDataAryRet = dsIntFlights.Tables["TaxDataAry"];
            DataTable dtTaxDataRet = dsIntFlights.Tables["TaxData"];

            if (dtFlightSegmentRet.Rows.Count > 0)
            {
                DataRow[] rowFlightSegmentRet = dtFlightSegmentRet.Select("FlightSegments_Id=" + FlightSegmentsIDRet);
                for (int i = 0; i < rowFlightSegmentRet.Length; i++)
                {

                    AirEquipTypeRet = rowFlightSegmentRet[i]["AirEquipType"].ToString();
                    ArrivalAirportCodeRet = rowFlightSegmentRet[i]["ArrivalAirportCode"].ToString();
                    ArrivalAirportNameRet = rowFlightSegmentRet[i]["ArrivalAirportName"].ToString();
                    ArrivalDateTimeRet = rowFlightSegmentRet[i]["ArrivalDateTime"].ToString();
                    DepartureAirportCodeRet = rowFlightSegmentRet[i]["DepartureAirportCode"].ToString();
                    DepartureAirportNameRet = rowFlightSegmentRet[i]["DepartureAirportName"].ToString();
                    DepartureDateTimeRet = rowFlightSegmentRet[i]["DepartureDateTime"].ToString();
                    FlightNumberRet = rowFlightSegmentRet[i]["FlightNumber"].ToString();
                    MarketingAirlineCodeRet = rowFlightSegmentRet[i]["MarketingAirlineCode"].ToString();
                    OperatingAirlineCodeRet = rowFlightSegmentRet[i]["OperatingAirlineCode"].ToString();
                    OperatingAirlineNameRet = rowFlightSegmentRet[i]["OperatingAirlineName"].ToString();
                    OperatingAirlineFlightNumberRet = rowFlightSegmentRet[i]["OperatingAirlineFlightNumber"].ToString();
                    NumStopsRet = rowFlightSegmentRet[i]["NumStops"].ToString();
                    LinkSellAgrmntRet = rowFlightSegmentRet[i]["LinkSellAgrmnt"].ToString();
                    ConxRet = rowFlightSegmentRet[i]["Conx"].ToString();
                    AirpChgRet = rowFlightSegmentRet[i]["AirpChg"].ToString();
                    InsideAvailOptionRet = rowFlightSegmentRet[i]["InsideAvailOption"].ToString();
                    GenTrafRestrictionRet = rowFlightSegmentRet[i]["GenTrafRestriction"].ToString();
                    DaysOperatesRet = rowFlightSegmentRet[i]["DaysOperates"].ToString();
                    JrnyTmRet = rowFlightSegmentRet[i]["JrnyTm"].ToString();
                    EndDtRet = rowFlightSegmentRet[i]["EndDt"].ToString();
                    StartTerminalRet = rowFlightSegmentRet[i]["StartTerminal"].ToString();
                    EndTerminalRet = rowFlightSegmentRet[i]["EndTerminal"].ToString();
                    FltTmRet = rowFlightSegmentRet[i]["FltTm"].ToString();
                    LSAIndRet = rowFlightSegmentRet[i]["LSAInd"].ToString();
                    MileRet = rowFlightSegmentRet[i]["Mile"].ToString();

                    if (dtBookingClassRet.Rows.Count > 0)
                    {
                        DataRow[] rowBookingClassRet = dtBookingClassRet.Select("FlightSegment_Id=" + rowFlightSegmentRet[i]["FlightSegment_Id"].ToString());
                        AvailabilityRet = rowBookingClassRet[0]["Availability"].ToString();
                        BICRet = rowBookingClassRet[0]["BIC"].ToString();
                    }

                    if (dtBookingClassFareRet.Rows.Count > 0)
                    {
                        DataRow[] rowBookingClassFareRet = dtBookingClassFareRet.Select("FlightSegment_Id=" + rowFlightSegmentRet[i]["FlightSegment_Id"].ToString());
                        bookingclassRet = rowBookingClassFareRet[0]["bookingclass"].ToString();
                        classTypeRet = rowBookingClassFareRet[0]["classType"].ToString();
                        farebasiscodeRet = rowBookingClassFareRet[0]["farebasiscode"].ToString();
                        RuleRet = rowBookingClassFareRet[0]["Rule"].ToString();
                        if (dtBookingClassFareRet.Columns.Contains("bookingclassFare_Id"))
                        {
                            bookingclassFareIdRet = rowBookingClassFareRet[0]["bookingclassFare_Id"].ToString();
                        }

                    }
                    if (dtBookingClassFareRet.Columns.Contains("bookingclassFare_Id"))
                    {
                        if (dtPsgrBreakUpRet.Rows.Count > 0)
                        {
                            DataRow[] rowPsgrBreakUpRet = dtPsgrBreakUpRet.Select("bookingclassFare_Id=" + bookingclassFareIdRet);
                            psgrBreakUp_IdRet = rowPsgrBreakUpRet[0]["psgrBreakUp_Id"].ToString();

                        }

                        if (dtPsgrAryRet.Rows.Count > 0)
                        {
                            DataRow[] rowPsgrAryRet = dtPsgrAryRet.Select("psgrBreakUp_Id=" + psgrBreakUp_IdRet);
                            psgrAy_idRet = rowPsgrAryRet[0]["psgrAry_Id"].ToString();

                        }

                        if (dtPsgrRet.Rows.Count > 0)
                        {
                            DataRow[] rowPsgrRet = dtPsgrRet.Select("psgrAry_Id=" + psgrAy_idRet);
                            FarePsgrTypeRet = rowPsgrRet[0]["psgrType"].ToString();
                            FareBaseFareRet = rowPsgrRet[0]["BaseFare"].ToString();
                            FareTax1Ret = rowPsgrRet[0]["Tax"].ToString();
                            BagInfoRet = rowPsgrRet[0]["BagInfo"].ToString();

                        }
                    }
                    //if (dtTaxDataAryRet.Rows.Count > 0)
                    //{
                    //    DataRow[] rowTaxDataAryRet = dtTaxDataAryRet.Select("Fare_id=" + FareIdRet);
                    //    taxDataAry_id = rowTaxDataAryRet[0]["TaxdataAry_Id"].ToString();
                    //}

                    //if (dtTaxDataRet.Rows.Count > 0)
                    //{
                    //    DataRow[] rowTaxDataRet = dtTaxDataRet.Select("TaxdataAry_Id=" + taxDataAry_idRet);
                    //    for (int j = 0; j < rowTaxDataRet.Length; j++)
                    //    {
                    //        if (rowTaxDataRet.Length == 0)
                    //        {
                    //            taxDataRet = "<TaxData><Country>" + rowTaxDataRet[j]["Country"].ToString() + "</Country><Amt>" + rowTaxDataRet[j]["Amt"].ToString() + "</Amt></TaxData>";
                    //        }
                    //        else
                    //        {
                    //            taxDataRet = taxDataRet + "<TaxData><Country>" + rowTaxDataRet[j]["Country"].ToString() + "</Country><Amt>" + rowTaxDataRet[j]["Amt"].ToString() + "</Amt></TaxData>";
                    //        }
                    //    }

                    //}

                    xmlRequest = xmlRequest + "<FlightSegment><AirEquipType>" + AirEquipTypeRet + "</AirEquipType><ArrivalAirportCode>" + ArrivalAirportCodeRet + "</ArrivalAirportCode><ArrivalAirportName>" + ArrivalAirportNameRet + "</ArrivalAirportName><ArrivalDateTime>" + ArrivalDateTimeRet + "</ArrivalDateTime><DepartureAirportCode>" + DepartureAirportCodeRet + "</DepartureAirportCode><DepartureAirportName>" + DepartureAirportNameRet + "</DepartureAirportName><DepartureDateTime>" + DepartureDateTimeRet + "</DepartureDateTime><FlightNumber>" + FlightNumberRet + "</FlightNumber>";
                    xmlRequest = xmlRequest + "<MarketingAirlineCode>" + MarketingAirlineCodeRet + "</MarketingAirlineCode><OperatingAirlineCode>" + OperatingAirlineCodeRet + "</OperatingAirlineCode><OperatingAirlineName>" + OperatingAirlineNameRet + "</OperatingAirlineName><OperatingAirlineFlightNumber>" + OperatingAirlineFlightNumberRet + "</OperatingAirlineFlightNumber><NumStops>" + NumStopsRet + "</NumStops><LinkSellAgrmnt>" + LinkSellAgrmntRet + "</LinkSellAgrmnt><Conx>" + ConxRet + "</Conx><AirpChg>" + AirpChgRet + "</AirpChg><InsideAvailOption>" + InsideAvailOptionRet + "</InsideAvailOption><GenTrafRestriction>" + GenTrafRestrictionRet + "</GenTrafRestriction><DaysOperates>" + DaysOperatesRet + "</DaysOperates><JrnyTm>" + JrnyTmRet + "</JrnyTm><EndDt>" + EndDtRet + "</EndDt><StartTerminal>" + StartTerminalRet + "</StartTerminal><EndTerminal>" + EndTerminalRet + "</EndTerminal>";
                    xmlRequest = xmlRequest + "<FltTm>" + FltTmRet + "</FltTm><LSAInd>" + LSAIndRet + "</LSAInd><Mile>" + MileRet + "</Mile><BookingClass><Availability>" + AvailabilityRet + "</Availability><BIC>" + BICRet + "</BIC></BookingClass><BookingClassFare><bookingclass>" + bookingclassRet + "</bookingclass><classType>" + classTypeRet + "</classType><farebasiscode>" + farebasiscodeRet + "</farebasiscode><Rule>" + RuleRet.Replace("<", "&lt;").Replace(">", "&gt;") + "</Rule>";
                           if (dtBookingClassFareRet.Columns.Contains("bookingclassFare_Id"))
                           {
                               xmlRequest = xmlRequest + "<PsgrBreakup><PsgrAry>" + taxdatapsgrRet + "</PsgrAry></PsgrBreakup>";
                           }
                               xmlRequest = xmlRequest + "</BookingClassFare></FlightSegment>";//<Psgr><PsgrType>" + FarePsgrTypeRet + "</PsgrType><BaseFare>" + FareBaseFareRet + "</BaseFare><Tax>" + FareTax1Ret + "</Tax><BagInfo></BagInfo></Psgr>

                }
            }
            xmlRequest = xmlRequest + "</FlightSegments></Return><id>" + id + "</id><key>" + key + "</key>";
            xmlRequest = xmlRequest + "</OriginDestinationOption></Bookingrequest>";

            StringBuilder stt = new StringBuilder();

            stt.Append("xmlRequest");
            stt.Append("=");
            stt.Append(Server.UrlEncode(xmlRequest));

            byte[] requestData = Encoding.UTF8.GetBytes(stt.ToString());

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://live.arzoo.com:9302/Booking");
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.Accept = "application/json";

            request.ContentLength = requestData.Length;

            using (Stream requestStream = request.GetRequestStream())
            {
                requestStream.Write(requestData, 0, requestData.Length);
            }
            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            {
                using (Stream stream = response.GetResponseStream())
                {
                    using (StreamReader reader = new StreamReader(stream, Encoding.ASCII))
                        result = reader.ReadToEnd();
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(result);
                    XmlNodeReader xmlReader = new XmlNodeReader(doc);

                    dsResponse.ReadXml(xmlReader);
                }
            }

        }
        catch (Exception ex)
        {

            // throw;
        }
        return dsResponse;
    }
 public bool CancelDomesticFlightBooking(FlightBAL objFlightBAL)
 {
     try
     {
         ObjDAL = new clsDataLayer();
         SqlParameter[] p = new SqlParameter[9];
         p[0] = new SqlParameter("@tableName", "InsertDomFlightCancel");
         p[1] = new SqlParameter("@TransId", objFlightBAL.TransId);
         p[2] = new SqlParameter("@Status", objFlightBAL.Status);
         p[3] = new SqlParameter("@remarks", objFlightBAL.remarks);
         p[4] = new SqlParameter("@TicketDetails", objFlightBAL.TicketDetails);
         p[5] = new SqlParameter("@CancelId", objFlightBAL.CancelId);
         p[6] = new SqlParameter("@ReferenceNo", objFlightBAL.ReferenceNo);
         p[7] = new SqlParameter("@CreatedBy", objFlightBAL.CreatedBy);
         p[8] = new SqlParameter("@Reason", objFlightBAL.Reason);
         return ObjDAL.fnExecuteStoredProcedure("sp_DomesticFlightCancel", p);
     }
     catch (Exception ex)
     {
         throw new ArgumentException(ex.Message);
     }
 }
 public bool AddInternationalFlightSegment(FlightBAL objFlightBAL)
 {
     try
     {
         ObjDAL = new clsDataLayer();
         SqlParameter[] p = new SqlParameter[44];
         p[0] = new SqlParameter("@AirEquipType", objFlightBAL.AirEquipType);
         p[1] = new SqlParameter("@ArrivalAirportCode", objFlightBAL.ArrivalAirportCode);
         p[2] = new SqlParameter("@ArrivalDateTime", objFlightBAL.ArrivalDateTime);
         p[3] = new SqlParameter("@DepartureAirportCode", objFlightBAL.DepartureAirportCode);
         p[4] = new SqlParameter("@DepartureDateTime", objFlightBAL.DepartureDateTime);
         p[5] = new SqlParameter("@FlightNumber", objFlightBAL.FlightNumber);
         p[6] = new SqlParameter("@MarketingAirlineCode", objFlightBAL.MarketingAirlineCode);
         p[7] = new SqlParameter("@OperatingAirlineCode", objFlightBAL.OperatingAirlineCode);
         p[8] = new SqlParameter("@OperatingAirlineName", objFlightBAL.OperatingAirlineName);
         p[9] = new SqlParameter("@OperatingAirlineFlightNumber", objFlightBAL.OperatingAirlineFlightNumber);
         p[10] = new SqlParameter("@NumStops", objFlightBAL.NumStops);
         p[11] = new SqlParameter("@LinkSellAgrmnt", objFlightBAL.LinkSellAgrmnt);
         p[12] = new SqlParameter("@Conx", objFlightBAL.Conx);
         p[13] = new SqlParameter("@AirpChg", objFlightBAL.AirpChg);
         p[14] = new SqlParameter("@InsideAvailOption", objFlightBAL.InsideAvailOption);
         p[15] = new SqlParameter("@GenTrafRestriction", objFlightBAL.GenTrafRestriction);
         p[16] = new SqlParameter("@DaysOperates", objFlightBAL.DaysOperates);
         p[17] = new SqlParameter("@JrnyTm", objFlightBAL.JrnyTm);
         p[18] = new SqlParameter("@EndDt", objFlightBAL.EndDt);
         p[19] = new SqlParameter("@StartTerminal", objFlightBAL.StartTerminal);
         p[20] = new SqlParameter("@EndTerminal", objFlightBAL.EndTerminal);
         p[21] = new SqlParameter("@FltTm", objFlightBAL.FltTm);
         p[22] = new SqlParameter("@LSAInd", objFlightBAL.LSAInd);
         p[23] = new SqlParameter("@Mile", objFlightBAL.Mile);
         p[24] = new SqlParameter("@Availability", objFlightBAL.Availability);
         p[25] = new SqlParameter("@BIC", objFlightBAL.BIC);
         p[26] = new SqlParameter("@bookingclass", objFlightBAL.bookingClass);
         p[27] = new SqlParameter("@classType", objFlightBAL.ClassType);
         p[28] = new SqlParameter("@farebasiscode", objFlightBAL.farebasisCode);
         p[29] = new SqlParameter("@Fare_Rule", objFlightBAL.Fare_Rule);
         p[30] = new SqlParameter("@PsgrType", objFlightBAL.PsgrType);
         p[31] = new SqlParameter("@BaseFare", objFlightBAL.BaseFare);
         p[32] = new SqlParameter("@psgrTax", objFlightBAL.psgrTax);
         p[33] = new SqlParameter("@BagInfo", objFlightBAL.BagInfo);
         p[34] = new SqlParameter("@FlightBookingID", objFlightBAL.FlightBookingID);
         p[35] = new SqlParameter("@tableName", "InsertIntFlightSegment");
         p[36] = new SqlParameter("@ArrivalAirportName", objFlightBAL.ArrivalAirportName);
         p[37] = new SqlParameter("@DepartureAirportName", objFlightBAL.DepartureAirportName);
         p[38] = new SqlParameter("@Telephone", objFlightBAL.telephone);
         p[39] = new SqlParameter("@CustomerDetails", objFlightBAL.Customer_Details);
         p[40] = new SqlParameter("@EmailAddress", objFlightBAL.emailAddress);
         p[41] = new SqlParameter("@CreatedBy", objFlightBAL.CreatedBy);
         p[42] = new SqlParameter("@Address", objFlightBAL.Address);
         p[43] = new SqlParameter("@FarePsgrType", objFlightBAL.FarePsgrType);
         return ObjDAL.fnExecuteStoredProcedure("sp_InternationalFlightSegments", p);
     }
     catch (Exception ex)
     {
         throw new ArgumentException(ex.Message);
     }
 }
    void BindDeposits()
    {
        if (txtdate.Text == "")
        {
            txtdate.Text = "1/1/1900";
        }
        if (txtrefno.Text == "")
        {
            txtrefno.Text = "1/1/1900";
        }

        FlightBAL obj = new FlightBAL();
        obj.FromDate = Convert.ToDateTime(txtdate.Text);
        obj.ToDate = Convert.ToDateTime(txtrefno.Text);
        obj.agentId = Convert.ToInt32(Session["UserId"]);
        DataSet ds = obj.GetFlightSalesReport();
        if (ds != null)
        {
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    gvDeposits.DataSource = ds;
                    gvDeposits.DataBind();
                    ViewState["gv"] = ds;
                    trpaging.Visible = true;
                    lblerrormsg.Visible = false;
                    gvDeposits.Visible = true;
                }
                else
                {
                    trpaging.Visible = false;
                    lblerrormsg.Text = "No Data Found";
                    lblerrormsg.ForeColor = System.Drawing.Color.Red;
                    lblerrormsg.Visible = true;
                    gvDeposits.Visible = false;
                }
            }
            else
            {
                trpaging.Visible = false;
                lblerrormsg.Text = "No Data Found";
                lblerrormsg.ForeColor = System.Drawing.Color.Red;
                lblerrormsg.Visible = true;
                gvDeposits.Visible = false;
            }
        }
        else
        {
            trpaging.Visible = false;
            lblerrormsg.Text = "No Data Found";
            lblerrormsg.ForeColor = System.Drawing.Color.Red;
            lblerrormsg.Visible = true;
            gvDeposits.Visible = false;
        }
        if (txtdate.Text == "1/1/1900")
        {
            txtdate.Text = "";
        }
        if (txtrefno.Text == "1/1/1900")
        {
            txtrefno.Text = "";
        }
    }