コード例 #1
0
    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)
        {

        }
    }