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));
        }
Exemple #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);
        }
        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));
        }
        public int SuaChungLoai(ChungLoai ch)
        {
            string query = " UPDATE dbo.ChungLoai " +
                           " SET TenLoai = @ten " +
                           " WHERE MaLoai = @ma ";

            return(DatabaseDAL.executeNonQuery(query, ch.tenLoai, ch.maLoai));
        }
        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));
        }
        public int ThemChungLoai(ChungLoai ch)
        {
            string query = "INSERT INTO dbo.ChungLoai" +
                           "(MaLoai, TenLoai)" +
                           " VALUES(@ma, @ten) ";

            return(DatabaseDAL.executeNonQuery(query, ch.maLoai, ch.tenLoai));
        }
        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);
        }
        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);
        }
        public int XoaChungLoai(string ma)
        {
            string query = " DELETE dbo.ChungLoai  WHERE MaLoai = @ma";

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

            return(DatabaseDAL.readDataToTable(query));
        }
        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);
        }
        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));
        }
        public DataTable GetListPhieuNhap()
        {
            var data = DatabaseDAL.ReadData("Select *from dbo.PhieuNhapKho order by SoChungTu");

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

            return(DatabaseDAL.readDataToTable(query));
        }
        public DataTable LayToanBoThongTinHH()
        {
            string query = "dbo.LayToanBoThangTinHH";

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

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

            return(DatabaseDAL.readDataToTable(query, maNV));
        }
        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));
        }
        public DataTable GetListKho()
        {
            string query = "SELECT *FROM Kho";

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

            return(DatabaseDAL.executeNonQuery(query, ma));
        }
        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);
        }
        public DataTable hienThiTatCaNhanVien()
        {
            string query = "SELECT *FROM dbo.NhanVien";

            return(DatabaseDAL.readDataToTable(query));
        }