Exemplo n.º 1
0
        public int themNhanVien(NhanVien nv)
        {
            //string query = string.Format("INSERT dbo.NhanVien(MaNV, TenNV, DiaChi, SDT, NgaySinh,GT, ChucVu, Luongcb, PhuCap, HSLuong, Thuong) VALUES  ( N'{0}' ,  N'{1}' ,  N'{2}' , N'{3}' ,  '{4}' ,N'{5}' ,  N'{6}' ,  {7} , {8} ,  {9} , {10} )",nv.maNV,nv.tenNV,nv.diaChi,nv.sDT,nv.ngaySinh,nv.gT,nv.chucVu,nv.luongCB,nv.phuCap,nv.hSLuong,nv.thuong);
            string query = "INSERT dbo.NhanVien(MaNV, TenNV, DiaChi, SDT, NgaySinh,GT, ChucVu, Luongcb, PhuCap, HSLuong, Thuong) VALUES  ( @manv ,  @tennv ,  @dc , @sdt , @ns  , @gt ,  @cv ,  @lcb , @pc ,  @hsl , @thuong )";

            return(DatabaseDAL.executeNonQuery(query, nv.maNV, nv.tenNV, nv.diaChi, nv.sDT, nv.ngaySinh, nv.gT, nv.chucVu, nv.luongCB, nv.phuCap, nv.hSLuong, nv.thuong));
        }
Exemplo n.º 2
0
        public bool InsertChiTietPhieuNhap(ChiTietPhieuNhap chiTiet)
        {
            int result = 0;

            result = DatabaseDAL.ExecuteNonQuery("exec USP_InsertChitiet_PhieuNhap @sochungtu , @mahang , @soluong , @dongia , @thanhtien , @donvitinh ", new object[] { chiTiet.SoChungTu, chiTiet.MaHang, chiTiet.SoLuongNhap, chiTiet.DonGia, chiTiet.ThanhTien, chiTiet.DonViTinh });
            return(result > 0);
        }
Exemplo n.º 3
0
        public int SuaHangHoa(HangHoa hh)
        {
            string query = "UPDATE dbo.HangHoa" +
                           " SET TenHang=@tenhang , MaLoai=@maloai , NSX=@nsx ,HSD=@hsd ,SoLuong=@sl ,Gia=@gia ,MaNsx=@man ,Vitri= @vitri " +
                           "WHERE MaHang =@ma";

            return(DatabaseDAL.executeNonQuery(query, hh.tenHang, hh.maLoai, hh.NSX, hh.HSD, hh.soLuong, hh.gia, hh.maNSX, hh.viTri, hh.maHang));
        }
Exemplo n.º 4
0
        public int SuaChungLoai(ChungLoai ch)
        {
            string query = " UPDATE dbo.ChungLoai " +
                           " SET TenLoai = @ten " +
                           " WHERE MaLoai = @ma ";

            return(DatabaseDAL.executeNonQuery(query, ch.tenLoai, ch.maLoai));
        }
Exemplo n.º 5
0
        public int ThemHangHoa(HangHoa hh)
        {
            string query = "INSERT INTO dbo.HangHoa" +
                           "(MaHang, TenHang, MaLoai, NSX, HSD, SoLuong, Gia, MaNsx, Vitri)" +
                           " VALUES(@ma, @ten, @maloai, @nsx, @hsd, @sl, @gia, @mansx, @vitri)";

            return(DatabaseDAL.executeNonQuery(query, hh.maHang, hh.tenHang, hh.maLoai, hh.NSX, hh.HSD, hh.soLuong, hh.gia, hh.maNSX, hh.viTri));
        }
Exemplo n.º 6
0
        public int ThemChungLoai(ChungLoai ch)
        {
            string query = "INSERT INTO dbo.ChungLoai" +
                           "(MaLoai, TenLoai)" +
                           " VALUES(@ma, @ten) ";

            return(DatabaseDAL.executeNonQuery(query, ch.maLoai, ch.tenLoai));
        }
