示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        /*Assinging The Values To The Labels*/
        lblSource.Text        = Session["Source"].ToString();
        lblDestination.Text   = Session["Destination"].ToString();
        lblAdults.Text        = "Adults " + Session["Adults"].ToString();
        lblDepartureDate.Text = Session["DepartureDate"].ToString();
        lblChildrens.Text     = "Childrens " + Session["Children"].ToString();
        lblDepTime1.Text      = Session["DepartureTime1"].ToString();
        lblDepTime2.Text      = Session["DepartureTime2"].ToString();

        string source      = Session["Source_Val"].ToString();
        string destination = Session["Destination_Val"].ToString();

        /*Making The Object Of The FlightDataBaseLayer*/
        FlightDataBaseLayer objFlight       = new FlightDataBaseLayer();
        DataSet             dsFlightDetails = new DataSet();

        /* Calling The Method To Fill The Grid*/
        dsFlightDetails = objFlight.GridDetails(source, destination);
        /*Validating That The Grid Is Empty*/
        if (dsFlightDetails.Tables[0].Rows.Count == 0)
        {
            Response.Write("<script>alert('No Flights Available ..Go Back And Try Again')</script>");
            /*If Empty Taking The Control Back*/
            Server.Transfer("Flight_Search.aspx");
        }
        /*Data Binding To The Grid*/

        grdFlightDetails.DataSource = dsFlightDetails.Tables[0];

        Page.DataBind();
    }
