Exemplo n.º 1
0
        //Delete Staff
        public static bool DeleteStaff(string _MaNV)
        {
            //Check esxit
            if (UntilitiesDataAccess.CheckExist("tbl_HOADON", "NguoiLap_HD", _MaNV))
            {
                return(false);
            }

            if (UntilitiesDataAccess.CheckExist("tbl_LICHSUBANHANG", "NhanVienThucHien_LSBH", _MaNV))
            {
                return(false);
            }

            if (UntilitiesDataAccess.CheckExist("tbl_PHIEUNHAP", "NguoiNhap_PN", _MaNV))
            {
                return(false);
            }

            SqlCommand _cmd = new SqlCommand();

            _cmd.CommandType = CommandType.StoredProcedure;
            _cmd.CommandText = "[Xóa nhân viên]";
            _cmd.Parameters.AddWithValue("@MaNV_NV", _MaNV);

            return(conn.Execute(_cmd));
        }
Exemplo n.º 2
0
        //Xóa nhóm khách hàng
        public static bool XoaNhomKhachHang(string _MaNKH)
        {
            if (UntilitiesDataAccess.CheckExist("tbl_KHACHHANG", "Ma_NHK_KH", _MaNKH))
            {
                return(false);
            }

            SqlCommand _cmd = new SqlCommand();

            _cmd.CommandType = CommandType.StoredProcedure;
            _cmd.CommandText = "[Xóa nhóm khách hàng]";
            _cmd.Parameters.AddWithValue("@MaNKH_NKH", _MaNKH);
            return(conn.Execute(_cmd));
        }
        //XÓA NHÀ CUNG CẤP
        public static bool XoaNhaCungCap(string _MaNCC)
        {
            if (UntilitiesDataAccess.CheckExist("tbl_SANPHAM", "MaNCC_SP", _MaNCC))
            {
                return(false);
            }

            SqlCommand _cmd = new SqlCommand();

            _cmd.CommandType = CommandType.StoredProcedure;
            _cmd.CommandText = "[Xóa nhà cung cấp]";
            _cmd.Parameters.AddWithValue("@MaNCC_NCC", _MaNCC);
            return(conn.Execute(_cmd));
        }
        //XÓA ĐƠN VỊ TÍNH
        public static bool XoaDonViTinh(string _MaDVT)
        {
            if (UntilitiesDataAccess.CheckExist("tbl_SANPHAM", "MaDVT_SP", _MaDVT))
            {
                return(false);
            }

            SqlCommand _cmd = new SqlCommand();

            _cmd.CommandType = CommandType.StoredProcedure;
            _cmd.CommandText = "[Xóa đơn vị tính]";
            _cmd.Parameters.AddWithValue("@MaDVT_DVT", _MaDVT);
            return(conn.Execute(_cmd));
        }
        //Xóa quyền
        public static bool XoaQuyen(string _ID_Q)
        {
            //Check
            if (UntilitiesDataAccess.CheckExist("tbl_NHANVIEN", "ID_Q", _ID_Q))
            {
                return(false);
            }

            //Xóa
            SqlCommand _cmd = new SqlCommand();

            _cmd.CommandType = CommandType.StoredProcedure;
            _cmd.CommandText = "[Xóa quyền]";
            _cmd.Parameters.AddWithValue("@ID_Q", _ID_Q);

            return(conn.Execute(_cmd));
        }
        //THêm mới mã giảm giá
        public static void TaoMaGiamGia(int _chietKhau, DateTime _ngayHetHan, int _soLuong)
        {
            MaGiamGiaPublic _maGiamGia = new MaGiamGiaPublic();

            _maGiamGia.ChietKhau_MGG  = _chietKhau;
            _maGiamGia.NgayHetHan_MGG = _ngayHetHan;
            _maGiamGia.GhiChu_MGG     = "Chưa sử dụng";
            _maGiamGia.TrangThai_MGG  = true;

            for (int i = 0; i < _soLuong; i++)
            {
                bool t = true;
                while (t)
                {
                    _maGiamGia.MaThe_MGG = RandomNumber(100000000, 999999999).ToString();
                    if (!UntilitiesDataAccess.CheckExist("tbl_MAGIAMGIA", "MaGG_MGG", _maGiamGia.MaThe_MGG))
                    {
                        t = false;
                    }
                }
                Them1MaGiamGia(_maGiamGia);
            }
        }