protected void sugestoes() { Service a = new Service(); MembershipUser currentLoggedInUser = Membership.GetUser(); Guid userGuid = (Guid)Membership.GetUser().ProviderUserKey; String userID = userGuid.ToString(); Rede.Perfil prof = Rede.Perfil.LoadByUserId(userID); int profileID = 0; if (prof == null) { prof = new Rede.Perfil(userID, currentLoggedInUser.UserName); prof.Save(); } profileID = Rede.Perfil.LoadProfileIDByUserId(userID); if (profileID == 0) { } else { //a.sugereAmigos(profileID); String res = a.sugereAmigos(profileID); sugere_amigos(res); Dictionary<string, List<string>> dictionary = dicUserTag(res); foreach (var entry in dictionary) { //Console.WriteLine(entry.Key); TableRow tr = new TableRow(); TableCell tcNome = new TableCell(); TableCell tcNick = new TableCell(); TableCell tcTags = new TableCell(); String nome = Rede.Perfil.LoadNameByProfileId(Convert.ToInt32(entry.Key)); String nick = Rede.Perfil.LoadNickByProfileId(Convert.ToInt32(entry.Key)); //tc1.Text = entry.Key; tcNome.Text = nome; tcNick.Text = nick; CheckBox check = new CheckBox(); check.ID = entry.Key; //Button b = new Button(); //b.OnClientClick = "convidar"; //b.ID = "convidar"+entry.Key; //b.Text = "Convidar"; //b.Click += b_Click; String tags = ""; foreach (var tag in entry.Value) { if (tags.Equals("")) tags = tag; else tags += ", " + tag; } tcTags.Text = tags; tr.Cells.Add(tcNome); tr.Cells.Add(tcNick); tr.Cells.Add(tcTags); TableCell tcBtn = new TableCell(); tcBtn.Controls.Add(check); tr.Cells.Add(tcBtn); Table1.Rows.Add(tr); } } }
protected void Page_Load(object sender, EventArgs e) { TextNome.Enabled = false; TextMorada.Enabled = false; TextData.Enabled = false; TextLinkedin.Enabled = false; TextFace.Enabled = false; TextNick.Enabled = false; TextTlm.Enabled = false; DropDownList1.Enabled = false; TextTag.Enabled = false; //uploadButton0.Enabled = false; uploadButton.Enabled = false; Button5.Enabled = false; DropDownList3.Enabled = false; MembershipUser currentLoggedInUser = Membership.GetUser(); string id = Convert.ToString(currentLoggedInUser.ProviderUserKey); Rede.Perfil prof = Rede.Perfil.LoadByUserId(id); if (prof == null) { prof = new Rede.Perfil(id, currentLoggedInUser.UserName); prof.Save(); } if (!Page.IsPostBack) { if (prof.Premium) Image1.Visible = true; else Image1.Visible = false; TextNome.Text = prof.Name; TextNick.Text = prof.Nick; TextMorada.Text = prof.Morada; TextFace.Text = prof.FaceBook; TextData.Text = prof.DataNascimento.ToShortDateString(); TextLinkedin.Text = prof.Linkedin; TextTlm.Text = prof.Telemovel.ToString(); avatarIMG.Src = prof.avatar; DropDownList3.SelectedValue = prof.avatar3D; DropDownList1.SelectedValue = Convert.ToString(prof.humor.ID); SqlDataSource2.SelectParameters["ProfileID"].DefaultValue = Convert.ToString(prof.ID); } }