Esempio n. 1
0
        public static int KiemTraMa(string MaPhieuDK)
        {
            string  strTruyVan = string.Format("SELECT * FROM PhieuDangKy WHERE MaPhieuDK = '" + MaPhieuDK + "'");
            DataSet ds         = new DataSet();

            ds = DataProvider.fillDataSet(strTruyVan);
            DataView dv = new DataView(ds.Tables[0]);

            if (dv.Count != 0)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Esempio n. 2
0
        public static int LayTienDichVu(string maPhong)
        {
            int count = 0;

            try
            {
                string strTruyVan = string.Format("create view Tam as select  distinct p.MaPhong, p.TenPhong, k.TenKH,ldv.MaLoaiDichVu,ldv.TenLoaiDichVu,dv.MaDichVu,TenDichVu,count(TenDichVu) as [SoLuong],sum(ThanhTien)as [Tong Tien] from DanhSachSDDichVu d  join Phong p on p.MaPhong = d.MaPhong join ChiTietLoaiPhong c on p.MaPhong  = c.MaPhong join PhieuDangKy ph on ph.MaPhieuDK = c.MaPhieuDK  join KhachHang k on k.MaKH = ph.MaKH  join DichVu dv on dv.MaDichVu = d.MaDichVu  join LoaiDichVu ldv on dv.MaLoaiDichVu = ldv.MaLoaiDichVu where p.MaPhong = '" + maPhong + "' group by TenDichVu, k.TenKH, p.TenPhong, p.MaPhong, dv.MaDichVu, ldv.MaLoaiDichVu, ldv.TenLoaiDichVu");
                DataProvider.fillDataSet(strTruyVan);

                string strTruyVan2 = string.Format("select sum([Tong Tien]) from Tam");
                string tmp         = DataProvider.ExecuteScalar(strTruyVan2).ToString().Split('.')[0];
                count = int.Parse(tmp);

                string strTruyVan3 = string.Format("drop view Tam");
                DataProvider.ExecuteNonQuery(strTruyVan3);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(count);
        }