Пример #1
0
        public void carregaTabela()
        {
            GridView grid = new GridView();
            DataTable dt = new DataTable();
            List<ItemTarefa> lista = new List<ItemTarefa>();
            TarefaBL tbl = new TarefaBL();
            lista = tbl.buscaItensTarefa(idTarefa);
            DataColumn c1 = new DataColumn("data", Type.GetType("System.String"));
            DataColumn c2 = new DataColumn("descricao", Type.GetType("System.String"));
            DataColumn c3 = new DataColumn("excluir", Type.GetType("System.String"));
            dt.Columns.Add(c1);
            dt.Columns.Add(c2);
            dt.Columns.Add(c3);

            foreach (ItemTarefa t in lista)
            {
                EtapaBL ebl = new EtapaBL();
                DataRow dr = dt.NewRow();
                dr["data"] = t.data.ToString();
                dr["descricao"] = t.descricao.ToString();
                dr["excluir"] = "ExcluirItemTarefa.aspx?id_item=" + t.id.ToString();
                dt.Rows.Add(dr);
            }
            gridItens.DataSource = dt.Copy();
            gridItens.DataBind();
        }
Пример #2
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            TarefaBL tbl = new TarefaBL();
            EtapaBL eBL = new EtapaBL();
            Tarefa t = new Tarefa();
            t.id = idTarefa;
            t.idProjeto = idProjeto;
            t.idEtapa = eBL.buscaIdEtapa(listaEtapas.SelectedItem.Value);
            t.emailResponsavel = listaResponsaveis.SelectedItem.Value;
            t.titulo = txtTitulo.Value;
            DateTime dataI = Convert.ToDateTime(txtDataIni.Value);
            t.dataInicio = dataI;
            t.dataFim = dataI.AddDays(Convert.ToInt16(txtPrazo.Value));
            t.prazoEstimado = Convert.ToInt16(txtPrazo.Value);
            t.observacao = obs;

            if(pendente.Checked == true){t.status = 0;}
            else if (emAndamento.Checked == true){t.status = 1;}
            else if(concluido.Checked == true){t.status = 2;}
            else if (cancelado.Checked == true){t.status = 3;}
            else{t.status = 0;}

            bool foi = tbl.editaTarefa(t);
            if (foi)
            {
                Response.Write("<script>alert('Tarefa editada com sucesso!')</script>");
            }
            LogEventoBL lbl = new LogEventoBL();
            Log l = new Log();
            l.email = Session["email"].ToString();
            l.data = DateTime.Now;
            l.descricao = "Editou tarefa nº" + t.id + " ";
            lbl.adicionaLog(l);
            Response.Redirect("EditaProjeto.aspx?id_projeto=" + idProjeto.ToString());
        }
Пример #3
0
 protected void btnFinalizar_Click(object sender, EventArgs e)
 {
     TarefaBL tbl = new TarefaBL();
     bool foi = tbl.mudaStatusTarefa(2, idTarefa);
     if (foi)
     {
         Response.Write("<script>alert('Tarefa Finalizada com Sucesso!')</script>");
     }
 }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UsuarioBL ubl = new UsuarioBL();
            Usuario u = new Usuario();
            u = ubl.buscaUsuarioAtivo(Session["email"].ToString());
            lblDataFimLicenca.Text = u.dataFimLicenca.ToShortDateString();
            lblNome01.Text = u.nome;
            lblNome02.Text = u.nome;
            MensagemBL mbl = new MensagemBL();
            lblQntMensagem.Text = mbl.contaMensagens(Session["email"].ToString());

            TarefaBL tbl = new TarefaBL();
            lblQntTarefas.Text = tbl.contaTarefasUsuario(Session["email"].ToString()).ToString();
        }
 protected void Page_Init(object sender, EventArgs e)
 {
     if(Request["id_item"] != null)
     {
         int id = Convert.ToInt16(Request["id_item"].ToString());
         TarefaBL tbl = new TarefaBL();
         tbl.removerItem(id);
         Response.Redirect("~/RealizaTarefa.aspx?id_tarefa=" + Session["idTarefa"].ToString());
         LogEventoBL lbl = new LogEventoBL();
         Log l = new Log();
         l.email = Session["email"].ToString();
         l.data = DateTime.Now;
         l.descricao = "Removeu ItemTarefa nº " + id + " ";
         lbl.adicionaLog(l);
     }
 }
