Exemplo n.º 1
0
        public bool ThemHSX(clsHangSanXuat_DTO HSX)
        {
            string strMaHSX = "HSX" + (ThaoTacDuLieu.DemSoDongCuaBang("HangSanXuat") + 1);
            string query    = string.Format("insert into HangSanXuat values('{0}',N'{1}',N'{2}','{3}')", strMaHSX, HSX.TenHangSanXuat, HSX.GhiChu, 1);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 2
0
        public bool ThemSanPham(clsSanPham_DTO sanPham)
        {
            string strMaSP = "SP" + (ThaoTacDuLieu.DemSoDongCuaBang("SanPham") + 1);
            string query   = string.Format("insert into SanPham values('{0}',N'{1}','{2}','{3}','{4}','{5}',N'{6}','{7}','{8}','{9}','{10}','{11}',N'{12}','{13}')", strMaSP, sanPham.TenSanPham, sanPham.Hinh, sanPham.GiaMua, sanPham.GiaBan, sanPham.KhuyenMai, sanPham.MoTa, sanPham.BaoHanh, sanPham.SoLuong, sanPham.DonViTinh, sanPham.MaLoaiSanPham, sanPham.MaHangSanXuat, sanPham.GhiChu, 1);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 3
0
        public void CapNhapBaoHanh(string strSoSerial)
        {
            string strMaSerial = _SerialDAO.LayMaSerial(strSoSerial);
            string query       = string.Format("update ChiTietBaoHanh set TinhTrang=1 where MaSerial='{0}'", strMaSerial);

            ThaoTacDuLieu.ThucThi(query);
        }
Exemplo n.º 4
0
        public bool ThemLoai(clsLoai_DTO loai)
        {
            string strMaLoai = "LSP" + (ThaoTacDuLieu.DemSoDongCuaBang("LoaiSanPham") + 1);
            string query     = string.Format("insert into LoaiSanPham values('{0}',N'{1}',N'{2}','{3}')", strMaLoai, loai.TenLoaiSanPham, loai.GhiChu, 1);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 5
0
        public bool ThemNhanVien(clsNhanVien_DTO nhanvien)
        {
            string MaNV  = "NV" + (ThaoTacDuLieu.DemSoDongCuaBang("NhanVien") + 1);
            string query = string.Format("insert into NhanVien values('{0}',N'{1}','{2}','{3}','{4}',N'{5}','{6}','{7}','{8}','{9}','{10}','{11}')", MaNV, nhanvien.TenNV, nhanvien.TenDangNhap, nhanvien.MatKhau, nhanvien.Hinh, nhanvien.DiaChi, nhanvien.CMND, nhanvien.SDT, nhanvien.Email, nhanvien.Quyen, "", 1);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 6
0
        public string ThemBaoHanh(clsBaoHanh_DTO baoHanh)
        {
            string strMaBH = "BH" + (ThaoTacDuLieu.DemSoDongCuaBang("BaoHanh") + 1);
            string query   = string.Format("insert into BaoHanh values('{0}','{1}','{2}','{3}',1)", strMaBH, baoHanh.MaKhachHang, baoHanh.MaNhanVien, baoHanh.NgayBaoHanh);

            ThaoTacDuLieu.ThucThi(query);
            return(strMaBH);
        }
Exemplo n.º 7
0
        public string ThemNCC(clsNhaCungCap_DTO NCC)
        {
            string strMaNCC = "NCC" + (ThaoTacDuLieu.DemSoDongCuaBang("NhaCungCap") + 1);
            string query    = string.Format("insert into NhaCungCap values('{0}',N'{1}',N'{2}',N'{3}',N'{4}',1)", strMaNCC, NCC.TenNhaCungCap, NCC.DiaChi, NCC.SoDT, NCC.GhiChu);

            ThaoTacDuLieu.ThucThi(query);
            return(strMaNCC);
        }
Exemplo n.º 8
0
 public void ThemChiTietBaoHanh(List <clsChiTietBaoHanh_DTO> dsChiTiet, string strMaBH)
 {
     foreach (clsChiTietBaoHanh_DTO chiTiet in dsChiTiet)
     {
         string query = string.Format("insert into ChiTietBaoHanh values('{0}','{1}','{2}','{3}',N'{4}',N'{5}')", strMaBH, chiTiet.MaSerial, chiTiet.NgayHenTra, chiTiet.TinhTrang, chiTiet.MotaLoi, chiTiet.GhiChu);
         ThaoTacDuLieu.ThucThi(query);
     }
 }
Exemplo n.º 9
0
        public string TaoPhieuNhap(clsPhieuNhap_DTO phieuNhap)
        {
            string strMaPhieu = "PN" + (ThaoTacDuLieu.DemSoDongCuaBang("PhieuNhap") + 1);
            string query      = string.Format("insert into PhieuNhap values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}',1,1)", strMaPhieu, phieuNhap.MaNhaCungCap, phieuNhap.TongTien, phieuNhap.TienNo, phieuNhap.ChietKhau, phieuNhap.Thue, phieuNhap.NgayLap, phieuNhap.MaNVLap, phieuNhap.GhiChu);

            ThaoTacDuLieu.ThucThi(query);
            return(strMaPhieu);
        }
Exemplo n.º 10
0
 public void ThemSoSerial(string strMaSP, int iSL, string strMaPhieu)
 {
     for (int i = 0; i < iSL; i++)
     {
         string strMaSR     = "SER" + (ThaoTacDuLieu.DemSoDongCuaBang("Serial") + 1);
         string strSoSerial = PhatSinhSerial();
         string query       = string.Format("insert into Serial values('{0}','{1}',NULL,'{2}',NULL,NULL,'{3}',1)", strMaSR, strSoSerial, strMaSP, strMaPhieu);
         ThaoTacDuLieu.ThucThi(query);
     }
 }
        public void TaoChiTieuPhieuNhap(List <clsChiTietPhieuNhap_DTO> dsChiTiet, string strMaPhieuNhap)
        {
            foreach (clsChiTietPhieuNhap_DTO chiTiet in dsChiTiet)
            {
                string sqlInsertChitiet = string.Format("insert into ChiTietPhieuNhap values ('{0}','{1}','{2}','{3}')", strMaPhieuNhap, chiTiet.MaSanPham, chiTiet.SoLuong, chiTiet.Gia);

                ThaoTacDuLieu.ThucThi(sqlInsertChitiet);

                // Đặt lại số lượng mới cho SP
                int iSLMoi = _SanPhamDAO.LaySoLuongSP(chiTiet.MaSanPham) + chiTiet.SoLuong;
                _SanPhamDAO.DatLaiSoLuongSP(chiTiet.MaSanPham, iSLMoi);
            }
        }
Exemplo n.º 12
0
        public bool ThemSoLuongSP(string strMaSP, int SL)
        {
            string queryUpdateSP = string.Format("update SanPham set SoLuong={1} where MaSanPham='{0}'", strMaSP, SL);

            if (ThaoTacDuLieu.ThucThi(queryUpdateSP))
            {
                int SoDong = 0;
                for (int i = 0; i < SL; i++)
                {
                    string SoSR = TienIch.GenerateSerial(12);
                    SoDong = ThaoTacDuLieu.DemSoDongCuaBang("Serial");
                    string MaSR = "SER" + (SoDong + 1);
                    ThaoTacDuLieu.ThucThi(string.Format("insert into Serial values('{0}','{1}',NULL,'{2}',NULL,{3})", MaSR, SoSR, strMaSP, 1));
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 13
0
 public bool XoaLoai(string strMaLoai)
 {
     return(ThaoTacDuLieu.ThucThi(string.Format("update LoaiSanPham set TrangThai=0 where MaLoaiSanPham='{0}'", strMaLoai)));
 }
Exemplo n.º 14
0
        public bool XoaNCC(string MaNCC)
        {
            string query = string.Format("update NhaCungCap set TrangThai=0 where MaNhaCungCap='{0}'", MaNCC);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 15
0
        public bool XoaPhieuNhap(string strMaPhieu)
        {
            string query = string.Format("update PhieuNhap set TrangThai=0 where MaPhieuNhap='{0}'", strMaPhieu);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 16
0
        public bool HoanTatChuyenHang(string strMaPhieu)
        {
            string query = string.Format("update PhieuXuat set Loai=1 where MaPhieuXuat='{0}'", strMaPhieu);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 17
0
        public bool XoaPhieuBaoHanh(string strMaBH)
        {
            string query = string.Format("update BaoHanh set TrangThai=0 where MaBaoHanh='{0}'", strMaBH);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 18
0
        public bool SuaSanPham(clsSanPham_DTO sanPham)
        {
            string query = string.Format("update SanPham set TenSanPham=N'{0}',Hinh='{1}',GiaMua='{2}',GiaBan='{3}',KhuyenMai='{4}',MoTa=N'{5}',BaoHanh='{6}',SoLuong='{7}',DonViTinh='{8}',MaLoaiSanPham='{9}',MaHangSanXuat='{10}',GhiChu=N'{11}',TrangThai='{12}' where MaSanPham='{13}'", sanPham.TenSanPham, sanPham.Hinh, sanPham.GiaMua, sanPham.GiaBan, sanPham.KhuyenMai, sanPham.MoTa, sanPham.BaoHanh, sanPham.SoLuong, sanPham.DonViTinh, sanPham.MaLoaiSanPham, sanPham.MaHangSanXuat, sanPham.GhiChu, 1, sanPham.MaSanPham);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 19
0
        public bool SuaNCC(clsNhaCungCap_DTO NCC)
        {
            string query = string.Format("update NhaCungCap set TenNhaCungCap=N'{0}',DiaChi=N'{1}',SoDT='{2}',GhiChu=N'{3}' where MaNhaCungCap='{4}'", NCC.TenNhaCungCap, NCC.DiaChi, NCC.SoDT, NCC.GhiChu, NCC.MaNhaCungCap);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 20
0
        public bool XoaNhanVien(string MaNV)
        {
            string query = string.Format("update NhanVien set TrangThai=0 where MaNhanVien='{0}'", MaNV);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 21
0
        public bool SuaLoai(clsLoai_DTO loai)
        {
            string query = string.Format("update LoaiSanPham set TenLoaiSanPham=N'{0}',GhiChu=N'{1}',TrangThai=1 where MaLoaiSanPham='{2}'", loai.TenLoaiSanPham, loai.GhiChu, loai.MaLoaiSanPham);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 22
0
        public bool SuaHSX(clsHangSanXuat_DTO HSX)
        {
            string query = string.Format("update HangSanXuat set TenHangSanXuat=N'{0}',GhiChu=N'{1}',TrangThai=1 where MaHangSanXuat='{2}'", HSX.TenHangSanXuat, HSX.GhiChu, HSX.MaHangSanXuat);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 23
0
 public bool XoaHSX(string strMaHSX)
 {
     return(ThaoTacDuLieu.ThucThi(string.Format("update HangSanXuat set TrangThai=0 where MaHangSanXuat='{0}'", strMaHSX)));
 }
Exemplo n.º 24
0
        public bool SuaNhanVien(clsNhanVien_DTO nhanvien)
        {
            string query = string.Format("update NhanVien set TenNhanVien='{0}',TenDangNhap='{1}',MatKhau='{2}',HinhDaiDien='{3}',DiaChi=N'{4}',CMND='{5}',SoDT='{6}',Email='{7}',Quyen={8},GhiChu='{9}',TrangThai={10} where MaNhanVien='{11}'", nhanvien.TenNV, nhanvien.TenDangNhap, nhanvien.MatKhau, nhanvien.Hinh, nhanvien.DiaChi, nhanvien.CMND, nhanvien.SDT, nhanvien.Email, nhanvien.Quyen, "", 1, nhanvien.MaNV);

            return(ThaoTacDuLieu.ThucThi(query));
        }
Exemplo n.º 25
0
        public bool XoaSanPham(string strMaSP)
        {
            string query = string.Format("update SanPham set TrangThai=0 where MaSanPham='{0}'", strMaSP);

            return(ThaoTacDuLieu.ThucThi(query));
        }