protected void btnAlreadyBookedTickets_OnClick(object sender, EventArgs e)
 {
     if (Session["LoggedInUser"] != null)
     {
         if (ddlAirbus.SelectedValue != null)
         {
             AirlineBL abl = new AirlineBL();
             DataTable dt = (DataTable)Session["LoggedInUser"];
             gvAirlineBookedSeats.DataSource = abl.GetBookedSlots(dt.Rows[0]["airbus_user_name"].ToString(), dt.Rows[0]["airbus_password"].ToString(), int.Parse(ddlAirbus.SelectedValue));
             gvAirlineBookedSeats.DataBind();
         }
     }
 }
 protected void btnAirbusSeatBook_OnClick(object sender, EventArgs e)
 {
     if (Session["LoggedInUser"] != null)
     {
         if (ddlAirbus.SelectedValue != null)
         {
             AirlineBL abl = new AirlineBL();
             DataTable dt = (DataTable)Session["LoggedInUser"];
             lblTicketNumber.Text = "Booking Refeence Number" + abl.BookSlot(dt.Rows[0]["airbus_user_name"].ToString(), dt.Rows[0]["airbus_password"].ToString(), int.Parse(ddlAirbus.SelectedValue), int.Parse(ddlAvailableSeatNumbers.SelectedValue), DateTime.Parse(txtTravelDate.Text), false, txtSSN.Text, dt.Rows[0]["airbus_user_name"].ToString()).ToString();
             btnAirlineBookedSearch_OnClick(null, null);
             btnAlreadyBookedTickets_OnClick(null, null);
         }
     }
 }
 protected void btnAirlineBookedSearch_OnClick(object sender, EventArgs e)
 {
     if (Session["LoggedInUser"] != null)
     {
         if (ddlAirbus.SelectedValue != null)
         {
             AirlineBL abl = new AirlineBL();
             DataTable dt = (DataTable)Session["LoggedInUser"];
             ddlAvailableSeatNumbers.DataSource = abl.GetSlots(dt.Rows[0]["airbus_user_name"].ToString(), dt.Rows[0]["airbus_password"].ToString(), int.Parse(ddlAirbus.SelectedValue), DateTime.Parse(txtTravelDate.Text));
             ddlAvailableSeatNumbers.DataValueField = "airbus_seats_id";
             ddlAvailableSeatNumbers.DataTextField = "airbus_seats_number";
             ddlAvailableSeatNumbers.DataBind();
         }
     }
 }
        private void Clear()
        {
            AirlineBL abl = new AirlineBL();
            DataTable dt = (DataTable)Session["LoggedInUser"];
            ddlAvailableSeatNumbers.DataSource = abl.GetSlots(dt.Rows[0]["airbus_user_name"].ToString(), dt.Rows[0]["airbus_password"].ToString(), 0, DateTime.Parse(txtTravelDate.Text));
            ddlAvailableSeatNumbers.DataValueField = "airbus_seats_id";
            ddlAvailableSeatNumbers.DataTextField = "airbus_seats_number";
            ddlAvailableSeatNumbers.DataBind();

            gvAirlineBookedSeats.DataSource = abl.GetBookedSlots(dt.Rows[0]["airbus_user_name"].ToString(), dt.Rows[0]["airbus_password"].ToString(), 0);
            gvAirlineBookedSeats.DataBind();
        }
 private void AirlineBinding()
 {
     if (Session["LoggedInUser"] != null)
     {
         AirlineBL abl = new AirlineBL();
         DataTable dt = (DataTable)Session["LoggedInUser"];
         ddlAirlines.DataSource = abl.GetAirlines(dt.Rows[0]["airbus_user_name"].ToString(), dt.Rows[0]["airbus_password"].ToString());
         ddlAirlines.DataValueField = "airline_id";
         ddlAirlines.DataTextField = "airline_name";
         ddlAirlines.DataBind();
     }
 }
 private void AirbusBinding()
 {
     if (Session["LoggedInUser"] != null)
     {
         AirlineBL abl = new AirlineBL();
         DataTable dt = (DataTable)Session["LoggedInUser"];
         ddlAirbus.DataSource = abl.GetAirbus(dt.Rows[0]["airbus_user_name"].ToString(), dt.Rows[0]["airbus_password"].ToString(), int.Parse(ddlAirlines.SelectedValue), ddlAirbusFrom.SelectedValue, ddlAirbusTo.SelectedValue);
         ddlAirbus.DataValueField = "airbus_id";
         ddlAirbus.DataTextField = "airbus_code";
         ddlAirbus.DataBind();
     }
 }
        protected void gvAirlineBookedSeats_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int id = int.Parse(e.CommandArgument.ToString());
            if (e.CommandName.Equals("Update Ticket") && e.CommandArgument != null)
            {
                if (txtTravelDate.Text.Length == 0)
                {
                    lblBError.Text = "Please select date.";
                    return;
                }
                if (ddlAvailableSeatNumbers.SelectedValue == null || ddlAvailableSeatNumbers.SelectedValue == "")
                {
                    lblBError.Text = "Please select slot number.";
                    return;
                }
                if (ddlAirbus.SelectedValue == null || ddlAirbus.SelectedValue == "")
                {
                    lblBError.Text = "Please select Airbus.";
                    return;
                }
                AirlineBL abl = new AirlineBL();
                DataTable dt = (DataTable)Session["LoggedInUser"];

                abl.UpdateSlot(dt.Rows[0]["airbus_user_name"].ToString(), dt.Rows[0]["airbus_password"].ToString(), id, int.Parse(ddlAirbus.SelectedValue), int.Parse(ddlAvailableSeatNumbers.SelectedValue), DateTime.Parse(txtTravelDate.Text));
            }
            else if (e.CommandName.Equals("Delete Ticket") && e.CommandArgument != null)
            {
                AirlineBL abl = new AirlineBL();
                DataTable dt = (DataTable)Session["LoggedInUser"];
                abl.DeleteSlot(dt.Rows[0]["airbus_user_name"].ToString(), dt.Rows[0]["airbus_password"].ToString(), id);
            }
            else if (e.CommandName.Equals("Confirm") && e.CommandArgument != null)
            {
                if (txtPaidAmount.Text.Length == 0)
                {
                    lblBError.Text = "Please enter amount.";
                    return;
                }
                int amt = 0;
                int.TryParse(txtPaidAmount.Text, out amt);
                if (amt == 0)
                {
                    lblBError.Text = "Please enter correct amount.";
                    return;
                }
                AirlineBL abl = new AirlineBL();
                DataTable dt = (DataTable)Session["LoggedInUser"];
                abl.ConfirmSlot(dt.Rows[0]["airbus_user_name"].ToString(), dt.Rows[0]["airbus_password"].ToString(), id, int.Parse(ddlAvailableSeatNumbers.SelectedValue), Decimal.Parse(txtPaidAmount.Text));
            }
            btnAlreadyBookedTickets_OnClick(null, null);
        }