public void updateNGUOIDUNG(string username, string type, string password, string tel, string email, int NID) { DATABASE diaphim = new DATABASE(); diaphim.openConnection(); SqlParameter[] parameters = new SqlParameter[6]; parameters[0] = new SqlParameter("@USERNAME", SqlDbType.VarChar, 20); parameters[0].Value = username; parameters[1] = new SqlParameter("@TYPE", SqlDbType.VarChar, 100); parameters[1].Value = type; parameters[2] = new SqlParameter("@PASS", SqlDbType.VarChar, 20); parameters[2].Value = password; parameters[3] = new SqlParameter("@TEL", SqlDbType.VarChar, 20); parameters[3].Value = tel; parameters[4] = new SqlParameter("@EMAIL", SqlDbType.VarChar, 20); parameters[4].Value = email; parameters[5] = new SqlParameter("@ID", SqlDbType.Int); parameters[5].Value = NID; diaphim.setData("spr_update_NGUOIDUNG", parameters); diaphim.closeConnection(); }
public void insertSANPHAM(int cid, string tenphim, string linkphim, byte[] image, int thoiluong, string namsanxuat, string daodien) { DATABASE diaphim = new DATABASE(); diaphim.openConnection(); SqlParameter[] parameters = new SqlParameter[7]; parameters[0] = new SqlParameter("@T_ID", SqlDbType.Int); parameters[0].Value = cid; parameters[1] = new SqlParameter("@TENPHIM", SqlDbType.VarChar, 50); parameters[1].Value = tenphim; parameters[2] = new SqlParameter("@THOILUONG", SqlDbType.Int); parameters[2].Value = thoiluong; parameters[3] = new SqlParameter("@LINKPHIM", SqlDbType.VarChar); parameters[3].Value = linkphim; parameters[4] = new SqlParameter("@NAMSANXUAT", SqlDbType.VarChar, 10); parameters[4].Value = namsanxuat; parameters[5] = new SqlParameter("@DAODIEN", SqlDbType.VarChar, 20); parameters[5].Value = daodien; parameters[6] = new SqlParameter("@HINHANH", SqlDbType.Image); parameters[6].Value = image; diaphim.setData("spr_insert_SANPHAM", parameters); diaphim.closeConnection(); }
public DataTable getnNGUOIDUNG() { DATABASE diaphim = new DATABASE(); DataTable tab = new DataTable(); tab = diaphim.getData("spr_get_users", null); diaphim.closeConnection(); return(tab); }
public DataTable getTHELOAI() { DATABASE diaphim = new DATABASE(); DataTable tab = new DataTable(); tab = diaphim.getData("spr_get_THELOAI", null); diaphim.closeConnection(); return(tab); }
public DataTable searchSANPHAM(string valueToSearch) { DATABASE diaphim = new DATABASE(); DataTable table = new DataTable(); SqlParameter[] parameters = new SqlParameter[1]; parameters[0] = new SqlParameter("@val", SqlDbType.VarChar, 100); parameters[0].Value = valueToSearch; table = diaphim.getData("spr_search_SANPHAM", parameters); diaphim.closeConnection(); return(table); }
public DataTable getSANPHAMbyTHELOAI(int t_id) { DATABASE diaphim = new DATABASE(); DataTable table = new DataTable(); SqlParameter[] parameters = new SqlParameter[1]; parameters[0] = new SqlParameter("@ST_ID", SqlDbType.Int); parameters[0].Value = t_id; table = diaphim.getData("spr_SANPHAM_by_THELOAI", parameters); diaphim.closeConnection(); return(table); }
public DataTable getSANPHAM(int id) { DATABASE diaphim = new DATABASE(); DataTable tab = new DataTable(); SqlParameter[] parameters = new SqlParameter[1]; parameters[0] = new SqlParameter("@ID", SqlDbType.Int); parameters[0].Value = id; tab = diaphim.getData("spr_get_SANPHAM_by_id", parameters); diaphim.closeConnection(); return(tab); }
public void deleteNGUOIDUNG(int userId) { DATABASE diaphim = new DATABASE(); diaphim.openConnection(); SqlParameter[] parameters = new SqlParameter[1]; parameters[0] = new SqlParameter("@NID", SqlDbType.Int); parameters[0].Value = userId; diaphim.setData("spr_delete_NGUOIDUNG", parameters); diaphim.closeConnection(); }
public void insertTHELOAI(string name) { DATABASE diaphim = new DATABASE(); diaphim.openConnection(); SqlParameter[] parameters = new SqlParameter[1]; parameters[0] = new SqlParameter("@NAME", SqlDbType.VarChar); parameters[0].Value = name; diaphim.setData("spr_insert_THELOAI", parameters); diaphim.closeConnection(); }
public void deleteTHELOAI(int S_id) { DATABASE diaphim = new DATABASE(); DataTable table = new DataTable(); SqlParameter[] parameters = new SqlParameter[1]; parameters[0] = new SqlParameter("@cid", SqlDbType.Int); parameters[0].Value = S_id; diaphim.openConnection(); diaphim.setData("spr_delete_THELOAI", parameters); diaphim.closeConnection(); }
public void deleteSANPHAM(int s_id) { DATABASE diaphim = new DATABASE(); diaphim.openConnection(); SqlParameter[] parameters = new SqlParameter[1]; parameters[0] = new SqlParameter("@SID", SqlDbType.Int); parameters[0].Value = s_id; diaphim.setData("spr_delete_SANPHAM", parameters); diaphim.closeConnection(); }
public DataTable login(string username, string password) { DATABASE diaphim = new DATABASE(); SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@username", SqlDbType.VarChar, 20); param[0].Value = username; param[1] = new SqlParameter("@pass", SqlDbType.VarChar, 20); param[1].Value = password; DataTable tab = new DataTable(); tab = diaphim.getData("spr_DANGNHAP", param); diaphim.closeConnection(); return(tab); }
public void updateTHELOAI(int cid, string name) { DATABASE diaphim = new DATABASE(); diaphim.openConnection(); SqlParameter[] parameters = new SqlParameter[2]; parameters[0] = new SqlParameter("@T_ID", SqlDbType.Int); parameters[0].Value = cid; parameters[1] = new SqlParameter("@NAME", SqlDbType.VarChar); parameters[1].Value = name; diaphim.setData("spr_update_THELOAI", parameters); diaphim.closeConnection(); }