public Boolean repair(UserDangKi user, string sql) { SqlConnection conn = getConnection(); conn.Open(); try { SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.AddWithValue("User", user.Username); cmd.Parameters.AddWithValue("Pass", user.Password); cmd.Parameters.AddWithValue("Quyen", user.Quyen); cmd.Parameters.AddWithValue("Ten", user.HoVaTen); cmd.Parameters.AddWithValue("Ns", user.NgaySinh.ToString()); cmd.ExecuteNonQuery(); } catch (Exception) { return(false); } finally { conn.Close(); } return(true); }
public Boolean Sua(string UserName, string Password, string HoVaTen, string NgaySinh, string Quyen) { DataProvider dp = new DataProvider(); UserDangKi udk = new UserDangKi(UserName, Password, HoVaTen, DateTime.Parse(NgaySinh), Quyen); string sql = "UPDATE tbuser SET Pass = @pass, Quyen = @Quyen,Ten = @ten,Ngaysinh = @ns WHERE Username = @user"; return(dp.repair(udk, sql)); }
public Boolean dangKi(string UserName, string Password, string HoVaTen, string NgaySinh, string Quyen) { DataProvider dp = new DataProvider(); UserDangKi udk = new UserDangKi(UserName, Password, HoVaTen, DateTime.Parse(NgaySinh), Quyen); string sql = "INSERT INTO tbuser VALUES(@User,@Pass,@Quyen,@Ten,@Ns)"; return(dp.insertUser(udk, sql)); }