예제 #1
0
        public void XoaNhanVien(SanPhamEntity nv)
        {
            KetNoiCSDL.MoKetNoi();
            string     sql = @"DELETE SANPHAM WHERE MaSP=@MaSP";
            SqlCommand cmd = new SqlCommand(sql, KetNoiCSDL.connect);

            cmd.Parameters.AddWithValue("@MaSP", nv.MaSP);
            cmd.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }
예제 #2
0
        public void XoaNhanVien(NhanVienEntity nv)
        {
            KetNoiCSDL.MoKetNoi();
            string     sql = @"DELETE NHANVIEN WHERE MaNV=@MaNV";
            SqlCommand cmd = new SqlCommand(sql, KetNoiCSDL.connect);

            cmd.Parameters.AddWithValue("@MaNV", nv.MaNV);
            cmd.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }
예제 #3
0
        public void XoaKhachHang(KhachHangEntity Kh)
        {
            KetNoiCSDL.MoKetNoi();
            string     sql = @"DELETE KHACHHANG WHERE Makh=@MaKH";
            SqlCommand cmd = new SqlCommand(sql, KetNoiCSDL.connect);

            cmd.Parameters.AddWithValue("@MaKH", Kh.MaKH);
            cmd.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }
예제 #4
0
        public void Sua(NhanVienEntity nv)
        {
            KetNoiCSDL.MoKetNoi();
            string sql = "UPDATE NHANVIEN SET MatKhau =@MatKhau,TenDangNhap =@TenDn Where MaNV=@MaNV";

            SqlCommand cmd = new SqlCommand(sql, KetNoiCSDL.connect);

            cmd.Parameters.AddWithValue("@MatKhau", nv.MatKhau);
            cmd.Parameters.AddWithValue("@TenDn", nv.TenDangNhap);
            cmd.Parameters.AddWithValue("@MaNV", nv.MaNV);
            cmd.ExecuteNonQuery();

            KetNoiCSDL.DongKetNoi();
        }
        public void ThemChiTietHonDon(ChiTietHonDonEntity hd)
        {
            KetNoiCSDL.MoKetNoi();
            string     cthd = @"INSERT INTO CHITIETHOADONBAN(MaHD, MaSP, SoLuong, DonGia, ThanhTien) VALUES(@MaHD,@MaSP,@SoLuong,@DonGia,@ThanhTien)";
            SqlCommand cdm  = new SqlCommand(cthd, KetNoiCSDL.connect);

            //cdm.CommandType = CommandType.StoredProcedure;
            cdm.Parameters.AddWithValue("@MaHD", hd.MaHD);
            cdm.Parameters.AddWithValue("@MaSP", hd.MaSP);
            cdm.Parameters.AddWithValue("@SoLuong", hd.SoLuong);
            cdm.Parameters.AddWithValue("@DonGia", hd.DonGia);
            cdm.Parameters.AddWithValue("@ThanhTien", hd.ThanhTien);
            cdm.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }
예제 #6
0
        public void ThemHoaDon(HoaDonBanEntity hd)
        {
            KetNoiCSDL.MoKetNoi();
            string     themhd = @"INSERT INTO HOADONBAN(MaHDB, MaKH, MaNV, NgayBan, TongTien) VALUES(@MaHD,@MaKH,@MaNV,@NgayBan,@TongTien)";
            SqlCommand cdm    = new SqlCommand(themhd, KetNoiCSDL.connect);

            // cdm.CommandType = CommandType.StoredProcedure;
            cdm.Parameters.AddWithValue("@MaHD", hd.MaHDB);
            cdm.Parameters.AddWithValue("@MaKH", hd.MaKH);
            cdm.Parameters.AddWithValue("@MaNV", hd.MaNV);
            cdm.Parameters.AddWithValue("@NgayBan", hd.NgayBan);
            cdm.Parameters.AddWithValue("@TongTien", hd.TongTien);

            cdm.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }
예제 #7
0
        public void ThemNhanVien(NhanVienEntity nv)
        {
            KetNoiCSDL.MoKetNoi();
            string     sql = "INSERT INTO NHANVIEN(MaNV, MatKhau, TenNV, GT, DiaChi, SDT, TenDangNhap) VALUES(@MaNV,@MatKhau,@TenNV,@GT,@DiaChi,@SDT,@SDT,@TenDn)";
            SqlCommand cmd = new SqlCommand(sql, KetNoiCSDL.connect);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@MaNV", nv.MaNV);
            cmd.Parameters.AddWithValue("@MatKhau", nv.MatKhau);
            cmd.Parameters.AddWithValue("@TenNV", nv.TenNV);
            cmd.Parameters.AddWithValue("@GT", nv.GT);
            cmd.Parameters.AddWithValue("@DiaChi", nv.DiaChi);
            cmd.Parameters.AddWithValue("@SDT", nv.SDT);
            cmd.Parameters.AddWithValue("@TenDn", nv.TenDangNhap);

            cmd.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }
