Example #1
0
        // lay nhung order da xong(huy)
        public List <DSsudungDV> getOrderdone(int MaDatPhong)
        {
            List <DSsudungDV> dSsudung = new List <DSsudungDV>();

            conn.Open();
            SqlCommand    cmd    = new SqlCommand("select * from sudungdv,datphong,phong,hoadon,dichvu,danh_muc where sudungdv.MaDatPhong=datphong.MaDatPhong and datphong.MaPhong=phong.MaPhong and sudungdv.IDHoaDon=hoadon.IDHoaDon and sudungdv.MaDichVu=dichvu.MaDichVu and dichvu.danhmuc=danh_muc.danhmuc and datphong.TrangThai=0 and sudungdv.TrangThai=1 and sudungdv.MaDatPhong=" + MaDatPhong + "", conn);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                DSsudungDV suDungDV = new DSsudungDV();
                suDungDV.madatdv    = (int)reader["madatdv"];
                suDungDV.MaDatPhong = (int)reader["MaDatPhong"];
                suDungDV.MaDichVu   = (int)reader["MaDichVu"];
                suDungDV.soLuong    = (int)reader["SoLuong"];
                suDungDV.Order_Gia  = (double)(suDungDV.soLuong * svc.getTien(suDungDV.MaDichVu));
                suDungDV.IDHoaDon   = (int)reader["IDHoaDon"];
                suDungDV.HoTen      = (string)reader["HoTen"];
                suDungDV.TenPhong   = (string)reader["Tenphong"];
                suDungDV.TenDichVu  = (string)reader["TenDichVu"];
                dSsudung.Add(suDungDV);
            }
            conn.Close();
            return(dSsudung);
        }
Example #2
0
        protected void btnOderUser_Click(object sender, EventArgs e)
        {
            DSsudungDV dSsudung = new DSsudungDV();

            dSsudung.MaDatPhong = int.Parse(DDL_Phong.SelectedValue.ToString());
            dSsudung.MaDichVu   = int.Parse(DDL_SanPham.SelectedValue.ToString());
            dSsudung.soLuong    = int.Parse(txtpickquantity.Text.ToString());
            dSsudung.IDHoaDon   = OrderDichVu.getMaHoaDon(int.Parse(DDL_Phong.SelectedValue.ToString()));
            OrderDichVu.themOrder(dSsudung);
            OrderDichVu.updateService_price(int.Parse(DDL_Phong.SelectedValue.ToString()));
            OrderDichVu.updateTotal_price(int.Parse(DDL_Phong.SelectedValue.ToString()));
            err_msg.ForeColor = System.Drawing.Color.Aqua;
            err_msg.Text      = "Đặt dịch vụ thành công";
        }
Example #3
0
        // Them order(tin)
        public void themOrder(DSsudungDV dSsudung)
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand("insert into sudungdv values(@MaDatPhong,@MaDichVu,@SoLuong,@Gia,@IDHoaDon,@TrangThai)", conn);

            cmd.Parameters.AddWithValue("@MaDatPhong", dSsudung.MaDatPhong);
            cmd.Parameters.AddWithValue("@MaDichVu", dSsudung.MaDichVu);
            cmd.Parameters.AddWithValue("@SoLuong", dSsudung.soLuong);
            cmd.Parameters.AddWithValue("@Gia", dSsudung.soLuong * svc.getTien(dSsudung.MaDichVu));
            cmd.Parameters.AddWithValue("@IDHoaDon", dSsudung.IDHoaDon);
            cmd.Parameters.AddWithValue("@TrangThai", false);//chưa thanh toán
            cmd.ExecuteNonQuery();
            conn.Close();
        }
Example #4
0
        // Lay madatphong va maphong(Tin)
        public List <DSsudungDV> getPhong()
        {
            List <DSsudungDV> dssdDV = new List <DSsudungDV>();

            conn.Open();
            string        sql    = "select * from datphong,phong where datphong.maphong = phong.maphong and datphong.TrangThai = 0";
            SqlCommand    cmd    = new SqlCommand(sql, conn);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                DSsudungDV dSsudungDV = new DSsudungDV();
                dSsudungDV.MaDatPhong = (int)reader["MaDatPhong"];
                dSsudungDV.TenPhong   = (string)reader["TenPhong"];
                dssdDV.Add(dSsudungDV);
            }
            conn.Close();
            return(dssdDV);
        }
Example #5
0
        public List <DSsudungDV> Getsudungdv(int MaDichVu)
        {
            List <DSsudungDV> li = new List <DSsudungDV>();

            conn.Open();
            SqlCommand    cmd    = new SqlCommand("select sudungdv.MaDichVu,sudungdv.SoLuong,sudungdv.Gia from dichvu,sudungdv where dichvu.MaDichVu=sudungdv.MaDichVu and sudungdv.MaDichVu='" + MaDichVu + "'", conn);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                DSsudungDV svc = new DSsudungDV();
                svc.MaDichVu = (int)reader["MaDichVu"];
                svc.soLuong  = (int)reader["SoLuong"];
                svc.Gia      = (double)reader["Gia"];
                li.Add(svc);
            }
            conn.Close();
            return(li);
        }