protected void btUser_Click(object sender, EventArgs e) { Button bt = (Button)sender; GridViewRow gv = (GridViewRow)bt.NamingContainer; int index = gv.RowIndex; Button btUser = (Button)gvReqList.Rows[index].FindControl("btUser"); String username = btUser.Text; User user = UserDAO.GetUserByUsername(username); lbUsername.Text = "<b>Username : </b>" + username + "\n"; lbEmail.Text = "<b>Email : </b>" + user.Email + "\n"; lbNomeUser.Text = "<b>Nome : </b>" + user.Nome + "\n"; MPE_User.Show(); }
protected void btEnviar_Click(object sender, EventArgs e) { bool b = false; try { using (var client = new WebClient()) using (client.OpenRead("http://google.com/generate_204")) b = true; } catch { b = false; } if (b == true) { MailMessage mailMessage = new MailMessage(); mailMessage.From = new MailAddress("*****@*****.**"); mailMessage.To.Add(lbEmail.Text); mailMessage.Subject = tbxAssunto.Text; mailMessage.Body = "<h3>G.E.T</h3><br/>" + tbxMensagem.Text; mailMessage.IsBodyHtml = true; SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587); smtpClient.EnableSsl = true; smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = new System.Net.NetworkCredential("*****@*****.**", "teste123456"); smtpClient.Send(mailMessage); String str = "<script>alertify.success('Email enviado com sucesso!');</script>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", str, false); divContactar.Visible = false; tbxMensagem.Text = ""; tbxAssunto.Text = ""; } else { MPE_User.Hide(); divContactar.Visible = false; btContactar.Enabled = false; tbxMensagem.Text = ""; tbxAssunto.Text = ""; String str1 = "<script>alertify.error('Sem ligação! Email não enviado.');</script>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", str1, false); } }
protected void btFecharUser_Click(object sender, EventArgs e) { MPE_User.Hide(); }
protected void btContactar_Click(object sender, EventArgs e) { divContactar.Visible = true; btContactar.Visible = false; MPE_User.Show(); }