예제 #8
0
        public void ThemKhachHang(KhachHangEntity kh)
        {
            KetNoiCSDL.MoKetNoi();
            string     sql = @"INSERT INTO KHACHHANG(MaKH, GT, TenKH, DiaChi, SDT, LoaiKH, GhiChu) VALUES(@MaKH,@GT,@TenKH,@DiaChi,@SDT,@LoaiKH,@GhiChu)";
            SqlCommand cmd = new SqlCommand(sql, KetNoiCSDL.connect);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@MaKH", kh.MaKH);
            cmd.Parameters.AddWithValue("@GT", kh.GT);
            cmd.Parameters.AddWithValue("@TenKH", kh.TenKH);
            cmd.Parameters.AddWithValue("@DiaChi", kh.DiaChi);
            cmd.Parameters.AddWithValue("@SDT", kh.SDT);
            cmd.Parameters.AddWithValue("@LoaiKH", kh.LoaiKH);
            cmd.Parameters.AddWithValue("@GhiChu", kh.GhiChu);

            cmd.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }
        public void SuaNhanVien(NhanVienEntity nv)
        {
            KetNoiCSDL.MoKetNoi();
            string sql = "UPDATE NHANVIEN SET MatKhau =@MatKhau, TenNV =@TenNV, DiaChi =@DiaChi, GT =@GT, SDT =@SDT, TenDangNhap =@TenDn Where MaNV=@MaNV";

            SqlCommand cmd = new SqlCommand(sql, KetNoiCSDL.connect);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@MatKhau", nv.MK);
            cmd.Parameters.AddWithValue("@TenNV", nv.TenNV);
            cmd.Parameters.AddWithValue("@GT", nv.GT);
            cmd.Parameters.AddWithValue("@DiaChi", nv.DiaChi);
            cmd.Parameters.AddWithValue("@SDT", nv.SDT);
            cmd.Parameters.AddWithValue("@TenDn", nv.TenDangNhap);
            cmd.ExecuteNonQuery();

            KetNoiCSDL.DongKetNoi();
        }
예제 #10
0
        public void SuaKhachHang(KhachHangEntity kh)
        {
            KetNoiCSDL.MoKetNoi();
            string sql = "UPDATE  KHACHHANG SET  TenKH =@TenKH, GT =@GT, DiaChi =@DiaChi, SDT =@SDT, LoaiKH =@LoaiKH, GhiChu =@GhiChu";

            SqlCommand cmd = new SqlCommand(sql, KetNoiCSDL.connect);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@MaKH", kh.MaKH);
            cmd.Parameters.AddWithValue("@GT", kh.GT);
            cmd.Parameters.AddWithValue("@TenKH", kh.TenKH);
            cmd.Parameters.AddWithValue("@DiaChi", kh.DiaChi);
            cmd.Parameters.AddWithValue("@SDT", kh.SDT);
            cmd.Parameters.AddWithValue("@LoaiKH", kh.LoaiKH);
            cmd.Parameters.AddWithValue("@GhiChu", kh.GhiChu);
            cmd.ExecuteNonQuery();

            KetNoiCSDL.DongKetNoi();
        }
예제 #11
0
        public void ThemSanPham(SanPhamEntity nv)
        {
            KetNoiCSDL.MoKetNoi();
            string     sql = "INSERT INTO SANPHAM(MaSP, TenSP,MaLH,SoLuong,GiaNhap,GiaBan,MoTa,NSX,NhaCC) VALUES(@MaSP,@TenSP,@MaLH,@SoLuong,@GiaNhap,@GiaBan,@MoTa,@NSX,@NhaCC)";
            SqlCommand cmd = new SqlCommand(sql, KetNoiCSDL.connect);

            // cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@MaSP", nv.MaSP);
            cmd.Parameters.AddWithValue("@TenSP", nv.TenSP);
            cmd.Parameters.AddWithValue("@MaLH", nv.MaLH);
            cmd.Parameters.AddWithValue("@SoLuong", nv.SoLuong);
            cmd.Parameters.AddWithValue("@GiaNhap", nv.GiaNhap);
            cmd.Parameters.AddWithValue("@GiaBan", nv.GiaBan);
            cmd.Parameters.AddWithValue("@MoTa", nv.MoTa);
            cmd.Parameters.AddWithValue("@NSX", nv.NSX);

            cmd.Parameters.AddWithValue("@NhaCC", nv.NhaCC);
            cmd.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }
예제 #12
0
        public void SuaSanPham(SanPhamEntity nv)
        {
            KetNoiCSDL.MoKetNoi();
            string sql = "UPDATE SANPHAM SET  TenSP=@TenSP, MaLH =@MaLH, SoLuong =@SoLuong, GiaNhap =@GiaNhap, GiaBan =@GiaBan, MoTa =@MoTa,NSX=@NSX,NhaCC=@NhaCC Where MaSP=@MaSP";

            SqlCommand cmd = new SqlCommand(sql, KetNoiCSDL.connect);

            //cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@TenSP", nv.TenSP);
            cmd.Parameters.AddWithValue("@MaLH", nv.MaLH);
            cmd.Parameters.AddWithValue("@SoLuong", nv.SoLuong);
            cmd.Parameters.AddWithValue("@GiaNHap", nv.GiaNhap);
            cmd.Parameters.AddWithValue("@GiaBan", nv.GiaBan);
            cmd.Parameters.AddWithValue("@MoTa", nv.MoTa);
            cmd.Parameters.AddWithValue("@NSX", nv.NSX);

            cmd.Parameters.AddWithValue("@NhaCC", nv.NhaCC);
            cmd.ExecuteNonQuery();

            KetNoiCSDL.DongKetNoi();
        }