protected void Page_Load(object sender, EventArgs e) { GridView grid = new GridView(); DataTable dt = new DataTable(); List<Mensagem> lista = new List<Mensagem>(); MensagemBL mbl = new MensagemBL(); UsuarioBL ubl = new UsuarioBL(); lista = mbl.buscaMensagensusuario(Session["email"].ToString()); DataColumn c1 = new DataColumn("data", Type.GetType("System.String")); DataColumn c2 = new DataColumn("remetente", Type.GetType("System.String")); DataColumn c3 = new DataColumn("nome", Type.GetType("System.String")); DataColumn c4 = new DataColumn("abrir", Type.GetType("System.String")); dt.Columns.Add(c1); dt.Columns.Add(c2); dt.Columns.Add(c3); dt.Columns.Add(c4); foreach (Mensagem m in lista) { DataRow dr = dt.NewRow(); dr["data"] = m.data.ToShortDateString(); dr["remetente"] = m.remetente.ToString(); dr["nome"] = ubl.buscaNome(m.remetente.ToString()); dr["abrir"] = "~/LerMensagem.aspx?id_mensagem=" + m.id.ToString(); dt.Rows.Add(dr); } gridMensagens.DataSource = dt.Copy(); gridMensagens.DataBind(); }
protected void Page_Init(object sender, EventArgs e) { if (Request["id_mensagem"] != null) { idMensagem = Convert.ToInt16(Request["id_mensagem"].ToString()); MensagemBL mbl = new MensagemBL(); Mensagem m = new Mensagem(); m = mbl.buscamensagem(idMensagem); txtDataEnvio.Text = m.data.ToShortDateString(); txtemail.Text = m.remetente; UsuarioBL ubl = new UsuarioBL(); txtNome.Text = ubl.buscaNome(m.remetente); txtmensagem.Text = m.mensagem; } else { Response.Redirect("ConsultaMensagens.aspx"); } }
public void criaPDFPage(PdfPage page, Projeto pro) { XGraphics gfx = XGraphics.FromPdfPage(page); XTextFormatter tf = new XTextFormatter(gfx); XRect retangulo; int iLeftMargin = 15; int iTopMargin = 25; int conta = 0, iTempTopMargin; System.Drawing.Point point; point = new System.Drawing.Point(260, 15); System.Drawing.Image newImage = System.Drawing.Image.FromFile(StaticObjects.filepathImage); gfx.DrawImage(newImage, point); //MOntar header iLeftMargin = iLeftMargin + 15; iTopMargin = iTopMargin + 50; point = new System.Drawing.Point(iLeftMargin + 3, iTopMargin + 10); gfx.DrawString("Número do Projeto: " + pro.id.ToString(), font, Brushes.Black, point); gfx.DrawRectangle(new Pen(Brushes.Black), iLeftMargin, iTopMargin, 270, 15); point = new System.Drawing.Point(iLeftMargin + 3 + 270, iTopMargin + 10); string tipo = pda.buscaNomeTipoProjeto(pro.tipo); gfx.DrawString("Tipo de projeto: " + tipo, font, Brushes.Black, point); gfx.DrawRectangle(new Pen(Brushes.Black), iLeftMargin + 270, iTopMargin, 270, 15); iTopMargin = iTopMargin + 15; point = new System.Drawing.Point(iLeftMargin + 3, iTopMargin + 10); UsuarioBL uda = new UsuarioBL(); string nome = uda.buscaNome(pro.emailResponsavel); gfx.DrawString("Responsável pelo Projeto: " + nome, font, Brushes.Black, point); gfx.DrawRectangle(new Pen(Brushes.Black), iLeftMargin, iTopMargin, 270, 15); point = new System.Drawing.Point(iLeftMargin + 3 + 270, iTopMargin + 10); gfx.DrawString("E-mail do responsável: " + pro.emailResponsavel, font, Brushes.Black, point); gfx.DrawRectangle(new Pen(Brushes.Black), iLeftMargin + 270, iTopMargin, 270, 15); iTopMargin = iTopMargin + 15; point = new System.Drawing.Point(iLeftMargin + 3, iTopMargin + 10); gfx.DrawString("Data de Início: " + pro.dataInicio.ToShortDateString(), font, Brushes.Black, point); gfx.DrawRectangle(new Pen(Brushes.Black), iLeftMargin, iTopMargin, 270, 15); point = new System.Drawing.Point(iLeftMargin + 3 + 270, iTopMargin + 10); gfx.DrawString("Duração em dias até agora: " + DateTime.Now.Subtract(pro.dataInicio).Days, font, Brushes.Black, point); gfx.DrawRectangle(new Pen(Brushes.Black), iLeftMargin + 270, iTopMargin, 270, 15); iTopMargin = iTopMargin + 15; TarefaBL tda = new TarefaBL(); int qntTotal = tda.contaTarefasProjeto(pro.id); int qntFinalizada = tda.contaTarefaFinalizadasProjeto(pro.id); point = new System.Drawing.Point(iLeftMargin + 3, iTopMargin + 10); gfx.DrawString("Quantidade Total de Tarefas: " + qntTotal, font, Brushes.Black, point); gfx.DrawRectangle(new Pen(Brushes.Black), iLeftMargin, iTopMargin, 270, 15); point = new System.Drawing.Point(iLeftMargin + 3 + 270, iTopMargin + 10); gfx.DrawString("Percentual de Tarefas Concluídas): " + ((qntFinalizada * 100)/qntTotal) + "%", font, Brushes.Black, point); gfx.DrawRectangle(new Pen(Brushes.Black), iLeftMargin + 270, iTopMargin, 270, 15); iTopMargin = iTopMargin + 15; point = new System.Drawing.Point(iLeftMargin + 3, iTopMargin + 10); gfx.DrawString("Título: " + pro.titulo, font, Brushes.Black, point); gfx.DrawRectangle(new Pen(Brushes.Black), iLeftMargin, iTopMargin, 540, 15); iTopMargin = iTopMargin + 37; point = new System.Drawing.Point(iLeftMargin + 3, iTopMargin + 10); gfx.DrawString("TAREFAS", headersFont, Brushes.Black, point); gfx.DrawRectangle(new Pen(Brushes.Black), iLeftMargin, iTopMargin, 540, 15); iTopMargin = iTopMargin + 15; rect = new RectangleF(iLeftMargin + 3, iTopMargin + 10, 540, 300); conta = 0; iTempTopMargin = iTopMargin; List<Tarefa> lista = new List<Tarefa>(); lista = tda.buscaTarefasProjeto(pro.id, false, ""); foreach (Tarefa t in lista) { StringBuilder frase = new StringBuilder(); frase.Append(t.titulo); frase.Append(" ("); string status; switch (t.status) { case 0: status = "Pendente"; break; case 1: status = "Em Andamento"; break; case 2: status = "Concluída"; break; case 3: status = "Cancelada"; break; default: status = "Não Iformado"; break; } frase.Append(status); frase.Append(")"); point = new System.Drawing.Point(iLeftMargin + 3, iTempTopMargin + 10); gfx.DrawString(frase.ToString(), font, Brushes.Black, point); conta++; iTempTopMargin = iTempTopMargin + 15; } rect = new RectangleF(iLeftMargin, iTopMargin, 540, iTempTopMargin - iTopMargin); gfx.DrawRectangle(Pens.Black, Rectangle.Round(rect)); iTopMargin = iTempTopMargin + 15; }
protected void btnNotifica_Click(object sender, EventArgs e) { bool filtra = false; string etapa = ""; TarefaBL tbl = new TarefaBL(); List<Tarefa> listaTarefas = new List<Tarefa>(); listaTarefas = tbl.buscaTarefasProjeto(p.id, filtra, etapa); foreach (Tarefa t in listaTarefas) { UsuarioBL ubl = new UsuarioBL(); EtapaBL ebl = new EtapaBL(); string urlRedirecionada = "http://localhost:61700/Login.aspx"; string nome = ubl.buscaNome(t.emailResponsavel); string dataIni = t.dataInicio.ToShortDateString(); string nomeEtapa = ebl.buscaDescricaoEtapa(t.idEtapa); string prazo = t.prazoEstimado.ToString(); string titulo = t.titulo; string mensagem = "<html><head><meta http-equiv='content-type' content='text/html; charset=utf-8' /></head> " + " <body><p style='font-family:Calibri;font-size:medium;'>Olá " + nome + ",</p>" + " <p style='font-family:Calibri;font-size:medium;'>Você acaba de receber uma tarefa no software PDM. Veja mais detalhes:</p> " + " <p style='font-family:Calibri;font-size:medium;'>Título da Tarefa: " + titulo + " <br> " + " Etapa: " + etapa + "<br> " + " Data de início: " + dataIni + "<br> " + " Prazo de conclusão em dias: " + prazo + " </p> " + " <p> Clique no link abaixo para acessar o sistema e conferir suas tarefas. <br> " + " <a href='" + urlRedirecionada + "'>Link para Login </a> </p>" + " <p style='font-family:Calibri;font-size:medium;'>Contamos com seu empenho para o sucesso do projeto!<br> " + " Administrador</p><body></html>"; Email email = new Email(); email.notificarNovaTarefa(t.emailResponsavel, mensagem); } }