Пример #6
0
 protected void btnExcluir_Click(object sender, EventArgs e)
 {
     TarefaBL tbl = new TarefaBL();
     bool foi = tbl.excluiTarefa(idTarefa);
     if(foi)
     {
         Response.Write("<script>alert('Tarefa excluída com sucesso!')</script>");
     }
     LogEventoBL lbl = new LogEventoBL();
     Log l = new Log();
     l.email = Session["email"].ToString();
     l.data = DateTime.Now;
     l.descricao = "Removeu a Tarefa nº " + idTarefa + " ";
     lbl.adicionaLog(l);
     Response.Redirect("EditaProjeto.aspx?id_projeto=" + idProjeto.ToString());
 }
Пример #7
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     if ((txtItem.Text != "") && txtItem.Text != null)
     {
         ItemTarefa i = new ItemTarefa();
         i.idTarefa = idTarefa;
         i.data = DateTime.Now;
         i.descricao = txtItem.Text;
         TarefaBL tbl = new TarefaBL();
         bool foi = tbl.adicionarItem(i);
         carregaTabela();
         LogEventoBL lbl = new LogEventoBL();
         Log l = new Log();
         l.email = Session["email"].ToString();
         l.data = DateTime.Now;
         l.descricao = "Adicionou um item <" + i.descricao + "> na Tarefa nº " + i.idTarefa + " ";
         lbl.adicionaLog(l);
         txtItem.Text = "";
     }
 }
Пример #8
0
        public void carregaInformativo()
        {
            string email = Session["email"].ToString();
            Usuario u = new Usuario();
            UsuarioBL ubl = new UsuarioBL();
            u = ubl.buscaUsuarioAtivo(email);
            ProjetoBL pbl = new ProjetoBL();
            TarefaBL tbl = new TarefaBL();
            int totaProj = 0, totalTask = 0;
            double projPend = 0, projConc = 0, TaskPend = 0, taskConc = 0;
            try
            {
                totaProj = pbl.contaProjetosEmpresa(u.idEmpresa, "");
                projPend = (pbl.contaProjetosEmpresa(u.idEmpresa, "AND status <> 2 AND status <> 3") * 100) / totaProj;
                projConc = (pbl.contaProjetosEmpresa(u.idEmpresa, "AND status <> 0 AND status <> 1") * 100) / totaProj;
                totalTask = tbl.contaTarefasEmpresa(u.idEmpresa, "");
                TaskPend = (tbl.contaTarefasEmpresa(u.idEmpresa, "AND status <> 2 AND status <> 3") * 100) / totalTask;
                taskConc = (tbl.contaTarefasEmpresa(u.idEmpresa, "AND status <> 0 AND status <> 1") * 100) / totalTask;

                lblQntProj.Text = totaProj.ToString();
                lblProjPendente.Text = projPend.ToString();
                lblProjFim.Text = projConc.ToString();
                lblTotalTarefas.Text = totalTask.ToString();
                lblTarefaTotal.Text = TaskPend.ToString();
                lblTarefaExec.Text = taskConc.ToString();
            }
            catch (Exception ex)
            {
                lblQntProj.Text = "0";
                lblProjPendente.Text = "0";
                lblProjFim.Text = "0";
                lblTotalTarefas.Text = "0";
                lblTarefaTotal.Text = "0";
                lblTarefaExec.Text = "0";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            GridView grid = new GridView();
            DataTable dt = new DataTable();
            List<Tarefa> lista = new List<Tarefa>();
            TarefaBL tbl = new TarefaBL();
            lista = tbl.buscaTarefasUsuario(Session["email"].ToString());

            DataColumn c1 = new DataColumn("etapa", Type.GetType("System.String"));
            DataColumn c2 = new DataColumn("responsavel", Type.GetType("System.String"));
            DataColumn c3 = new DataColumn("dataInicio", Type.GetType("System.String"));
            DataColumn c4 = new DataColumn("prazo", Type.GetType("System.String"));
            DataColumn c5 = new DataColumn("titulo", Type.GetType("System.String"));
            DataColumn c6 = new DataColumn("editar", Type.GetType("System.String"));
            dt.Columns.Add(c1);
            dt.Columns.Add(c2);
            dt.Columns.Add(c3);
            dt.Columns.Add(c4);
            dt.Columns.Add(c5);
            dt.Columns.Add(c6);

            foreach (Tarefa t in lista)
            {
                EtapaBL ebl = new EtapaBL();
                DataRow dr = dt.NewRow();
                dr["etapa"] = ebl.buscaDescricaoEtapa(t.idEtapa);
                dr["responsavel"] = t.emailResponsavel.ToString();
                dr["dataInicio"] = t.dataInicio.ToString();
                dr["prazo"] = t.prazoEstimado.ToString();
                dr["titulo"] = t.titulo.ToString();
                dr["editar"] = "~/RealizaTarefa.aspx?id_tarefa=" + t.id.ToString();
                dt.Rows.Add(dr);
            }
            gridTerceiros.DataSource = dt.Copy();
            gridTerceiros.DataBind();
        }
Пример #10
0
        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;
        }