示例#2
0
    /*On Selecting The Grid Values*/

    protected void grdFlightDetails_SelectedIndexChanged2(object sender, EventArgs e)
    {
        /*Selecting The index of the selected row*/
        int i = Convert.ToInt32(grdFlightDetails.SelectedIndex);
        /*Taking The Session Variables Into The Parameters*/
        string   source        = Session["Source_Val"].ToString();
        string   destination   = Session["Destination_Val"].ToString();
        int      NoOfAdults    = Convert.ToInt32(Session["Adults"].ToString());
        int      NoOfChildrens = Convert.ToInt32(Session["Children"].ToString());
        DateTime DateOfJourney = Convert.ToDateTime(Session["DepartureDate"].ToString());
        /*Making The Object Of  FlightDataBaseLayer*/
        FlightDataBaseLayer objFlight       = new FlightDataBaseLayer();
        DataSet             dsFlightDetails = new DataSet();

        dsFlightDetails = objFlight.GridDetails(source, destination);

        int FlightNo = Convert.ToInt32(dsFlightDetails.Tables[0].Rows[i][5]);



        //FlightDataBaseLayer obj = new FlightDataBaseLayer();
        /*Calling The Function To Check The Seat Availability*/
        int iRet = objFlight.CheckSeatStatus(FlightNo, DateOfJourney, NoOfAdults, NoOfChildrens);

        if (iRet == 1)
        {
            Response.Write("<script>alert('Seats Are Avaialable')</script>");

            /*If Seats Are Available Assigning The Grid Values Into The Sessions
             * To Pass To The Other Pages*/
            Session["FlightName"]    = dsFlightDetails.Tables[0].Rows[i][0].ToString();
            Session["Source"]        = dsFlightDetails.Tables[0].Rows[i][1].ToString();
            Session["Destination"]   = dsFlightDetails.Tables[0].Rows[i][2].ToString();
            Session["AdultFare"]     = dsFlightDetails.Tables[0].Rows[i][3].ToString();
            Session["ChildFare"]     = dsFlightDetails.Tables[0].Rows[i][4].ToString();
            Session["FlightNo"]      = dsFlightDetails.Tables[0].Rows[i][5].ToString();
            Session["DepartureTime"] = dsFlightDetails.Tables[0].Rows[i][6].ToString();
            Session["ArrivalTime"]   = dsFlightDetails.Tables[0].Rows[i][7].ToString();
            Session["AirportTax"]    = dsFlightDetails.Tables[0].Rows[i][8].ToString();
            /*Passing The Control To The Next Form*/
            Server.Transfer("Review_Flight_Details.aspx");
        }
        else
        {
            /*If Seats Are  Not Available*/
            Response.Write("<script>alert('Seats Are Not Available')</script>");
        }
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        /*Compare Validation for the Current date should be less than Departure date*/
        cvDate.ValueToCompare = DateTime.Now.ToShortDateString();
        /*Making Object Of The FlightDataBaseLayer*/

        FlightDataBaseLayer objFlight = new FlightDataBaseLayer();
        /*Declaring The DataSet*/
        DataSet dsCustomerId = new DataSet();

        /*Calling The Method And Filling The DataSet*/
        dsCustomerId = objFlight.GetCustomerId();

        /*Filling The DropDownList With CustomerId*/
        drpCustomerId.DataSource     = dsCustomerId.Tables[0];
        drpCustomerId.DataTextField  = dsCustomerId.Tables[0].Columns[0].ToString();
        drpCustomerId.DataValueField = dsCustomerId.Tables[0].Columns[0].ToString();

        /*Filling The DropDownList With CityNames*/
        /*Declaring The DataSets For The Source And Destination*/
        DataSet dsSourceCity      = new DataSet();
        DataSet dsDestinationCity = new DataSet();

        /*Calling The Method And Filling The DataSet*/
        dsSourceCity = objFlight.GetCity();
        /*Calling The Method And Filling The DataSet*/
        dsDestinationCity = objFlight.GetCity();
        /*Assigning The DataSource For Source*/
        drpSource.DataSource = dsSourceCity.Tables[0];
        /*Assigning The DataValueField And DataTextField*/
        drpSource.DataTextField  = dsSourceCity.Tables[0].Columns[1].ToString();
        drpSource.DataValueField = dsSourceCity.Tables[0].Columns[0].ToString();



        /*Assigning The DataSource For Destination*/
        drpDestination.DataSource     = dsDestinationCity.Tables[0];
        drpDestination.DataTextField  = dsDestinationCity.Tables[0].Columns[1].ToString();
        drpDestination.DataValueField = dsDestinationCity.Tables[0].Columns[0].ToString();



        /*For Filling The Data Controls binding The Page*/
        Page.DataBind();
    }
    /*on click of make payment entering the details of payment to flightpayment table
     * in database*/
    protected void btnMakePayment_Click(object sender, EventArgs e)
    {
        int iRet = 0;
        /*Converting the required parameters for method call*/
        int      iAdults       = Convert.ToInt32(Session["Adults"].ToString());
        int      iChildren     = Convert.ToInt32(Session["Children"].ToString());
        string   BookingId     = Session["BookingId"].ToString();
        int      FlightNo      = Convert.ToInt32(Session["FlightNo"].ToString());
        int      CustId        = Convert.ToInt32(Session["CustomerId"].ToString());
        DateTime DateOfBooking = Convert.ToDateTime(DateTime.Now.ToShortDateString());
        DateTime DateOfJourney = Convert.ToDateTime(Session["DepartureDate"].ToString());
        /*Making The Object Of    FlightDataBaseLayer */
        FlightDataBaseLayer objFlight = new FlightDataBaseLayer();

        /*Calling The Method*/
        objFlight.BookingFlight(BookingId, FlightNo, CustId, DateOfBooking, DateOfJourney, iAdults, iChildren);



        /*Converting the required parameters for method call PaymentInsert*/
        double iACharge  = Convert.ToDouble(Session["TotAdultFare"].ToString());
        double iCCharges = Convert.ToDouble(Session["TotChildFare"].ToString());
        double dTax      = Convert.ToDouble(Session["TotalTax"].ToString());

        objFlight.PaymentInsert(BookingId, iACharge, iCCharges, dTax);

        /*if no of adults is 1*/
        if (iAdults == 1)
        {
            /*Converting names to variablesd from sessions*/
            string AdultFName1 = Session["AdultFName1"].ToString();
            string AdultLName1 = Session["AdultLName1"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, AdultFName1, AdultLName1, "A");
        }
        /*if no of adults is 2*/
        else if (iAdults == 2)
        {
            string AdultFName1 = Session["AdultFName1"].ToString();
            string AdultLName1 = Session["AdultLName1"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, AdultFName1, AdultLName1, "A");

            string AdultFName2 = Session["AdultFName2"].ToString();
            string AdultLName2 = Session["AdultLName2"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, AdultFName2, AdultLName2, "A");
        }
        /*if no of adults is 3*/
        else if (iAdults == 3)
        {
            /*Converting names to variablesd from sessions*/
            string AdultFName1 = Session["AdultFName1"].ToString();
            string AdultLName1 = Session["AdultLName1"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, AdultFName1, AdultLName1, "A");


            string AdultFName2 = Session["AdultFName2"].ToString();
            string AdultLName2 = Session["AdultLName2"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, AdultFName2, AdultLName2, "A");


            string AdultFName3 = Session["AdultFName3"].ToString();
            string AdultLName3 = Session["AdultLName3"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, AdultFName3, AdultLName3, "A");
        }
        /*if no of adults is 4*/
        else if (iAdults == 4)
        {
            /*Converting names to variablesd from sessions*/
            string AdultFName1 = Session["AdultFName1"].ToString();
            string AdultLName1 = Session["AdultLName1"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, AdultFName1, AdultLName1, "A");

            string AdultFName2 = Session["AdultFName2"].ToString();
            string AdultLName2 = Session["AdultLName2"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, AdultFName2, AdultLName2, "A");



            string AdultFName3 = Session["AdultFName3"].ToString();
            string AdultLName3 = Session["AdultLName3"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, AdultFName3, AdultLName3, "A");


            string AdultFName4 = Session["AdultFName4"].ToString();
            string AdultLName4 = Session["AdultLName4"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, AdultFName4, AdultLName4, "A");
        }
        /*if no of children is 1*/
        if (iChildren == 1)
        {
            /*Converting names to variablesd from sessions*/

            string ChildFName1 = Session["ChildFName1"].ToString();
            string ChildLName1 = Session["ChiidLName1"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, ChildFName1, ChildLName1, "C");
        }
        else if (iChildren == 2)
        {
            /*Converting names to variablesd from sessions*/
            string ChildFName1 = Session["ChildFName1"].ToString();
            string ChildLName1 = Session["ChiidLName1"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, ChildFName1, ChildLName1, "C");

            string ChildFName2 = Session["ChildFName2"].ToString();
            string ChildLName2 = Session["ChiidLName2"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, ChildFName2, ChildLName2, "C");
        }
        else if (iChildren == 3)
        {
            /*Converting names to variablesd from sessions*/
            string ChildFName1 = Session["ChildFName1"].ToString();
            string ChildLName1 = Session["ChiidLName1"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, ChildFName1, ChildLName1, "C");

            string ChildFName2 = Session["ChildFName2"].ToString();
            string ChildLName2 = Session["ChiidLName2"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, ChildFName2, ChildLName2, "C");

            string ChildFName3 = Session["ChildFName3"].ToString();
            string ChildLName3 = Session["ChiidLName3"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, ChildFName3, ChildLName3, "C");
        }
        else if (iChildren == 4)
        {
            /*Converting names to variablesd from sessions*/
            string ChildFName1 = Session["ChildFName1"].ToString();
            string ChildLName1 = Session["ChiidLName1"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, ChildFName1, ChildLName1, "C");


            string ChildFName2 = Session["ChildFName2"].ToString();
            string ChildLName2 = Session["ChiidLName2"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, ChildFName2, ChildLName2, "C");

            string ChildFName3 = Session["ChildFName3"].ToString();
            string ChildLName3 = Session["ChiidLName3"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, ChildFName3, ChildLName3, "C");


            string ChildFName4 = Session["ChildFName4"].ToString();
            string ChildLName4 = Session["ChiidLName4"].ToString();
            /*Calling The Method TravellerInsert */
            objFlight.TravellerInsert(BookingId, ChildFName4, ChildLName4, "C");
        }


        /*Writing the successful payment messaage*/
        Response.Write("<script>alert('Payment SuccessFul  BookingId : " + BookingId + "')</script>");
        Server.Transfer("Welcome.aspx");
    }
