Exemple #1
0
    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();

            }
    }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
        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;
        }
Exemple #4
0
        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;
        }
Exemple #5
0
        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;
        }