Пример #11
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ProjetoBL pbl = new ProjetoBL();
                Dictionary<string, string> lista = new Dictionary<string, string>();
                lista = pbl.buscaTiposProjeto();
                listaTipo.DataSource = lista;
                listaTipo.DataBind();
                List<Usuario> listaU = new List<Usuario>();
                string teste = Session["empresa"].ToString();
                UsuarioBL ubl = new UsuarioBL();
                listaU = ubl.buscaUsuariosEmpresa(Convert.ToInt16(teste));
                foreach (Usuario u in listaU)
                {
                    listaResponsaveis.Items.Add(u.email);
                }
                listaResponsaveis.DataBind();
                Dictionary<string, string> listaTer = new Dictionary<string, string>();
                TerceiroBL tb = new TerceiroBL();
                List<Terceiro> listaT = new List<Terceiro>();
                listaT = tb.buscaTerceiros(Convert.ToInt16(Session["empresa"]));
                foreach (Terceiro t in listaT)
                {
                    string item = t.id.ToString();
                    string item2 = t.nome.ToString();
                    listaTer.Add(item, item2);
                }
                listaTerceiros.DataSource = listaTer;
                listaTerceiros.DataBind();

                if (Request["id_projeto"] != null)
                {
                    p = pbl.buscaProjeto("", Convert.ToInt16(Request["id_projeto"].ToString()));
                    txtTitulo.Value = p.titulo;
                    listaResponsaveis.Text = p.emailResponsavel;
                    listaTipo.SelectedIndex = p.tipo;
                    GridView grid = new GridView();
                    DataTable dt = new DataTable();
                    List<Tarefa> listaTarefas = new List<Tarefa>();
                    TarefaBL tbl = new TarefaBL();
                    listaTarefas = tbl.buscaTarefasProjeto(p.id, false, "");

                    DataColumn c1 = new DataColumn("Responsavel", Type.GetType("System.String"));
                    DataColumn c2 = new DataColumn("DataInicio", Type.GetType("System.String"));
                    DataColumn c3 = new DataColumn("Prazo", Type.GetType("System.String"));
                    DataColumn c4 = new DataColumn("Status", Type.GetType("System.String"));
                    DataColumn c5 = new DataColumn("Titulo", Type.GetType("System.String"));
                    DataColumn c6 = new DataColumn("editar", Type.GetType("System.String"));

                    dt.Columns.Add(c1);
                    dt.Columns.Add(c2);
                    dt.Columns.Add(c3);
                    dt.Columns.Add(c4);
                    dt.Columns.Add(c5);
                    dt.Columns.Add(c6);

                    foreach (Tarefa t in listaTarefas)
                    {
                        DataRow dr = dt.NewRow();
                        dr["Responsavel"] = t.emailResponsavel.ToString();
                        dr["DataInicio"] = t.dataInicio.ToShortDateString();
                        dr["Prazo"] = t.dataInicio.AddDays(t.prazoEstimado).ToShortDateString();
                        switch (t.status)
                        {
                            case 0:
                                dr["Status"] = "Pendente";
                                break;
                            case 1:
                                dr["Status"] = "Em Andamento";
                                break;
                            case 2:
                                dr["Status"] = "Concluída";
                                break;
                            case 3:
                                dr["Status"] = "Cancelada";
                                break;
                        }
                        dr["Titulo"] = t.titulo.ToString();
                        dr["editar"] = "~/EditaTarefa.aspx?id_tarefa=" + t.id.ToString();
                        dt.Rows.Add(dr);
                    }
                    gridTarefas.DataSource = dt.Copy();
                    gridTarefas.DataBind();
                }
                EtapaBL ebl = new EtapaBL();
                Dictionary<string, string> listaE = new Dictionary<string, string>();
                listaE = ebl.buscaDescricaoEtapas();
                lstEtapa.DataSource = listaE;
                lstEtapa.DataBind();
            }
        }
