Example #1
0
        public static DataTable LayDSPhieuNhap()
        {
            string q = "select maphieunhap,ngaynhap,NHANVIEN.tennv,thanhtien, NHACUNGCAP.ten as nhacungcap " +
                       " from PHIEUNHAPKHO left join NHANVIEN on NHANVIEN.manv = PHIEUNHAPKHO.manv left join NHACUNGCAP on NHACUNGCAP.manhacungcap = PHIEUNHAPKHO.manhacungcap ;";

            return(DataProvider.query(q));
        }
Example #2
0
        public static void XoaKho(int makho)
        {
            string q = "Delete from KHO where makho = '@MAKHO' ";

            q = q.Replace("@MAKHO", makho.ToString());

            DataProvider.query(q);
        }
Example #3
0
        public static DataTable LayThongTinPhieuNhap(string maphieunhap)
        {
            string q = "select maphieunhap,ngaynhap,NHANVIEN.tennv,thanhtien, NHACUNGCAP.ten as nhacungcap " +
                       " from PHIEUNHAPKHO left join NHANVIEN on NHANVIEN.manv = PHIEUNHAPKHO.manv left join NHACUNGCAP on NHACUNGCAP.manhacungcap = PHIEUNHAPKHO.manhacungcap where maphieunhap = '@MAPHIEUNHAP';";

            q = q.Replace("@MAPHIEUNHAP", maphieunhap);
            return(DataProvider.query(q));
        }
Example #4
0
        public static string Laydonvi(string manguyenlieu)
        {
            string q = "SELECT DONVI.tendonvi, NGUYENLIEU.manguyenlieu FROM NGUYENLIEU left join DONVI on NGUYENLIEU.madonvi = DONVI.madonvi WHERE manguyenlieu = '@MANGUYENLIEU' ";

            q = q.Replace("@MANGUYENLIEU", manguyenlieu);

            return((string)DataProvider.query(q).Rows[0][0]);
        }
Example #5
0
        public static DataTable LayDSNguyenLieuTheoNCC(string manhacungcap)
        {
            string q = "SELECT * FROM NGUYENLIEU WHERE manhacungcap = @MANHACUNGCAP ";

            q = q.Replace("@MANHACUNGCAP", manhacungcap);

            return(DataProvider.query(q));
        }
Example #6
0
        public static void ThemKho(nhakho kho)
        {
            string q = "insert into KHO(tenkho,mota) values(N'@TENKHO',N'@MOTA')";

            q = q.Replace("@TENKHO", kho.tenkho);
            q = q.Replace("@MOTA", kho.mota);

            DataProvider.query(q);
        }
Example #7
0
        public static void ChinhSuaKho(nhakho kho)
        {
            string q = "update KHO set tenkho = N'@TENKHO', mota = N'@MOTA' where makho = @MAKHO ";

            q = q.Replace("@TENKHO", kho.tenkho);
            q = q.Replace("@MOTA", kho.mota);
            q = q.Replace("@MAKHO", kho.makho.ToString());

            DataProvider.query(q);
        }
Example #8
0
        public static int KiemtraTontai(string tenkho)
        {
            int    result = 0;
            string q      = "select count(*) from KHO where tenkho = N'@TENKHO' ";

            q = q.Replace("@TENKHO", tenkho);

            result = int.Parse(DataProvider.query(q).Rows[0][0].ToString());

            return(result);
        }
Example #9
0
        public static void ThemPhieuNhap(phieunhap info)
        {
            string q = "insert into PHIEUNHAPKHO(maphieunhap,ngaynhap,manv,thanhtien,manhacungcap) VALUES" +
                       " ('@MAPHIEUNHAP','@NGAYNHAP','@MANV','@THANHTIEN','@MANHACUNGCAP');";

            q = q.Replace("@MAPHIEUNHAP", info.maphieunhap);
            q = q.Replace("@NGAYNHAP", info.ngaynhap.ToString());
            q = q.Replace("@MANV", info.manv.ToString());
            q = q.Replace("@THANHTIEN", info.thanhtien.ToString());
            q = q.Replace("@MANHACUNGCAP", info.manhacungcap.ToString());

            DataProvider.query(q);
        }
Example #10
0
        public static void ThemCTPhieuNhap(List <ctphieunhap> ct)
        {
            for (int i = 0; i < ct.Count; i++)
            {
                string q = "insert into CTPHIEUNHAPKHO(maphieunhap,manguyenlieu,soluong,thanhtien)" +
                           " values('@MAPHIEUNHAP','@MANGUYENLIEU',@SOLUONG,@THANHTIEN)";
                q = q.Replace("@MAPHIEUNHAP", ct[i].maphienhap);
                q = q.Replace("@MANGUYENLIEU", ct[i].manguyenlieu.ToString());
                q = q.Replace("@SOLUONG", ct[i].soluong.ToString());
                q = q.Replace("@THANHTIEN", ct[i].thanhtien.ToString());

                DataProvider.query(q);
            }
        }
Example #11
0
        public static DataTable LayDSNhanVien()
        {
            string q = "select manv, LOAINV.tenloai , tennv, sdt, cmnd from NHANVIEN left join LOAINV on NHANVIEN.maloainv = LOAINV.maloai;";

            return(DataProvider.query(q));
        }
Example #12
0
        public static DataTable LayDSNhacungcap()
        {
            string q = "select * from NHACUNGCAP;";

            return(DataProvider.query(q));
        }
Example #13
0
        public static DataTable LayThongTinKho()
        {
            string q = "select makho,tenkho,mota from KHO";

            return(DataProvider.query(q));
        }