Ejemplo n.º 1
0
        public bool InsertPhieuThu(PhieuThuDTO dtoPhieuThu)
        {
            string strQuery = "Insert Into PHIEUTHU Values(";

            strQuery += "N'" + dtoPhieuThu.MaPhieuThu + "',";
            strQuery += "N'" + dtoPhieuThu.MaNV + "',";
            strQuery += "N'" + dtoPhieuThu.KhachHang + "',";
            strQuery += "N'" + dtoPhieuThu.NgayLap + "',";
            strQuery += "N'" + dtoPhieuThu.DiaChi + "',";
            strQuery += "N'" + dtoPhieuThu.SoPhieu + "',";
            strQuery += dtoPhieuThu.No + ",";
            strQuery += dtoPhieuThu.Co + ",";
            strQuery += "N'" + dtoPhieuThu.LyDoThu + "',";
            strQuery += dtoPhieuThu.SoTien + ",";
            strQuery += "N'" + dtoPhieuThu.VietBangChu + "',";
            strQuery += "N'" + dtoPhieuThu.KemTheo + "')";
            return(dp.ExecuteNonQuery(strQuery));
        }
Ejemplo n.º 2
0
        public bool InsertPhieuChi(PhieuChiDTO dtoPhieuChi)
        {
            string strQuery = "Insert Into PHIEUCHI Values(";

            strQuery += "N'" + dtoPhieuChi.MaPhieuChi + "',";
            strQuery += "N'" + dtoPhieuChi.MaNV + "',";
            strQuery += "N'" + dtoPhieuChi.KhachHang + "',";
            strQuery += "N'" + dtoPhieuChi.NgayLap + "',";
            strQuery += "N'" + dtoPhieuChi.DiaChi + "',";
            strQuery += "N'" + dtoPhieuChi.SoPhieu + "',";
            strQuery += dtoPhieuChi.No + ",";
            strQuery += dtoPhieuChi.Co + ",";
            strQuery += "N'" + dtoPhieuChi.LyDoChi + "',";
            strQuery += dtoPhieuChi.SoTien + ",";
            strQuery += "N'" + dtoPhieuChi.VietBangChu + "',";
            strQuery += "N'" + dtoPhieuChi.KemTheo + "')";
            return(dp.ExecuteNonQuery(strQuery));
        }
Ejemplo n.º 3
0
        public static int CapNhatLaiTrangThaiPhong(PhieuDangKy_DTO pdkDTO, Phong_DTO phgDTO)
        {
            int    count   = 0;
            string MaPhong = "";

            try
            {
                string strTruyVan_LayMaPhongHienTai = string.Format("SELECT MaPhong from ChiTietLoaiPhong WHERE MaPhieuDK = '" + pdkDTO.MaPhieuDK + "'");
                MaPhong = DataProvider.ExecuteScalar(strTruyVan_LayMaPhongHienTai);

                string strTruyVan_UpdateTTP = string.Format("UPDATE Phong SET TinhTrangPhong = 0 WHERE MaPhong = '" + MaPhong + "'");

                count = DataProvider.ExecuteNonQuery(strTruyVan_UpdateTTP);

                return(count);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("Error : " + ex.Message);
            }
            return(count);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        public static int ThemPhieuDangKy(PhieuDangKy_DTO pdkDTO)
        {
            int count = 0;

            try
            {
                string strTruyVan = string.Format(@"INSERT INTO PhieuDangKy(MaPhieuDK,NgayDen,NgayDi,GioDen, GioDi,SoLuongNguoiLon,SoLuongTreEm,TienDatCoc, MaNV,MaKH) VALUES('{0}', '{1}', '{2}', '{3}', '{4}', {5}, {6}, {7}, '{8}', '{9}')", pdkDTO.MaPhieuDK, pdkDTO.NgayDen, pdkDTO.NgayDi, pdkDTO.GioDen, pdkDTO.GioDi, pdkDTO.SoLuongNguoiLon, pdkDTO.SoLuongTreEm, pdkDTO.TienDatCoc, pdkDTO.MaNV, pdkDTO.MaKH);

                count = DataProvider.ExecuteNonQuery(strTruyVan);

                //Cập nhật phiếu đăng ký đã có khách hàng
                string strTruyVanUpdateKH = " UPDATE KhachHang SET DaXacNhan = 1 WHERE MaKH =  '" + pdkDTO.MaKH + "'";

                count = DataProvider.ExecuteNonQuery(strTruyVanUpdateKH);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("Error : " + ex.Message);
            }

            return(count);
        }
Ejemplo n.º 6
0
        public static int XacNhanHoaDon(HoaDon_DTO hdDTO)
        {
            int count = 0;

            try
            {
                //Tự sửa lại mã nhân viên
                string strTruyVan = string.Format("INSERT INTO HoaDon(MaHoaDon,NgayThanhToan,SoTienDaDatTruoc,TongTienHoaDon,MaNV,MaChiTietHoaDon) VALUES ('{0}','{1}',{2},{3},'{4}','{5}')", hdDTO.MaHoaDon, hdDTO.NgayThanhToan, hdDTO.SoTienDaDatTruoc, hdDTO.TongTienHoaDon, hdDTO.MaNV, hdDTO.MaChiTietHoaDon);

                count = DataProvider.ExecuteNonQuery(strTruyVan);

                string strTruyVan2 = string.Format("UPDATE ChiTietHoaDon SET DaThanhToan = 1 WHERE MaChiTietHoaDon = '" + hdDTO.MaChiTietHoaDon + "'");



                count = DataProvider.ExecuteNonQuery(strTruyVan2);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(count);
        }