protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            HotelBAL objTicket = new HotelBAL();
            objTicket.ReferenceNo = txtRefNo.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();
            lblarzoorefno.Text = drTicketRow["BookingRefNo"].ToString();
            lblStatus.Text = drTicketRow["Status"].ToString();
            lblHotelName.Text = drTicketRow["HotelName"].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();
            pnlViewTicket.Visible = true; pnl.Visible = false;
        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
            throw;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        objArzooHotelAPILayer = ArzooHotelFactoryManager.GetArzooHotelAPILayerObject();
        objArzooHotelAPILayer.UserName = ArzooHotelConstants.USERNAME;
        objArzooHotelAPILayer.UserId = ArzooHotelConstants.USERID;
        objArzooHotelAPILayer.UserType = ArzooHotelConstants.USERTYPE;
        objArzooHotelAPILayer.Password = ArzooHotelConstants.PASSWORD;
        objArzooHotelAPILayer.PartnerId = ArzooHotelConstants.PARTNERID;
        lblMsg.Text = "";
        this.Page.Title = "LoveJourney - Hotel - Ticket";
        if (!IsPostBack)
        {
            if (Session["HotelRefNo"] != null)
            {
                string strRefNo = Session["HotelRefNo"].ToString();

                HotelBAL obj = new HotelBAL();
                obj.ReferenceNo = strRefNo;
                DataSet ds = obj.GetHotelProvisional();

                if (ds != null)
                {
                    string hotelId = ""; string webService = ""; string ratePlanCode = ""; string roomTypeCode = "";
                    string cityName = ""; string allocavailResult = "";
                    string allocidResult = ""; string fromDate = ""; string toDate = ""; string roomType = "";
                    string wsKey = ""; string roomBasis = ""; string title = "";
                    string firstName = ""; string middleName = ""; string lastName = ""; int noOfRooms = 0;
                    int[] noOfAdultsInARoom = null; int[] noOfChildsInARoom = null;
                    int[] firstChildAge = null; int[] secondChildAge = null;
                    string roomStayCandidate = "";

                    DataRow dr = ds.Tables[0].Rows[0];

                    hotelId = dr["HotelId"].ToString();
                    webService = dr["WebService"].ToString();
                    ratePlanCode = dr["RatePlanType"].ToString();
                    roomTypeCode = dr["RoomTypeCode"].ToString();
                    cityName = dr["HotelCity"].ToString();
                    allocavailResult = dr["FromAllocation"].ToString();
                    allocidResult = dr["AllocationId"].ToString();

                    roomType = dr["RoomType"].ToString();
                    firstName = dr["FirstName"].ToString();
                    middleName = dr["MiddleName"].ToString();
                    lastName = dr["LastName"].ToString();
                    wsKey = dr["WsKey"].ToString();
                    roomBasis = dr["RoomBasis"].ToString();
                    title = dr["Title"].ToString();
                    noOfRooms = Convert.ToInt32(dr["NoOfRooms"].ToString());
                    roomStayCandidate = dr["RoomStayCandidate"].ToString();

                    string[] strValues = roomStayCandidate.Split(':');

                    fromDate = ConvertDate(strValues[1].ToString());
                    fromDate = fromDate.Replace('-', '/');
                    toDate = ConvertDate(strValues[2].ToString());
                    toDate = toDate.Replace('-', '/');

                    noOfRooms = Convert.ToInt32(strValues[3].ToString());

                    noOfAdultsInARoom = new int[noOfRooms];
                    noOfChildsInARoom = new int[noOfRooms];
                    firstChildAge = new int[noOfRooms];
                    secondChildAge = new int[noOfRooms];
                    int j = 0;
                    for (int i = 0; i < noOfRooms; i++)
                    {
                        if (i == 0)
                        {
                            j = 0;
                        }
                        else
                        {
                            j = 4 * i;
                        }

                        noOfAdultsInARoom[i] = Convert.ToInt32(strValues[4 + j].ToString());
                        noOfChildsInARoom[i] = Convert.ToInt32(strValues[5 + j].ToString());
                        firstChildAge[i] = Convert.ToInt32(strValues[6 + j].ToString());
                        secondChildAge[i] = Convert.ToInt32(strValues[7 + j].ToString());
                    }

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

                    DataSet dsCommSlabRet = objBAL.GetCommissionSlab(Session["Role"].ToString(), "Hotels","");

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

                    string agentId = dsBalance.Tables[0].Rows[0]["AgentId"].ToString();

                    string actualFare = dr["HotelTotalFare"].ToString().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))
                    {

                        DataSet dsHotelBooking = objArzooHotelAPILayer.HotelBooking
                            (hotelId, webService, ratePlanCode, roomTypeCode, cityName, allocavailResult,
                            allocidResult, fromDate, toDate, roomType, wsKey, roomBasis, title, firstName, middleName, lastName, noOfRooms,
                            noOfAdultsInARoom, noOfChildsInARoom, firstChildAge, secondChildAge);

                        int provisionalId = Convert.ToInt32(dr["Id"].ToString());

                        if (!dsHotelBooking.Tables.Contains("HotelBooking"))
                        { lblMsg.Text = "Failed to book the ticket."; return; }

                        if (dsHotelBooking.Tables["HotelBooking"].Rows.Count == 0)
                        { lblMsg.Text = "Failed to book the ticket."; return; }

                        DataRow drr = dsHotelBooking.Tables["HotelBooking"].Rows[0];
                        wsKey = drr["wsKey"].ToString();

                        string extGuestTotal = drr["extGuestTotal"].ToString();
                        string roomTotal = drr["roomTotal"].ToString();
                        string serviceTaxTotal = drr["servicetaxTotal"].ToString();
                        string bookingStatus = drr["bookingstatus"].ToString();
                        string bookingRemarks = drr["bookingremarks"].ToString();
                        string bookingRefNo = drr["bookingref"].ToString();
                        string bookingTrn = drr["bookingTrn"].ToString();
                        string discount = drr["discount"].ToString();
                        string contactNumbers = drr["contactNumbers"].ToString();
                        string faxNumbers = drr["faxNumbers"].ToString();

                        if (drr["bookingstatus"].ToString() == "C")
                        {
                            string stt = "";
                            stt = InsertHotelBooking(provisionalId, wsKey, extGuestTotal, roomTotal, serviceTaxTotal, bookingStatus, bookingRemarks,
                                bookingRefNo, bookingTrn, discount, contactNumbers, faxNumbers, Convert.ToInt32(Session["UserID"].ToString()));
                            if (stt == "Success")
                            {
                                //lblMsg.Text = "Your ticket has been booked successfully. " + " BookingRefNo : " + Session["HotelRefNo"].ToString();

                                pnlTicket.Visible = true;
                                pnlOptions.Visible = true;

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

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

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

                                HotelBAL objTicket = new HotelBAL();
                                objTicket.ReferenceNo = strRefNo;
                                DataSet dsTicket = objTicket.GetHotelProvisional();

                                if (dsTicket != null)
                                {
                                    DataRow drTicketRow = dsTicket.Tables[0].Rows[0];
                                    lblHotelRefNo.Text = drTicketRow["ReferenceNo"].ToString();
                                    lblarzoorefno.Text = drTicketRow["BookingRefNo"].ToString();
                                    lblStatus.Text = drTicketRow["Status"].ToString();
                                    lblHotelName.Text = drTicketRow["HotelName"].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();

                                    SMS();
                                    Mail(lblEmailId.Text.ToString());
                                }
                            }
                            else { lblMsg.Text = "Please Try Again."; }
                        }
                        else if (drr["bookingstatus"].ToString() == "E")
                        {
                            lblMsg.Text = "Failed to book the ticket.";
                        }

                    }
                    else
                    {
                        lblMsg.Text = "Your account does have the sufficient balance to book the ticket.";
                        pnlTicket.Visible = false;
                    }

                    Session["HotelRefNo"] = null;
                }
            }
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            string bookingRef = "";
            string emailId = "";
            string lastName = "";
            string webService = "";
            string startDate = "";
            string endDate = "";

            HotelBAL obj = new HotelBAL();
            obj.ReferenceNo = txtBookingRefNo.Text.ToString().Trim().ToString();
            DataSet ds = obj.GetHotelProvisional();

            if (ds == null)
            { lblMsg.Text = "Invalid reference number."; return; }
            if (ds.Tables.Count == 0)
            { lblMsg.Text = "Invalid reference number."; return; }
            if (ds.Tables[0].Rows.Count == 0)
            { lblMsg.Text = "Invalid reference number."; return; }

            DataRow dr = ds.Tables[0].Rows[0];

            emailId = dr["EmailId"].ToString();
            lastName = dr["LastName"].ToString();
            bookingRef = dr["BookingRefNo"].ToString();
            webService = dr["WebService"].ToString();
            startDate = ConvertDate(dr["CheckIn"].ToString());
            endDate = ConvertDate1(dr["CheckOut"].ToString());
            string status = dr["Status"].ToString();
            double hotelTotalFare = Convert.ToDouble(dr["HotelTotalFare"].ToString());

            if (status == "Cancelled") { lblMsg.Text = "Already this ticket has been cancelled."; return; }

            DataSet dsHotelCancellation = objArzooHotelAPILayer.HotelCancellation(emailId, lastName, bookingRef, webService, startDate, endDate);

            if (!dsHotelCancellation.Tables.Contains("HotelCancellation"))
            { lblMsg.Text = "Failed to cancel the ticket."; return; }

            DataTable dtCancellation = dsHotelCancellation.Tables["HotelCancellation"];
            if (dtCancellation.Rows.Count > 0)
            {
                DataRow item = dtCancellation.Rows[0];
                string cancellationId = item["cancellationId"].ToString();
                string refundTotalAmount = item["refundTotalAmount"].ToString();
                string cancellationAmount = item["cancellationAmount"].ToString();
                string success = item["success"].ToString();
                string error = item["error"].ToString();
                if (success != "" && cancellationId != "")
                {
                    lblMsg.Text = "Status: " + "Ticket has been cancelled successfully.";
                    string provisionalId = dr["ProvisionalId"].ToString();
                    string bookingId = dr["BookingId"].ToString();

                    double cancellationCharges = hotelTotalFare - Convert.ToDouble(refundTotalAmount);

                    InsertCancellaion(provisionalId, bookingId, Convert.ToDouble(refundTotalAmount),
                        cancellationCharges, Convert.ToInt32(Session["UserID"].ToString()), cancellationId);

                    objBAL = new ClsBAL();
                    objBAL.AdjustAgentBalance(txtBookingRefNo.Text.Trim().ToString(),
                        Convert.ToDouble(refundTotalAmount), Convert.ToDouble(cancellationCharges),
                        Convert.ToInt32(Session["UserID"].ToString()));

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

                    string balance = dsBalance.Tables[0].Rows[0]["Balance"].ToString();
                    Label lbl = (Label)this.Master.FindControl("lblBalance");
                    lbl.Text = balance;
                    Session["Balance"] = balance;
                    txtBookingRefNo.Text = "";
                }
                else if (error != "") { lblMsg.Text = error.ToString(); }
                else { lblMsg.Text = "Failed to cancel the ticket."; }
            }

        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
        }
    }
    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;
            }
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            string bookingRef = "";
            string emailId = "";
            string lastName = "";
            string webService = "";
            string startDate = "";
            string endDate = "";

            HotelBAL obj = new HotelBAL();
            obj.ReferenceNo = txtBookingRefNo.Text.ToString();
            DataSet ds = obj.GetHotelProvisional();

            if (ds == null)
            { lblMsg.Text = "Invalid reference number."; return; }
            if (ds.Tables.Count == 0)
            { lblMsg.Text = "Invalid reference number."; return; }
            if (ds.Tables[0].Rows.Count == 0)
            { lblMsg.Text = "Invalid reference number."; return; }

            DataRow dr = ds.Tables[0].Rows[0];

            emailId = dr["EmailId"].ToString();
            lastName = dr["LastName"].ToString();
            bookingRef = dr["BookingRefNo"].ToString();
            webService = dr["WebService"].ToString();
            startDate = ConvertDate(dr["CheckIn"].ToString());
            endDate = ConvertDate(dr["CheckOut"].ToString());
            string status = dr["Status"].ToString();

            if (status == "Cancelled") { lblMsg.Text = "Already this ticket has been cancelled."; return; }
            if (emailId != txtEmailId.Text.Trim().ToString()) { lblMsg.Text = "Invalid email id."; return; }

            DataSet dsHotelCancellation = objArzooHotelAPILayer.HotelCancellation(emailId, lastName, bookingRef, webService, startDate, endDate);

            if (!dsHotelCancellation.Tables.Contains("HotelCancellation"))
            { lblMsg.Text = "Failed to cancel the ticket."; return; }

            DataTable dtCancellation = dsHotelCancellation.Tables["HotelCancellation"];
            if (dtCancellation.Rows.Count > 0)
            {
                DataRow item = dtCancellation.Rows[0];
                string cancellationId = item["cancellationId"].ToString();
                string refundTotalAmount = item["refundTotalAmount"].ToString();
                string cancellationAmount = item["cancellationAmount"].ToString();
                string success = item["success"].ToString();
                string error = item["error"].ToString();
                if (success != "")
                {
                    lblMsg.Text = "Status: " + success;
                    string provisionalId = dr["ProvisionalId"].ToString();
                    InsertCancellaion(provisionalId);
                }
                else if (error != "") { lblMsg.Text = error.ToString(); }
                else { lblMsg.Text = "Failed to cancel the ticket."; }
            }

        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
        }
    }
Ejemplo n.º 6
0
    protected void getUserDetailsHotels()
    {
        HotelBAL objTicket = new HotelBAL();
        objTicket.ReferenceNo = Session["HotelRefNo"].ToString();
        Session["Order_Id"] = Session["HotelRefNo"].ToString();

        DataSet dsTicket = objTicket.GetHotelProvisional();

        if (dsTicket != null)
        {
            Name = dsTicket.Tables[0].Rows[0]["FirstName"].ToString();
            address = dsTicket.Tables[0].Rows[0]["CustAddressLine"].ToString();
            State = dsTicket.Tables[0].Rows[0]["CustState"].ToString();
            City = dsTicket.Tables[0].Rows[0]["CustCity"].ToString();
            PostalCode = dsTicket.Tables[0].Rows[0]["CustZipCode"].ToString();
            Email = dsTicket.Tables[0].Rows[0]["EmailId"].ToString();
            Mobilenumber = dsTicket.Tables[0].Rows[0]["MobileNumber"].ToString();
            Country = "IND";
            //address=
            val = "true";
        }
    }