Beispiel #1
0
        protected void viewBoookingDetail()
        {
            String        price;
            int           total = 0;
            SqlConnection conn  = new SqlConnection
                                      ("Server=DESKTOP-41H50KG\\SQLEXPRESS; Database=clubone; Uid=20201113; password=123456");

            conn.Open();

            SqlCommand cmd = new
                             SqlCommand("select BookingTraining.btID as btID, TrainingClass.className as className, TrainingClass.price as price from BookingTraining, TrainingClass where userID=@UID and BookingTraining.classID = TrainingClass.tcID and BookingTraining.status=@S", conn);

            cmd.Parameters.Add("@UID", System.Data.SqlDbType.Int, 100).Value = Session["user_id"];
            cmd.Parameters.AddWithValue("@S", "Approved");
            SqlDataAdapter adapter = new SqlDataAdapter(cmd);
            DataTable      dt_bookedTrainingClass = new DataTable();

            adapter.Fill(dt_bookedTrainingClass);
            TrainingClassList.DataSource = dt_bookedTrainingClass;
            TrainingClassList.DataBind();

            for (int i = 0; i < TrainingClassList.Rows.Count; ++i)
            {
                total = total + (int)dt_bookedTrainingClass.Rows[i]["price"];
            }
            TotalAmount.Text = total.ToString();
            Price.Text       = total.ToString();
        }
Beispiel #2
0
        protected void ViewBookedTrainingClass()
        {
            SqlConnection conn = new SqlConnection
                                     ("Server=DESKTOP-41H50KG\\SQLEXPRESS; Database=clubone; Uid=20201113; password=123456");

            conn.Open();

            SqlCommand cmd = new
                             SqlCommand("select TrainingClass.className, BookingTraining.days, BookingTraining.timeSlot, BookingTraining.status from BookingTraining, TrainingClass where userID=@UID and BookingTraining.classID = TrainingClass.tcID", conn);

            cmd.Parameters.Add("@UID", System.Data.SqlDbType.Int, 100).Value = Session["user_id"];
            SqlDataAdapter adapter = new SqlDataAdapter(cmd);
            DataTable      dt_bookedTrainingClass = new DataTable();

            adapter.Fill(dt_bookedTrainingClass);
            TrainingClassList.DataSource = dt_bookedTrainingClass;
            TrainingClassList.DataBind();
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id        = Request.QueryString["id"].ToString();
            paymentID = Convert.ToInt32(id);
            if (!IsPostBack)
            {
                if (Session["user_id"] == null)
                {
                    Response.Redirect("Login.aspx");
                }

                SqlConnection conn = new SqlConnection
                                         ("Server=DESKTOP-41H50KG\\SQLEXPRESS; Database=clubone; Uid=20201113; password=123456");
                conn.Open();

                SqlCommand cmd = new
                                 SqlCommand("select * from Payment where pID = @PID", conn);
                cmd.Parameters.AddWithValue("@PID", paymentID);
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                DataTable      dt_user = new DataTable();
                adapter.Fill(dt_user);
                Name.Text    = dt_user.Rows[0]["username"].ToString();
                Phone.Text   = dt_user.Rows[0]["phone"].ToString();
                Address.Text = dt_user.Rows[0]["address"].ToString();
                Price.Text   = dt_user.Rows[0]["amount"].ToString();

                SqlCommand cmd2 = new
                                  SqlCommand("select PaymentDetail.trainingclassID as trainingclassID, PaymentDetail.trainingclassName as trainingclassName, PaymentDetail.amount as amount from PaymentDetail where PaymentDetail.paymentID = @PID", conn);
                cmd2.Parameters.AddWithValue("@PID", paymentID);
                SqlDataAdapter adapter2   = new SqlDataAdapter(cmd2);
                DataTable      dt_payment = new DataTable();
                adapter2.Fill(dt_payment);
                TrainingClassList.DataSource = dt_payment;
                TrainingClassList.DataBind();
            }
        }