Пример #12
0
        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);
            }
        }
Пример #13
0
        protected void btnBuscaTarefas_Click(object sender, EventArgs e)
        {
            bool filtra = false;
            string etapa = "";
            TarefaBL tbl = new TarefaBL();
            List<Tarefa> listaTarefas = new List<Tarefa>();
            if (lstEtapa.SelectedIndex == 0)
            {
                filtra = false;
                etapa = "";
            }
            else
            {
                filtra = true;
                etapa = lstEtapa.SelectedItem.Value.ToString();
            }
            listaTarefas = tbl.buscaTarefasProjeto(p.id, filtra, etapa);
            DataTable dt = new DataTable();

            DataColumn c1 = new DataColumn("Responsavel", Type.GetType("System.String"));
            DataColumn c2 = new DataColumn("DataInicio", Type.GetType("System.String"));
            DataColumn c3 = new DataColumn("Prazo", Type.GetType("System.String"));
            DataColumn c4 = new DataColumn("Status", Type.GetType("System.String"));
            DataColumn c5 = new DataColumn("Titulo", Type.GetType("System.String"));
            DataColumn c6 = new DataColumn("editar", Type.GetType("System.String"));

            dt.Columns.Add(c1);
            dt.Columns.Add(c2);
            dt.Columns.Add(c3);
            dt.Columns.Add(c4);
            dt.Columns.Add(c5);
            dt.Columns.Add(c6);
            foreach (Tarefa t in listaTarefas)
            {
                DataRow dr = dt.NewRow();
                dr["Responsavel"] = t.emailResponsavel.ToString();
                dr["DataInicio"] = t.dataInicio.ToShortDateString();
                dr["Prazo"] = t.dataInicio.AddDays(t.prazoEstimado).ToShortDateString();
                switch (t.status)
                {
                    case 0:
                        dr["Status"] = "Pendente";
                        break;
                    case 1:
                        dr["Status"] = "Em Andamento";
                        break;
                    case 2:
                        dr["Status"] = "Concluída";
                        break;
                    case 3:
                        dr["Status"] = "Cancelada";
                        break;
                }
                //dr["Status"] = t.status.ToString();
                dr["Titulo"] = t.titulo.ToString();
                dr["editar"] = "~/EditaTarefa.aspx?id_tarefa=" + t.id.ToString();
                dt.Rows.Add(dr);
            }
            gridTarefas.DataSource = dt.Copy();
            gridTarefas.DataBind();
        }
Пример #14
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Request["id_tarefa"] != null)
            {
                idTarefa = Convert.ToInt16(Request["id_tarefa"].ToString());
                Session["idTarefa"] = idTarefa;
            }
            TarefaBL tbl = new TarefaBL();
            Tarefa t = new Tarefa();
            t = tbl.buscaTarefa(idTarefa);

            EtapaBL ebl = new EtapaBL();
            lblEtapa.Text = ebl.buscaDescricaoEtapa(t.idEtapa);
            lblTitulo.Text = t.titulo;
            lblDtIni.Text = t.dataInicio.ToShortDateString();
            lblPrazo.Text = t.prazoEstimado.ToString();

            switch (t.status)
            {
                case 0:
                    lblStatus.Text = "Pendente";
                    break;
                case 1:
                    lblStatus.Text = "Em Andamento";
                    break;
                case 2:
                    lblStatus.Text = "Concluída";
                    break;
                case 3:
                    lblStatus.Text = "Cancelada";
                    break;
            }
            carregaTabela();
        }