示例#5
0
    /*on page load*/
    protected void Page_Load(object sender, EventArgs e)
    {
        /*Taking The CustomerId from seession into a variable*/
        int CustomerId = Convert.ToInt32(Session["CustomerId"].ToString());
        /*Making The Object Of   FlightDataBaseLayer*/
        FlightDataBaseLayer objFlight = new FlightDataBaseLayer();
        /*Creating DataSet*/
        DataSet dsPrimaryPassenger = new DataSet();

        /*Calling Method From The   FlightDataBaseLayer*/
        dsPrimaryPassenger = objFlight.GetPrimaryPassenger(CustomerId);

        /*Entering The Details Of The PrimaryPassenger And Disabling It For Editing*/
        txtAdultFirstName1.Text = dsPrimaryPassenger.Tables[0].Rows[0][0].ToString();
        txtAdultLastName1.Text  = dsPrimaryPassenger.Tables[0].Rows[0][1].ToString();

        txtAdultFirstName1.Enabled = false;
        txtAdultLastName1.Enabled  = false;
        drpTitle1.Enabled          = false;


        int iAdults   = Convert.ToInt32(Session["Adults"].ToString());
        int iChildren = Convert.ToInt32(Session["Children"].ToString());
        /*Calling The Method In The FlightDataBaseLayer To Get The Next Booking ID*/
        string BookingId = objFlight.GenerateNextBookingID();

        /*Storing The Booking ID In A Session Variable*/
        Session["BookingId"] = BookingId;

        /*If The Number Of Adults Entered By The User Is One*/
        if (iAdults == 1)
        {
            /*Creating The Session Of Adult Name*/
            Session["AdultFName1"] = txtAdultFirstName1.Text;
            Session["AdultLName1"] = txtAdultLastName1.Text;
            /*Disabling Adult2  Controls*/
            drpTitle2.Enabled        = false;
            rfvTitle2.Enabled        = false;
            txtAdultFname2.Enabled   = false;
            txtAdultlName2.Enabled   = false;
            rfvAdultFName2.Enabled   = false;
            rfvAdultLName2.Enabled   = false;
            rgAdult2Fname.Enabled    = false;
            rgAdult2LastName.Enabled = false;
            /*Disabling Adult3  Controls*/
            drpTitle3.Enabled      = false;
            rfvTitle3.Enabled      = false;
            txtAdultfName3.Enabled = false;
            txtAdultlName3.Enabled = false;
            rfvAdultLName3.Enabled = false;
            rfvAdultFName3.Enabled = false;
            rgAdult3fName.Enabled  = false;
            rgAdult3LName.Enabled  = false;
            /*Disabling Adult4  Controls*/
            drpTitle4.Enabled      = false;
            rfvTitle4.Enabled      = false;
            txtAdultFName4.Enabled = false;
            txtAdultLName4.Enabled = false;
            rfvAdultFName4.Enabled = false;
            rfvAdultLName4.Enabled = false;
            rgAdult4Fname.Enabled  = false;
            rgAdult4LName.Enabled  = false;
        }
        /*If The Number Of Adults Entered By The User Is 2*/
        else if (iAdults == 2)
        {
            /*Creating The Sessions Of Adult Names*/
            Session["AdultFName1"] = txtAdultFirstName1.Text;
            Session["AdultLName1"] = txtAdultLastName1.Text;

            Session["AdultFName2"] = txtAdultFname2.Text;
            Session["AdultLName2"] = txtAdultlName2.Text;


            /*Disabling Adult3  Controls*/
            drpTitle3.Enabled      = false;
            rfvTitle3.Enabled      = false;
            txtAdultfName3.Enabled = false;
            txtAdultlName3.Enabled = false;
            rfvAdultLName3.Enabled = false;
            rfvAdultFName3.Enabled = false;
            rgAdult3fName.Enabled  = false;
            rgAdult3LName.Enabled  = false;
            /*Disabling Adult4  Controls*/
            drpTitle4.Enabled      = false;
            rfvTitle4.Enabled      = false;
            txtAdultFName4.Enabled = false;
            txtAdultLName4.Enabled = false;
            rfvAdultFName4.Enabled = false;
            rfvAdultLName4.Enabled = false;
            rgAdult4Fname.Enabled  = false;
            rgAdult4LName.Enabled  = false;
        }
        /*If The Number Of Adults Entered By The User Is 3*/

        else if (iAdults == 3)
        {
            /*Creating The Sessions Of Adult Names*/
            Session["AdultFName1"] = txtAdultFirstName1.Text;
            Session["AdultLName1"] = txtAdultLastName1.Text;

            Session["AdultFName2"] = txtAdultFname2.Text;
            Session["AdultLName2"] = txtAdultlName2.Text;

            Session["AdultFName3"] = txtAdultfName3.Text;
            Session["AdultLName3"] = txtAdultlName3.Text;

            /*Disabling Adult4  Controls*/
            drpTitle4.Enabled      = false;
            rfvTitle4.Enabled      = false;
            txtAdultFName4.Enabled = false;
            txtAdultLName4.Enabled = false;
            rfvAdultFName4.Enabled = false;
            rfvAdultLName4.Enabled = false;
            rgAdult4Fname.Enabled  = false;
            rgAdult4LName.Enabled  = false;
        }
        /*If The Number Of Adults Entered By The User Is 2*/

        else if (iAdults == 4)
        {
            /*Creating The Sessions Of All Adult Names*/

            Session["AdultFName1"] = txtAdultFirstName1.Text;
            Session["AdultLName1"] = txtAdultLastName1.Text;

            Session["AdultFName2"] = txtAdultFname2.Text;
            Session["AdultLName2"] = txtAdultlName2.Text;

            Session["AdultFName3"] = txtAdultfName3.Text;
            Session["AdultLName3"] = txtAdultlName3.Text;

            Session["AdultFName4"] = txtAdultFName4.Text;
            Session["AdultLName4"] = txtAdultLName4.Text;
        }
        /*If The Number Of Children Entered By The User Is 0*/

        if (iChildren == 0)
        {
            /*Disabling The Child One COntrols*/
            txtChlidFName1.Enabled = false;
            txtChlidLName1.Enabled = false;
            rfvChildFName1.Enabled = false;
            rfvChildLName1.Enabled = false;
            rgChildFname1.Enabled  = false;
            rgChildLname1.Enabled  = false;
            /*Disabling The Child 2 COntrols*/
            txtChlidFName2.Enabled = false;
            txtChlidLName2.Enabled = false;
            rfvChildFName2.Enabled = false;
            rfvChildLName2.Enabled = false;
            rgChildFName2.Enabled  = false;
            rgChildLName2.Enabled  = false;
            /*Disabling The Child 3 COntrols*/
            txtChlidFName3.Enabled = false;
            txtChlidLName3.Enabled = false;
            rfvChildFName3.Enabled = false;
            rfvChildLName3.Enabled = false;
            rgChildFName3.Enabled  = false;
            rgChildLname3.Enabled  = false;
            /*Disabling The Child 4 COntrols*/
            txtChlidFName4.Enabled = false;
            txtChlidLName4.Enabled = false;
            rfvChildFName4.Enabled = false;
            rfvChildLName4.Enabled = false;
            rgChildFName4.Enabled  = false;
            rgChildLName4.Enabled  = false;
        }
        /*If The Number Of Children Entered By The User Is 1*/
        if (iChildren == 1)
        {
            /*Creating The Sessions Of Child Name*/
            Session["ChildFName1"] = txtChlidFName1.Text;
            Session["ChiidLName1"] = txtChlidLName1.Text;

            /*Disabling The Child 2 COntrols*/

            rfvChildFName2.Enabled = false;
            rfvChildLName2.Enabled = false;
            txtChlidFName2.Enabled = false;
            txtChlidLName2.Enabled = false;
            rgChildFName2.Enabled  = false;
            rgChildLName2.Enabled  = false;
            /*Disabling The Child 3 COntrols*/

            rfvChildFName3.Enabled = false;
            rfvChildLName3.Enabled = false;
            txtChlidFName3.Enabled = false;
            txtChlidLName3.Enabled = false;
            rgChildFName3.Enabled  = false;
            rgChildLname3.Enabled  = false;
            /*Disabling The Child 4 COntrols*/

            rfvChildFName4.Enabled = false;
            rfvChildLName4.Enabled = false;
            txtChlidFName4.Enabled = false;
            txtChlidLName4.Enabled = false;
            rgChildFName4.Enabled  = false;
            rgChildLName4.Enabled  = false;
        }
        /*If The Number Of Children Entered By The User Is 2*/
        else if (iChildren == 2)
        {
            /*Creating The Sessions Of Child Names*/

            Session["ChildFName1"] = txtChlidFName1.Text;
            Session["ChiidLName1"] = txtChlidLName1.Text;

            Session["ChildFName2"] = txtChlidFName2.Text;
            Session["ChiidLName2"] = txtChlidLName2.Text;


            /*Disabling The Child 3 COntrols*/
            rfvChildFName3.Enabled = false;
            rfvChildLName3.Enabled = false;
            txtChlidFName3.Enabled = false;
            txtChlidLName3.Enabled = false;
            rgChildFName3.Enabled  = false;
            rgChildLname3.Enabled  = false;
            /*Disabling The Child 4 COntrols*/
            rfvChildFName4.Enabled = false;
            rfvChildLName4.Enabled = false;
            txtChlidFName4.Enabled = false;
            txtChlidLName4.Enabled = false;
            rgChildFName4.Enabled  = false;
            rgChildLName4.Enabled  = false;
        }
        /*If The Number Of Children Entered By The User Is 2*/
        else if (iChildren == 3)
        {
            /*Creating The Sessions Of Child Names*/

            Session["ChildFName1"] = txtChlidFName1.Text;
            Session["ChiidLName1"] = txtChlidLName1.Text;

            Session["ChildFName2"] = txtChlidFName2.Text;
            Session["ChiidLName2"] = txtChlidLName2.Text;

            Session["ChildFName3"] = txtChlidFName3.Text;
            Session["ChiidLName3"] = txtChlidLName3.Text;



            /*Disabling The Child 4 COntrols*/
            rfvChildFName4.Enabled = false;
            rfvChildLName4.Enabled = false;
            txtChlidFName4.Enabled = false;
            txtChlidLName4.Enabled = false;
            rgChildFName4.Enabled  = false;
            rgChildLName4.Enabled  = false;
        }
        /*If The Number Of Children Entered By The User Is 2*/
        else if (iChildren == 4)
        {
            /*Creating The Sessions Of Child Names*/
            Session["ChildFName1"] = txtChlidFName1.Text;
            Session["ChiidLName1"] = txtChlidLName1.Text;

            Session["ChildFName2"] = txtChlidFName2.Text;
            Session["ChiidLName2"] = txtChlidLName2.Text;

            Session["ChildFName3"] = txtChlidFName3.Text;
            Session["ChiidLName3"] = txtChlidLName3.Text;

            Session["ChildFName4"] = txtChlidFName4.Text;
            Session["ChiidLName4"] = txtChlidLName4.Text;
        }
    }