Exemplo n.º 7
0
        public bool KiemTraTonTai(string ma)
        {
            string query = " SELECT * FROM dbo.ChungLoai  WHERE MaLoai = @ma";

            if (DatabaseDAL.readDataToTable(query, ma).Rows.Count == 0)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 8
0
        public bool KtTonTaiHangHoa(string maHang)
        {
            string query = "SELECT * FROM dbo.HangHoa WHERE MaHang=@ma";

            if (DatabaseDAL.readDataToTable(query, maHang).Rows.Count == 0)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 9
0
        public int XoaChungLoai(string ma)
        {
            string query = " DELETE dbo.ChungLoai  WHERE MaLoai = @ma";

            return(DatabaseDAL.executeNonQuery(query, ma));
        }
Exemplo n.º 10
0
        public DataTable LayToanBoChungLoai()
        {
            string query = "SELECT * FROM dbo.ChungLoai";

            return(DatabaseDAL.readDataToTable(query));
        }
Exemplo n.º 11
0
        public bool InsertPhieuXuatHang(PhieuXuatKho phieuXuat)
        {
            int result = DatabaseDAL.ExecuteNonQuery("exec USP_InsertPhieuXuatKho @sochungtu , @makho , @nguoilapphieu , @ngaylapphieu , @nguoinhan ", new object[] { phieuXuat.SoChungTu, phieuXuat.MaKho, phieuXuat.NguoiLapPhieu, phieuXuat.NgayLapPhieu, phieuXuat.NguoiNhanHang });

            return(result > 0);
        }
Exemplo n.º 12
0
        public int suaNhanVien(NhanVien nv)
        {
            string query = "UPDATE dbo.NhanVien SET TenNV=@ten,DiaChi=@dc,SDT=@sdt,NgaySinh=@ns,GT=@gt,ChucVu=@chv,Luongcb=@lucb,PhuCap=@pc,HSLuong=@hsl,Thuong=@thug WHERE MaNV=@manv";

            return(DatabaseDAL.executeNonQuery(query, nv.tenNV, nv.diaChi, nv.sDT, nv.ngaySinh, nv.gT, nv.chucVu, nv.luongCB, nv.phuCap, nv.hSLuong, nv.thuong, nv.maNV));
        }
Exemplo n.º 13
0
        public DataTable GetListPhieuNhap()
        {
            var data = DatabaseDAL.ReadData("Select *from dbo.PhieuNhapKho order by SoChungTu");

            return(data);
        }
Exemplo n.º 14
0
        public DataTable LayToanBoNhaSX()
        {
            string query = "SELECT * FROM dbo.NhaSX";

            return(DatabaseDAL.readDataToTable(query));
        }
Exemplo n.º 15
0
        public DataTable LayToanBoThongTinHH()
        {
            string query = "dbo.LayToanBoThangTinHH";

            return(DatabaseDAL.readDataToTableStoredProcedure(query));
        }
Exemplo n.º 16
0
        public DataTable GetListNSX()
        {
            string query = "SELECT *FROM NhaSX";

            return(DatabaseDAL.ReadData(query));
        }
Exemplo n.º 17
0
        public DataTable timKiemNhanVien(string maNV)
        {
            string query = "SELECT * FROM dbo.NhanVien WHERE MaNV=@manv";

            return(DatabaseDAL.readDataToTable(query, maNV));
        }
Exemplo n.º 18
0
        public int xoaNhanVien(string maNV)
        {
            string query = "UPDATE dbo.HoaDon SET MaNV=NULL WHERE MaNV=@manv        DELETE FROM dbo.NhanVien WHERE MaNV = @manv";

            return(DatabaseDAL.executeNonQuery(query, maNV));
        }
Exemplo n.º 19
0
        public DataTable GetListKho()
        {
            string query = "SELECT *FROM Kho";

            return(DatabaseDAL.ReadData(query));
        }
Exemplo n.º 20
0
        public int XoaHangHoa(string ma)
        {
            string query = "DELETE dbo.HangHoa WHERE MaHang = @ma";

            return(DatabaseDAL.executeNonQuery(query, ma));
        }
Exemplo n.º 21
0
        public bool InsertPhieuNhapHang(PhieuNhapKho phieuNhap)
        {
            int result = DatabaseDAL.ExecuteNonQuery("exec USP_InsertPhieuNhapKho @sochungtu , @makho , @nguoilapphieu , @ngaylapphieu , @nguoigiao , @maNSX", new object[] { phieuNhap.SoChungTu, phieuNhap.MaKho, phieuNhap.NguoiLapPhieu, phieuNhap.NgayLapPhieu, phieuNhap.NguoiGiaoHang, phieuNhap.MaNSX });

            return(result > 0);
        }
Exemplo n.º 22
0
        public DataTable hienThiTatCaNhanVien()
        {
            string query = "SELECT *FROM dbo.NhanVien";

            return(DatabaseDAL.readDataToTable(query));
        }