Пример #15
0
        protected void Page_Init(object sender, EventArgs e)
        {
            List<Usuario> listaU = new List<Usuario>();
            UsuarioBL ubl = new UsuarioBL();
            listaU = ubl.buscaUsuariosEmpresa(Convert.ToInt16(Session["empresa"].ToString()));
            foreach (Usuario u in listaU)
            {
                listaResponsaveis.Items.Add(u.email);
            }
            listaResponsaveis.DataBind();

            EtapaBL ebl = new EtapaBL();
            Dictionary<string, string> listaE = new Dictionary<string, string>();
            listaE = ebl.buscaDescricaoEtapas();
            listaEtapas.Items.Add("--selecione--");
            listaEtapas.DataSource = listaE;
            listaEtapas.DataBind();

            if (Request["id_tarefa"] != null)
            {
                int id = Convert.ToInt16(Request["id_tarefa"].ToString());
                TarefaBL tbl = new TarefaBL();
                EtapaBL etapaBL = new EtapaBL();
                Tarefa t = new Tarefa();

                t = tbl.buscaTarefa(id);

                idProjeto = t.idProjeto;
                idTarefa = t.id;
                idEtapa = t.idEtapa;

                string descEtapa = etapaBL.buscaDescricaoEtapa(t.idEtapa);
                listaEtapas.SelectedItem.Value = descEtapa;

                obs = t.observacao;
                listaResponsaveis.SelectedItem.Value = t.emailResponsavel;
                txtTitulo.Value = t.titulo;
                txtDataIni.Value = t.dataInicio.ToShortDateString();
                txtPrazo.Value = t.prazoEstimado.ToString();
                switch(t.status)
                {
                    case 0:
                        pendente.Checked = true;
                        break;
                    case 1:
                        emAndamento.Checked = true;
                        break;
                    case 2:
                        concluido.Checked = true;
                        break;
                    case 3:
                        cancelado.Checked = true;
                        break;
                }
            }
            else
            {
                Response.Redirect("ConsultaProjeto.aspx");
            }
        }
Пример #16
0
        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            TarefaBL tbl = new TarefaBL();
            EtapaBL ebl = new EtapaBL();
            Tarefa t = new Tarefa();
            t.idProjeto = idProjeto;
            t.idEtapa = Convert.ToInt16(ListaEtapas.SelectedItem.Value);
            t.emailResponsavel = listaResponsaveis.SelectedItem.Value;
            t.titulo = txtTitulo.Value;
            DateTime dt = Convert.ToDateTime(txtDataIni.Value);
            t.dataInicio = dt;
            int prazo = Convert.ToInt16(txtPrazo.Value);
            t.prazoEstimado = prazo;
            t.dataFim = dt.AddDays(prazo);
            t.observacao = txtObservacao.Value;

            if (pendente.Checked == true) { t.status = 0; }
            else if (emAndamento.Checked == true) { t.status = 1; }
            else if (concluido.Checked == true) { t.status = 2; }
            else if (cancelado.Checked == true) { t.status = 3; }
            else { t.status = 0; }

            bool foi = tbl.cadastraTarefa(t);
            if(foi)
            {
                MensagemBL mbl = new MensagemBL();
                Mensagem m = new Mensagem();
                m.data = DateTime.Now;
                m.remetente = "*****@*****.**";
                m.responsavel = t.emailResponsavel;
                m.mensagem = "Uma nova Tarefa foi criada para você no Projeto Nº " + t.idProjeto + ".";
                m.lida = 0;
                mbl.cadastraMensagem(m);
            }
            string etapa = ebl.buscaDescricaoEtapa(t.idEtapa);
            string urlRedirecionada = "http://localhost:61700/Login.aspx";
            string nome = Session["nome"].ToString();
            string dataIni = t.dataInicio.ToShortDateString();
            string nomeEtapa = ebl.buscaDescricaoEtapa(t.idEtapa);
            string strPrazo = 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: " + strPrazo + " </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);

            LogEventoBL lbl = new LogEventoBL();
            Log l = new Log();
            l.email = Session["email"].ToString();
            l.data = DateTime.Now;
            l.descricao = "Cadastro de Nova Tarefa para o projeto nº " + t.idProjeto + " ";
            lbl.adicionaLog(l);

            Response.Redirect("EditaProjeto.aspx?id_projeto=" + idProjeto.ToString());
        }