protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["login"] == null)
            {
                Session.RemoveAll();
                Response.Redirect("../Pages/Login.aspx");
            }

            MODUsuario usuario2 = new MODUsuario();

            usuario2.Login = PegaLogin.RetornaLogin();
            usuario2       = BLLUsuario.PesquisarLogin(usuario2);

            ImagemUser.ImageUrl  = "../Pages/" + usuario2.Imagem;
            ImagemUser2.ImageUrl = "../Pages/" + usuario2.Imagem;
            LblNome.Text         = usuario2.Nome;

            if (usuario2.FkTipo == 1)
            {
                LblFuncao.Text = "Administrador";
            }
            else
            {
                LblFuncao.Text = "Lider de Pesquisa";
            }

            MODDiscente                 discente        = new MODDiscente();
            MODProjetoPesquisa          projeto         = new MODProjetoPesquisa();
            MODProjetoPesquisa_Discente projetoDiscente = new MODProjetoPesquisa_Discente();

            if (!Page.IsPostBack)
            {
                projetoDiscente.FkDiscente = Convert.ToInt32(Page.Request.QueryString["discente"]);
                TxtProjeto.DataSource      = BLLDiscente.PesquisarProjeto(projetoDiscente, "discente");
                TxtProjeto.DataValueField  = "Id_projeto";
                TxtProjeto.DataTextField   = "Titulo";
                TxtProjeto.DataBind();

                discente.IdDiscente = Convert.ToInt32(Page.Request.QueryString["discente"]);
                discente            = BLLDiscente.PesquisarDiscente(discente, "id");


                TxtNome.Text = discente.Nome;
            }
        }
        protected void BtnAddDiscente_Click(object sender, EventArgs e)
        {
            MODProjetoPesquisa_Discente projetoDiscente = new MODProjetoPesquisa_Discente();
            MODDiscente discente = new MODDiscente();

            Control      botao = (Control)sender;
            RepeaterItem item  = (RepeaterItem)botao.Parent;

            Label  lbl    = (Label)item.FindControl("TxtNomeDiscente");
            string titulo = lbl.Text;

            discente.Nome = titulo;
            //grupoNome = titulo;

            discente = BLLDiscente.PesquisarDiscente(discente, "nome");

            idDiscente = discente.IdDiscente;
        }
Example #3
0
        public static void AlterarVinculoProjeto(MODProjetoPesquisa_Discente projetoDiscente)
        {
            Conexao.Abrir();

            MySqlCommand comando = new MySqlCommand();

            comando.Connection = Conexao.conexao;

            comando.CommandText = "UPDATE tblprojeto_discente SET data_fim = @data "
                                  + "WHERE fk_projeto = @projeto and fk_discente = @discente and data_fim is null";
            comando.Parameters.AddWithValue("@projeto", projetoDiscente.FkProjeto);
            comando.Parameters.AddWithValue("@discente", projetoDiscente.FkDiscente);
            comando.Parameters.AddWithValue("@data", projetoDiscente.DataFim);

            comando.ExecuteNonQuery();

            Conexao.Fechar();
        }
Example #4
0
        public static void InserirDiscenteProjeto(MODProjetoPesquisa_Discente projetoDiscente)
        {
            Conexao.Abrir();

            MySqlCommand comando = new MySqlCommand();

            comando.Connection = Conexao.conexao;

            comando.CommandText = "INSERT INTO TBLPROJETO_DISCENTE (fk_projeto, fk_discente, data_inicio) "
                                  + "VALUES (@fk_projeto, @fk_discente, @data_inicio)";
            comando.Parameters.AddWithValue("@fk_projeto", projetoDiscente.FkProjeto);
            comando.Parameters.AddWithValue("@fk_discente", projetoDiscente.FkDiscente);
            comando.Parameters.AddWithValue("@data_inicio", projetoDiscente.DataInicio);

            comando.ExecuteNonQuery();

            Conexao.Fechar();
        }
        protected void BtnVincularDiscente_Click(object sender, EventArgs e)
        {
            MODProjetoPesquisa_Discente projetoDiscente = new MODProjetoPesquisa_Discente();

            if (TxtDataInicio.Text.Trim() == "")
            {
                LblResposta.Text = Erros.DataVazio;
            }
            else
            {
                projetoDiscente.FkDiscente = idDiscente;
                projetoDiscente.FkProjeto  = idProjeto;
                projetoDiscente.DataInicio = Convert.ToDateTime(TxtDataInicio.Text.Trim());

                BLLDiscente.InserirDiscenteProjeto(projetoDiscente);

                LblResposta.Text = "Discente vinculado com sucesso!";
            }
        }
        protected void Desvincular_Click(object sender, EventArgs e)
        {
            MODProjetoPesquisa_Discente projetoDiscente = new MODProjetoPesquisa_Discente();

            if (TxtDataTermino.Text.Trim() == "")
            {
                LblResposta.Text = "A data de término nao pode ser nula!";
            }
            else
            {
                projetoDiscente.FkDiscente = Convert.ToInt32(Page.Request.QueryString["discente"]);
                projetoDiscente.FkProjeto  = Convert.ToInt32(TxtProjeto.SelectedValue);
                projetoDiscente.DataFim    = Convert.ToDateTime(TxtDataTermino.Text.Trim());

                BLLDiscente.AlterarVinculoProjeto(projetoDiscente);

                LblResposta.Text = "Discente desvinculado com sucesso!";
            }
        }
Example #7
0
        public static DataTable PesquisarProjeto(MODProjetoPesquisa_Discente projetoDiscente, string tipoPesquisa)
        {
            MySqlCommand comando = new MySqlCommand();

            Conexao.Abrir();
            comando.Connection = Conexao.conexao;

            if (tipoPesquisa == "discente")
            {
                comando.CommandText = "select p.id_projeto, p.titulo, pd.data_inicio, pd.data_fim from tblprojeto_pesquisa p "
                                      + "inner join tblprojeto_discente pd on pd.fk_projeto = p.id_projeto inner join tbldiscente d on pd.fk_discente = d.id_discente and pd.fk_discente = @discente and pd.data_fim is null";
                comando.Parameters.AddWithValue("@discente", projetoDiscente.FkDiscente);
            }

            comando.CommandType = CommandType.Text;
            MySqlDataAdapter da    = new MySqlDataAdapter(comando);
            DataTable        dados = new DataTable();

            da.Fill(dados);

            return(dados);
        }
 public static DataTable PesquisarProjeto(MODProjetoPesquisa_Discente projetoDiscente, string tipoPesquisa)
 {
     return(DALDiscente.PesquisarProjeto(projetoDiscente, tipoPesquisa));
 }
 public static void AlterarVinculoProjeto(MODProjetoPesquisa_Discente projetoDiscente)
 {
     DALDiscente.AlterarVinculoProjeto(projetoDiscente);
 }
 public static void InserirDiscenteProjeto(MODProjetoPesquisa_Discente projetoDiscente)
 {
     DALDiscente.InserirDiscenteProjeto(projetoDiscente);
 }