Esempio n. 1
0
 protected void checkTrans_Click(object sender, EventArgs e)
 {
     BankServiceReference.ServiceSoapClient A = new BankServiceReference.ServiceSoapClient();
      A.deposit(TextBox1.Text, double.Parse(TextBox2.Text), TextBox4.Text, DropDownList1.Text); // Calendar2.SelectedDate.ToString()
         Response.Write("<script>alert('Amount Deposited Succesfully!')</script>");
         TextBox1.Text = "";
         TextBox2.Text = "";
         TextBox4.Text = "";
 }
    protected void ButtonSearch_Click(object sender, EventArgs e)
    {
        try
        {
            if (Session["man"] != null)
            {
                Passenger pass = (Passenger)Session["man"];

                String date1 = (Calendar1.SelectedDate.Day + "/" + Calendar1.SelectedDate.Month + "/" + Calendar1.SelectedDate.Year);

                double COST = 0;
                if (DropDownList1.Text == "A")
                {
                    COST = 90000;
                }
                if (DropDownList1.Text == "B")
                {
                    COST = 60000;
                }
                if (DropDownList1.Text == "C")
                {
                    COST = 35000;
                }

                pass.AirFrom = TextBox4.Text;
                pass.AirTo = TextBox5.Text;
                pass.AirDate = date1;
                pass.AirType = DropDownList1.Text;
                pass.AirTripType = "one-way";
                pass.AirRouteID = "2";
                pass.AirSeats = TextBox2.Text;
                pass.AirTicketPrice = "" + COST;

                AirlineServiceReference.ServiceSoapClient s2 = new AirlineServiceReference.ServiceSoapClient();
                double cost_price = (double)s2.getCostPrice(DropDownList1.Text);
                double total = double.Parse(TextBox2.Text) * COST;
                double deposit_agent_amount = total - (cost_price * int.Parse(TextBox2.Text));

                if (s2.booking(int.Parse("2"), int.Parse(TextBox2.Text), DropDownList1.Text, TextBox4.Text, TextBox5.Text, "one-way", COST, total) == 1)
                {
                    BankServiceReference.ServiceSoapClient s3 = new BankServiceReference.ServiceSoapClient();

                    s3.deposit("VMART-AGENT", deposit_agent_amount, "Credit From Airline", "credit");
                    s3.deposit("SL-AIRLINES", (cost_price * int.Parse(TextBox2.Text)), "Credit From Agent", "credit");

                    //  MessageBox.Show("Booking Successfull");

                    Response.Write("<script>alert('Airflight Booking Successfull!')</script>");
                    Response.Redirect("hotel_reservation.aspx?Id=" + Session["UserId"].ToString());

                    TextBox4.Text = "";
                    TextBox5.Text = "";
                    TextBox2.Text = "";

                }
                //  MessageBox.Show("Hotel Room Booking Successfull");

                else
                {
                    Response.Write("<script>alert('Invalid Input Try Again!')</script>");
                    //MessageBox.Show("Invalid Input Try Again");
                }

            }
        }

            catch (Exception ee22)
            {
            }
    }
    protected void next_Click(object sender, EventArgs e)
    {
        if (Session["man"] != null)
        {
            Passenger pass = (Passenger)Session["man"];

            pass.HotelType = roomType.Text;
            pass.HotelRooms = TextBox1.Text;
            pass.HotelCheckIn = Calendar1.SelectedDate.ToString();

            //////////////////

            string connect = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=|DataDirectory|Members.mdb";
            string query = "Select passport From Membership Where username = ?";

            List<string> list = new List<string>();

            using (OleDbConnection conn = new OleDbConnection(connect))
            {
                using (OleDbCommand cmd = new OleDbCommand(query, conn))
                {
                    cmd.Parameters.AddWithValue("", Session["UserId"]);
                    conn.Open();
                    OleDbDataReader test = cmd.ExecuteReader();
                       while (test.Read())
                       {
                         list.Add(test.GetString(0));
                       }
                 }
            }

            //aval.Text = list[0];

            String date1 = (Calendar1.SelectedDate.Day + "/" + Calendar1.SelectedDate.Month + "/" + Calendar1.SelectedDate.Year);

            try
            {
                double COST = 0;
                int roomID = 1;

                if (roomType.Text == "BB")
                {
                    COST = 50000;
                }
                if (roomType.Text == "FB")
                {
                    COST = 19000;
                }
                if (roomType.Text == "HB")
                {
                    COST = 26000;
                }
                    Hotel22ServiceReference.ServiceSoapClient s4 = new Hotel22ServiceReference.ServiceSoapClient();
                    double cost_price = (double)s4.getCostPrice(roomType.Text);
                    double total = COST * int.Parse(TextBox1.Text);
                    double deposit_agent_amount = total - (cost_price * int.Parse(TextBox1.Text));

                    if (s4.booking(roomID, int.Parse(TextBox1.Text), roomType.Text, COST, total, date1) == 1)
                    {

                        BankServiceReference.ServiceSoapClient s33 = new BankServiceReference.ServiceSoapClient();

                        s33.deposit("VMART-AGENT", deposit_agent_amount, "Credit From Hotel", "credit");
                        s33.deposit("TAJ-HOTEL", (cost_price * int.Parse(TextBox1.Text)), "Credit From Agent", "credit");

                       // Response.Write("<script>alert('Hotel Booking Successfull!')</script>");
                        Response.Redirect("Summary.aspx?Id=" + Session["UserId"].ToString());

                        //TextBox1.Text = "";

                    }
                    else
                    {
                             Response.Write("<script>alert('Invalid Input Try Again!')</script>");
                    }

            }
            catch (Exception ee22)
            {
            }
        }
    }