protected void Button5_Click(object sender, EventArgs e) { string tag = TextTag.Text; if (tag != "") { bool existe = Rede.Tag.ExisteTag(tag); if (existe == false) { Rede.Tag t = new Rede.Tag(tag); t.Save(); } Rede.Tag t2 = Rede.Tag.LoadByName(tag); MembershipUser currentLoggedInUser = Membership.GetUser(); string id = Convert.ToString(currentLoggedInUser.ProviderUserKey); Rede.Perfil p = Rede.Perfil.LoadByUserId(id); Rede.Tag.insereRelacao(p.ID, t2.ID); DropDownList2.DataBind(); } }
public static IList LoadAll() { try { DataSet ds = ExecuteQuery(GetConnection(false), "SELECT * from TTag"); IList ret = new ArrayList(); foreach (DataRow r in ds.Tables[0].Rows) { Tag av = new Tag(r); ret.Add(av); //apagar // save in registry //loaded[p.ID] = p; } return ret; } catch (Exception ex) { throw new ApplicationException("Erro BD", ex); } }
public static Tag LoadByName(string tipo) { DataSet ds = ExecuteQuery("SELECT * FROM TTag WHERE Designacao='" + tipo + "'"); Tag av = new Tag(ds.Tables[0].Rows[0]); return av; }
public static List<string> TagUser() { List<string> lst = new List<string>(); int aux=0; try { DataSet ds = ExecuteQuery(GetConnection(false), "SELECT * from TTag"); foreach (DataRow r in ds.Tables[0].Rows) { Tag av = new Tag(r); aux = getOcurrencias(av.ID); while(aux!=0){ lst.Add(av.Designacao); aux--; } } } catch (Exception ex) { throw new ApplicationException("Erro BD", ex); } return lst; }
public static Tag LoadById(int ID) { DataSet ds = ExecuteQuery("SELECT * FROM TTag WHERE TagID=" + ID); Tag t = new Tag(ds.Tables[0].Rows[0]); return t; }