Ejemplo n.º 1
0
        public bool UpdateData(DTO.CTHDDTO chiTietHoaDon)
        {
            string query  = string.Format("EXEC UPDATE_SOLUONG_MASP_MAHD @MAHD = '{0}',@MASP ='{1}',@SOLUONG = {2}", chiTietHoaDon.MaHD, chiTietHoaDon.MaSP, chiTietHoaDon.SoLuong);
            int    result = DataProvider.Instance.ExecuteNonQuery(query);

            return(result > 0);
        }
Ejemplo n.º 2
0
        public bool InsertData(DTO.CTHDDTO chiTietHoaDon)
        {
            //string query = string.Format("INSERT INTO dbo.CTHD( MAHD, MASP, SOLUONG )VALUES  ( '{0}','{1}',{2})",chiTietHoaDon.MaHD,chiTietHoaDon.MaSP,chiTietHoaDon.SoLuong);
            string query  = string.Format("EXEC dbo.INSERT_CTHD @MAHD = '{0}',@MASP = '{1}',@SOLUONG = {2}", chiTietHoaDon.MaHD, chiTietHoaDon.MaSP, chiTietHoaDon.SoLuong);
            int    result = DataProvider.Instance.ExecuteNonQuery(query);

            return(result > 0);
        }
Ejemplo n.º 3
0
        public int GetSoLuongByMaSPAndMaHD(string maSP, string maHD)
        {
            //string query = string.Format("SELECT * FROM CTHD WHERE MASP = '{0}' AND MAHD='{1}'", maSP,maHD);
            string    query = string.Format("EXEC LOAD_CTHD_BYMASP_MAHD @MASP = '{0}', @MAHD ='{1}'", maSP, maHD);
            DataTable data  = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                DTO.CTHDDTO cthd = new DTO.CTHDDTO(item);
                return(cthd.SoLuong);
            }
            return(0);
        }
Ejemplo n.º 4
0
        public List <DTO.CTHDDTO> LoadChiTietHoaDonByMaHD(string maHD)
        {
            List <DTO.CTHDDTO> cthdList = new List <DTO.CTHDDTO>();
            //string query = string.Format("SELECT * FROM dbo.CTHD WHERE MAHD = '{0}'",maHD);
            string    query = string.Format("EXEC dbo.LOAD_CTHD_MAHD @MAHD = '{0}'", maHD);
            DataTable data  = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                DTO.CTHDDTO cthd = new DTO.CTHDDTO(item);
                cthdList.Add(cthd);
            }
            return(cthdList);
        }
 public bool InsertCTHD(string maHD, string maSP, int soLuong)
 {
     DTO.CTHDDTO cthd = new DTO.CTHDDTO(maHD, maSP, soLuong);
     return(DAL.CTHDDAL.Instance.InsertData(cthd));
 }