public static bool ThemLoaiSp(LoaiSanPhamDTO lsp) { string query = "INSERT INTO dbo.LoaiSanPham (TenLoaiSP) VALUES (@TenLoaiSP)"; SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@TenLoaiSP", lsp.TenLoaiSP); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public static int ThemTK(string TENTK, string MK) { string query = "INSERT INTO TAIKHOAN (TENTK, MK) VALUES (@TENTK, @MK)"; SqlParameter[] parameter = new SqlParameter[2]; parameter[0] = new SqlParameter("@TENTK", TENTK); parameter[1] = new SqlParameter("@MK", MK); return(DataProvider.ExecuteInsertQuery(query, parameter)); }
public static bool ThemLoaiSP(LoaiSanPhamDTO loaisp) { string query = "insert into LoaiSanPham (MaLoaiSP,TenLoaiSP,TrangThai) values (@MaLoaiSP,@TenLoaiSP,@TrangThai)"; SqlParameter[] param = new SqlParameter[3]; param[0] = new SqlParameter("@MaLoaiSP", loaisp.MaLoaiSP); param[1] = new SqlParameter("@TenLoaiSP", loaisp.TenLoaiSP); param[2] = new SqlParameter("@TrangThai", loaisp.TrangThai); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public static Boolean Insert(GioHangDTO gioHangDTO) { String query = "INSERT INTO GioHang (TenTaiKhoan, MaSP, SoLuong) VALUES (@TenTaiKhoan, @MaSP, @SoLuong)"; SqlParameter[] param = new SqlParameter[3]; param[0] = new SqlParameter("@TenTaiKhoan", gioHangDTO.TenTaiKhoan); param[1] = new SqlParameter("@MaSP", gioHangDTO.MaSP); param[2] = new SqlParameter("@SoLuong", gioHangDTO.SoLuong); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public static bool ThemGH(DTO_GioHang gioHang) { string query = "INSERT INTO GioHang (TenTaiKhoan, MaSP, SoLuong) VALUES (@TenTaiKhoan, @MaSP, @SoLuong)"; SqlParameter[] param = new SqlParameter[3]; param[0] = new SqlParameter("@TenTaiKhoan", gioHang.TenTaiKhoan); param[1] = new SqlParameter("@MaSP", gioHang.MaSP); param[2] = new SqlParameter("@SoLuong", gioHang.SoLuong); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public static Boolean Insert(LoaiSanPhamDTO loaiSanPhamDTO) { String query = "INSERT INTO LoaiSanPham (MaLoaiSP, TenLoaiSP, TrangThai) VALUES (@MaLoaiSP, @TenLoaiSP, @TrangThai)"; SqlParameter[] param = new SqlParameter[3]; param[0] = new SqlParameter("@MaLoaiSP", loaiSanPhamDTO.MaLoaiSP); param[1] = new SqlParameter("@TenLoaiSP", loaiSanPhamDTO.TenLoaiSP); param[2] = new SqlParameter("@TrangThai", loaiSanPhamDTO.TrangThai); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public static bool ThemLoaiVideo(LoaiVideoDTO lvd) { string query = "INSERT INTO LoaiVideo (MaLoaiVideo, TenLoaiVideo, TrangThai) VALUES (@MaLoaiVideo, @TenLoaiVideo, @TrangThai)"; SqlParameter[] param = new SqlParameter[3]; param[0] = new SqlParameter("@MaLoaiVideo", lvd.MaLoaiVideo); param[1] = new SqlParameter("@TenLoaiVideo", lvd.TenLoaiVideo); param[2] = new SqlParameter("@TrangThai", lvd.TrangThai); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public static bool ThemLoaiNguyenLieu(LoaiNguyenLieuDTO loaiNL) { string query = "INSERT INTO [tblLoaiNguyenLieu]([MaLoaiNL],[TenLoaiNL],[TrangThai]) VALUES(@MaLoaiNL,@TenLoaiNL,@TrangThai)"; SqlParameter[] pars = new SqlParameter[3]; pars[0] = new SqlParameter("@MaLoaiNL", loaiNL.MaLoaiNL); pars[1] = new SqlParameter("@TenLoaiNL", loaiNL.TenLoaiNL); pars[2] = new SqlParameter("@TrangThai", true); return(DataProvider.ExecuteInsertQuery(query, pars) == 1); }
public static bool ThemCTSP(SanPhamDTO sp) { string query = "INSERT INTO dbo.SizeGiay (Masp_id,SoLuongTonKho,Sizenumber) VALUES (@Masp_id,@SoLuongTonKho,@Sizenumber)"; SqlParameter[] param = new SqlParameter[3]; param[0] = new SqlParameter("@SoLuongTonKho", sp.SoLuongTonKho); param[1] = new SqlParameter("@Sizenumber", sp.Sizenumber); param[2] = new SqlParameter("@Masp_id", sp.Masp_id); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public static bool ThemSPVaoGH(clsGioHangDTO gioHangDTO) { string query = "INSERT INTO tblGioHang (TenTaiKhoan, MaSP, SoLuong) VALUES (@TenTaiKhoan, @MaSP, @SoLuong)"; SqlParameter[] parameter = new SqlParameter[3]; parameter[0] = new SqlParameter("@TenTaiKhoan", gioHangDTO.TenTaiKhoan); parameter[1] = new SqlParameter("@MaSP", gioHangDTO.MaSP); parameter[2] = new SqlParameter("@SoLuong", gioHangDTO.SoLuong); return(DataProvider.ExecuteInsertQuery(query, parameter) == 1); }
public static bool ThemLopHoc(LopHocDTO lh) { string query = "INSERT INTO LopHoc (Ma_Lop,SoSinhVien,TrangThai) VALUES (@Ma_Lop,@SoSinhVien,@TrangThai)"; SqlParameter[] param = new SqlParameter[3]; param[0] = new SqlParameter("@Ma_Lop", lh.Ma_Lop); param[1] = new SqlParameter("@SoSinhVien", lh.SoSinhVien); param[2] = new SqlParameter("@TrangThai", lh.TrangThai); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public static bool ThemCTHD(CTHoaDonDTO cthd) { string query = "INSERT INTO CTHoaDon(MaHD, MaHoa, SoLuong, DonGia) VALUES(@MaHD, @MaHoa, @SoLuong, @DonGia)"; SqlParameter[] param = new SqlParameter[4]; param[0] = new SqlParameter("@MaHD", cthd.MaHD); param[1] = new SqlParameter("@MaHoa", cthd.MaHoa); param[2] = new SqlParameter("@SoLuong", cthd.SoLuong); param[3] = new SqlParameter("@DonGia", cthd.DonGia); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public static bool ThemCTHDHDNhap(CTHDNhapDTO cthd) { string query = "INSERT INTO tblCTHDNhap(MaHDNhap,MaNL,DonGia,SoLuong) VALUES(@MaHDNhap,@MaNL,@DonGia,@SoLuong)"; SqlParameter[] pars = new SqlParameter[4]; pars[0] = new SqlParameter("@MaHDNhap", cthd.MaHDNhap); pars[1] = new SqlParameter("@MaNL", cthd.MaNL); pars[2] = new SqlParameter("@DonGia", cthd.DonGia); pars[3] = new SqlParameter("@SoLuong", cthd.SoLuong); return(DataProvider.ExecuteInsertQuery(query, pars) == 1); }
public static bool ThemCTHoaDon(clsCTHoaDonDTO ctHoaDonDTO) { string query = "INSERT INTO tblCTHoaDon (MaHD, MaSP, SoLuong, DonGia) VALUES (@MaHD, @MaSP, @SoLuong, @DonGia)"; SqlParameter[] parameter = new SqlParameter[4]; parameter[0] = new SqlParameter("@MaHD", ctHoaDonDTO.MaHD); parameter[1] = new SqlParameter("@MaSP", ctHoaDonDTO.MaSP); parameter[2] = new SqlParameter("@SoLuong", ctHoaDonDTO.SoLuong); parameter[3] = new SqlParameter("@DonGia", ctHoaDonDTO.DonGia); return(DataProvider.ExecuteInsertQuery(query, parameter) == 1); }
public int Dangki_TTTK(string Username, string Password, int LoaiTK) { string sql = "Insert into Taikhoan values(@Username , @Password , 0 , @LoaiTK ,0)"; SqlParameter[] par = new SqlParameter[3]; par[0] = new SqlParameter("@Username", Username); par[1] = new SqlParameter("@Password", Password); par[2] = new SqlParameter("@LoaiTK", LoaiTK); return(DataProvider.ExecuteInsertQuery(sql, par)); }
public static bool ThemGH(GioHangDTO gh) { string query = "INSERT INTO GioHang (TenTaiKhoan, MaSP, SoLuong,sizenumber) VALUES (@TenTaiKhoan, @MaSP, @SoLuong,@SizeGiay)"; SqlParameter[] param = new SqlParameter[4]; param[0] = new SqlParameter("@TenTaiKhoan", gh.TenTaiKhoan); param[1] = new SqlParameter("@MaSP", gh.MaSP); param[2] = new SqlParameter("@SoLuong", gh.SoLuong); param[3] = new SqlParameter("@SizeGiay", gh.SizeGiay); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public static Boolean Insert(CTHoaDonDTO ctHoaDonDTO) { String query = "INSERT INTO CTHoaDon (MaHD, MaSP, SoLuong, DonGia) VALUES (@MaHD, @MaSP, @SoLuong, @DonGia)"; SqlParameter[] param = new SqlParameter[4]; param[0] = new SqlParameter("@MaHD", ctHoaDonDTO.MaHD); param[1] = new SqlParameter("@MaSP", ctHoaDonDTO.MaSP); param[2] = new SqlParameter("@SoLuong", ctHoaDonDTO.SoLuong); param[3] = new SqlParameter("@DonGia", ctHoaDonDTO.DonGia); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public void insert_img(string idsp, List <string> Path) { string Sql = "insert into HinhAnh values(@ID , @Path , 0)"; for (int i = 0; i < Path.Count; i++) { SqlParameter[] par = new SqlParameter[2]; par[0] = new SqlParameter("@ID", idsp); par[1] = new SqlParameter("@Path", Path[i]); DataProvider.ExecuteInsertQuery(Sql, par); } }
//Thêm món ăn vào CTHDBanHang public static bool ThemMonAnVaoCTHD(CTHDBanHangDTO cthd) { string query = "INSERT INTO tblCTHDBanHang(MaHD, MaMon, DonGia, SoLuong, GhiChu) VALUES(@MaHD, @MaMon, @DonGia, @SoLuong, @GhiChu)"; SqlParameter[] pars = new SqlParameter[5]; pars[0] = new SqlParameter("@MaHD", cthd.MaHD); pars[1] = new SqlParameter("@MaMon", cthd.MaMon); pars[2] = new SqlParameter("@DonGia", cthd.DonGia); pars[3] = new SqlParameter("@SoLuong", cthd.SoLuong); pars[4] = new SqlParameter("@GhiChu", cthd.GhiChu); return(DataProvider.ExecuteInsertQuery(query, pars) == 1); }
public static bool themctHD(DTO_cthoadon cthoadon) { string query = "insert into CTHoaDon(MaHD, MaSP, SoLuong, DonGia) values (@mahd, @masp, @soluong, @dongia)"; SqlParameter[] param = new SqlParameter[4]; param[0] = new SqlParameter("@mahd", cthoadon.Mahd); param[1] = new SqlParameter("@masp", cthoadon.Masp); param[2] = new SqlParameter("@soluong", cthoadon.Soluong); param[3] = new SqlParameter("@dongia", cthoadon.Dongia); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public static int ThemLoaiSP(LoaiSanPhamDTO dto) { string query = "INSERT INTO LoaiSanPham VALUES(@malsp,@tenlsp,@trangthai)"; List <SqlParameter> param = new List <SqlParameter>() { new SqlParameter("malsp", dto.MaLoaiSP), new SqlParameter("tenlsp", dto.TenLoaiSP), new SqlParameter("trangthai", dto.TrangThai) }; return(DataProvider.ExecuteInsertQuery(query, param.ToArray())); }
//Thêm nhà cung cấp mới public static bool ThemNhaCungCap(NhaCungCapDTO nccDTO) { string query = "INSERT INTO tblNhaCungCap(MaNCC, TenNhaCC, DiaChiNCC, SDTNCC, EmailNCC, TrangThai) VALUES(@MaNCC, @TenNhaCC, @DiaChiNCC, @SDTNCC, @EmailNCC, @TrangThai)"; SqlParameter[] pars = new SqlParameter[6]; pars[0] = new SqlParameter("@MaNCC", nccDTO.MaNCC); pars[1] = new SqlParameter("@TenNhaCC", nccDTO.TenNhaCC); pars[2] = new SqlParameter("@DiaChiNCC", nccDTO.DiaChiNCC); pars[3] = new SqlParameter("@SDTNCC", nccDTO.SDTNCC); pars[4] = new SqlParameter("@EmailNCC", nccDTO.EmailNCC); pars[5] = new SqlParameter("@TrangThai", nccDTO.TrangThai); return(Convert.ToInt32(DataProvider.ExecuteInsertQuery(query, pars)) > 0); }
public static bool ThemSV(SinhVienDTO sv) { string query = "INSERT INTO ThongTinSV (Ma_SV, Ten_SV,MaLop,SoNgayHoc,SoNgayVang,TrangThai) VALUES (@Ma_SV, @Ten_SV,@MaLop,@SoNgayHoc,@SoNgayVang,@TrangThai)"; SqlParameter[] param = new SqlParameter[6]; param[0] = new SqlParameter("@Ma_SV", sv.Ma_SV); param[1] = new SqlParameter("@Ten_SV", sv.Ten_SV); param[2] = new SqlParameter("@MaLop", sv.Ma_Lop); param[3] = new SqlParameter("@SoNgayHoc", sv.SoNgayHoc); param[4] = new SqlParameter("@SoNgayVang", sv.SoNgayVang); param[5] = new SqlParameter("@TrangThai", sv.TrangThai); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public int TTKH(string Makh, string Name, string Mail, string Address, int phone) { string sql = "Insert into Khachhang values(@Makh , null , @Name, @Address ,@Phone , @Mail , 0)"; SqlParameter[] par = new SqlParameter[5]; par[0] = new SqlParameter("@Makh", Makh); par[1] = new SqlParameter("@Name", Name); par[2] = new SqlParameter("@Address", Address); par[3] = new SqlParameter("@Phone", phone); par[4] = new SqlParameter("@Mail", Mail); return(DataProvider.ExecuteInsertQuery(sql, par)); }
public static bool ThemHDXuat(HDXuatDTO hd) { string query = "INSERT INTO [tblHDXuat]([MaHDXuat],[TenTaiKhoan],[NgayXuat],[TongTien],[TrangThai],[TonTai]) VALUES(@MaHDXuat,@TenTaiKhoan,@NgayXuat,@TongTien,@TrangThai,@TonTai)"; SqlParameter[] pars = new SqlParameter[6]; pars[0] = new SqlParameter("@MaHDXuat", hd.MaHDXuat); pars[1] = new SqlParameter("@TenTaiKhoan", hd.TenTaiKhoan); pars[2] = new SqlParameter("@NgayXuat", hd.NgayXuat); pars[3] = new SqlParameter("@TongTien", hd.TongTien); pars[4] = new SqlParameter("@TrangThai", hd.TrangThai); pars[5] = new SqlParameter("@TonTai", hd.TonTai); return(DataProvider.ExecuteInsertQuery(query, pars) == 1); }
public void ThemCT_HDNCC(string MaHD, List <CartDTO> carts) { for (int i = 0; i < carts.Count; i++) { string sql = "insert into ChiTietHoaDon values (@Mahd ,@Masp ,@Dongia ,@Soluong ,@Thanhtien ,0 )"; SqlParameter[] par = new SqlParameter[5]; par[0] = new SqlParameter("@Mahd", MaHD); par[1] = new SqlParameter("@Masp", carts[i].Masp); par[2] = new SqlParameter("@Dongia", carts[i].Price); par[3] = new SqlParameter("@Soluong", carts[i].Soluong); par[4] = new SqlParameter("@Thanhtien", carts[i].Thanhtien); DataProvider.ExecuteInsertQuery(sql, par); } }
public static bool Themsp(DTO_Sanpham sp) { string query = "INSERT INTO SanPham (MaSP, TenSP, GiaTien, ThongTin, SoLuongTonKho, MaLoaiSP, AnhMinhHoa, TrangThai) VALUES (@masp, @tensp, @giatien,@thongtin,@soluongton,@maloaisp,0,1)"; SqlParameter[] param = new SqlParameter[6]; param[0] = new SqlParameter("@masp", sp.Masp); param[1] = new SqlParameter("@tensp", sp.Tensp); param[2] = new SqlParameter("@giatien", sp.Giatien); param[3] = new SqlParameter("@thongtin", sp.Thongtin); param[4] = new SqlParameter("@soluongton", sp.Soluongtonkho); param[5] = new SqlParameter("@maloaisp", sp.Maloaisp); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
//Tạo HD bán hàng public static bool TaoHDBanHang(HDBanHangDTO hdBH) { string query = "INSERT INTO tblHDBanHang(MaHD, TenTaiKhoan, NgayLapHD, TongTien, GhiChu, TrangThai, TonTai) VALUES (@MaHD, @TenTaiKhoan, @NgayLapHD, @TongTien, @GhiChu, @TrangThai, @TonTai)"; SqlParameter[] pars = new SqlParameter[7]; pars[0] = new SqlParameter("@MaHD", hdBH.MaHD); pars[1] = new SqlParameter("@TenTaiKhoan", hdBH.TenTaiKhoan); pars[2] = new SqlParameter("@NgayLapHD", hdBH.NgayLapHD); pars[3] = new SqlParameter("@TongTien", hdBH.TongTien); pars[4] = new SqlParameter("@GhiChu", hdBH.GhiChu); pars[5] = new SqlParameter("@TrangThai", hdBH.TrangThai); pars[6] = new SqlParameter("@TonTai", hdBH.TonTai); return(DataProvider.ExecuteInsertQuery(query, pars) == 1); }
public static Boolean Insert(HoaDonDTO hoaDonDTO) { String query = "INSERT INTO HoaDon (MaHD, TenTaiKhoan, NgayMua, DiaChiGiaoHang, SDTGiaoHang, TongTien, TrangThai) VALUES (@MaHD, @TenTaiKhoan, @NgayMua, @DiaChiGiaoHang, @SDTGiaoHang, @TongTien, @TrangThai)"; SqlParameter[] param = new SqlParameter[7]; param[0] = new SqlParameter("@MaHD", hoaDonDTO.MaHD); param[1] = new SqlParameter("@TenTaiKhoan", hoaDonDTO.TenTaiKhoan); param[2] = new SqlParameter("@NgayMua", hoaDonDTO.NgayMua.ToString("MM-dd-yyyy")); param[3] = new SqlParameter("@DiaChiGiaoHang", hoaDonDTO.DiaChiGiaoHang); param[4] = new SqlParameter("@SDTGiaoHang", hoaDonDTO.SDTGiaoHang); param[5] = new SqlParameter("@TongTien", hoaDonDTO.TongTien); param[6] = new SqlParameter("@TrangThai", hoaDonDTO.TrangThai); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }
public static bool ThemSp(SanPhamDTO sp) { string query = "INSERT INTO dbo.SanPham(MaSP,TenSP,ThongTin,GiaTien,MaLoaiSP,AnhMinhHoa,TrangThai) VALUES (@MaSP,@TenSP,@ThongTin,@GiaTien,@MaLoaiSP,@AnhMinhHoa,@TrangThai)"; SqlParameter[] param = new SqlParameter[7]; param[0] = new SqlParameter("@TenSP", sp.TenSP); param[1] = new SqlParameter("@ThongTin", sp.ThongTin); param[2] = new SqlParameter("@GiaTien", sp.GiaTien); param[3] = new SqlParameter("@MaLoaiSP", sp.MaLoaiSp); param[4] = new SqlParameter("@AnhMinhHoa", sp.AnhMinhHoa); param[5] = new SqlParameter("@TrangThai", sp.TrangThai); param[6] = new SqlParameter("@MaSP", sp.MaSP); return(DataProvider.ExecuteInsertQuery(query, param) == 1); }