private void CarregaLinha() { if (ChkProjeto.Checked == false) { MODDocente_Linha_Pesquisa docenteLinha = new MODDocente_Linha_Pesquisa(); if (TxtGrupo.Text != "") { docenteLinha.FkGrupo = Convert.ToInt32(TxtGrupo.SelectedValue); docenteLinha.FkDocente = Convert.ToInt32(TxtDocente.SelectedValue); TxtLinha.DataSource = BLLDocente_Linha_Pesquisa.Pesquisar(docenteLinha, "docente"); TxtLinha.DataValueField = "id_linha"; TxtLinha.DataTextField = "nome_linha"; TxtLinha.DataBind(); } } else { MODProjetoPesquisa_Linha projetoLinha = new MODProjetoPesquisa_Linha(); if (TxtProjeto.Text != "") { projetoLinha.FkProjeto = Convert.ToInt32(TxtProjeto.SelectedValue); TxtLinha.DataSource = BLLProjeto_Pesquisa.PesquisarLinha(projetoLinha); TxtLinha.DataValueField = "id_linha"; TxtLinha.DataTextField = "nome_linha"; TxtLinha.DataBind(); } } }
protected void BtnCadastrar_Click(object sender, EventArgs e) { MODPublicacao publicacao = new MODPublicacao(); MODProjetoPesquisa_Linha projetoLinha = new MODProjetoPesquisa_Linha(); MODLinha_Pesquisa linhaPesquisa = new MODLinha_Pesquisa(); if (TxtTitulo.Text.Trim() == "") { LblResposta.Text = Erros.TituloVazio; } else if (TxtDataPublicacao.Text.Trim() == "") { LblResposta.Text = Erros.DataVazio; } else if (TxtReferencia.Text.Trim() == "") { LblLiderExiste.Text = "O campo referência ABNT é obrigatório!"; } else { publicacao.Titulo = TxtTitulo.Text.Trim(); publicacao.TipoPublicacao = TxtTipoPublicacao.Text.Trim(); publicacao.DataPublicacao = Convert.ToDateTime(TxtDataPublicacao.Text.Trim()); publicacao.ReferenciaABNT = TxtReferencia.Text.Trim(); publicacao.FkGrupo = Convert.ToInt32(TxtGrupo.SelectedValue); publicacao.FkDocente = Convert.ToInt32(TxtDocente.SelectedValue); publicacao.FkLinha = Convert.ToInt32(TxtLinha.SelectedValue); if (ChkProjeto.Checked == true) { if (TxtProjeto.Text == "") { LblResposta.Text = "Não há projetos de pesquisa nesse grupo!"; } else { publicacao.FKProjeto = Convert.ToInt32(TxtProjeto.SelectedValue); BLLPublicacao.Inserir(publicacao); LblResposta.Text = "Publicação cadastrada com sucesso!"; } } else { BLLPublicacao.Inserir(publicacao); LblResposta.Text = "Publicação cadastrada com sucesso!"; } } }
public static void InserirLinha(MODProjetoPesquisa_Linha projetoLinha) { Conexao.Abrir(); MySqlCommand comando = new MySqlCommand(); comando.Connection = Conexao.conexao; comando.CommandText = "INSERT INTO TBLProjeto_linha_pesquisa (fk_projeto, fk_linha)" + " VALUES (@fk_projeto, @fk_linha)"; comando.Parameters.AddWithValue("@fk_projeto", projetoLinha.FkProjeto); comando.Parameters.AddWithValue("@fk_linha", projetoLinha.FkLinha); comando.ExecuteNonQuery(); Conexao.Fechar(); }
public static DataTable PesquisarLinha(MODProjetoPesquisa_Linha projetoLinha) { MySqlCommand comando = new MySqlCommand(); Conexao.Abrir(); comando.Connection = Conexao.conexao; comando.CommandText = "select l.id_linha, l.nome_linha from tbllinha_pesquisa l " + "inner join tblprojeto_linha_pesquisa pl on pl.fk_linha = l.id_linha " + "inner join tblprojeto_pesquisa p on pl.fk_projeto = p.id_projeto and pl.fk_projeto = @projeto"; comando.Parameters.AddWithValue("@projeto", projetoLinha.FkProjeto); comando.CommandType = CommandType.Text; MySqlDataAdapter da = new MySqlDataAdapter(comando); DataTable dados = new DataTable(); da.Fill(dados); return(dados); }
public static DataTable PesquisarLinha(MODProjetoPesquisa_Linha projetoLinha) { return(DALProjeto_Pesquisa.PesquisarLinha(projetoLinha)); }
public static void InserirLinha(MODProjetoPesquisa_Linha projetoLinha) { DALProjeto_Pesquisa.InserirLinha(projetoLinha); }
protected void BtnCadastrar_Click(object sender, EventArgs e) { MODProjetoPesquisa projetoPesquisa = new MODProjetoPesquisa(); MODProjetoPesquisa_Linha projetoLinha = new MODProjetoPesquisa_Linha(); MODLinha_Pesquisa linhaPesquisa = new MODLinha_Pesquisa(); bool existeLinha = false; if (TxtNome.Text.Trim() == "") { LblResposta.Text = Erros.TituloVazio; } else if (TxtDataInicio.Text.Trim() == "") { LblResposta.Text = Erros.DataVazio; } else if (TxtDocenteLider.Text.Trim() == "") { LblLiderExiste.Text = "Não há lider vínculado nesse grupo!"; } else { foreach (RepeaterItem dli in RptLinhas.Items) { if (dli.ItemType == ListItemType.Item || dli.ItemType == ListItemType.AlternatingItem) { DropDownList ddl = (DropDownList)dli.FindControl("DdlAddLinha"); if (ddl.Text == "Sim") { existeLinha = true; } } } if (existeLinha == false) { LblResposta.Text = "O Projeto deve ter pelo menos uma linha de pesquisa!"; } else { projetoPesquisa.FkGrupo = idGrupo; projetoPesquisa.FkDocente = Convert.ToInt32(TxtDocenteLider.SelectedValue); projetoPesquisa.Titulo = TxtNome.Text.Trim(); projetoPesquisa.Tipo = TxtTipoProjeto.Text.Trim(); if (TxtTipoProjeto.Text.Trim() == "Bolsa") { projetoPesquisa.Bolsa = TxtTipoBolsa.Text.Trim(); } if (TxtTipoBolsa.Text.Trim() == "Outra") { projetoPesquisa.NomeBolsa = TxtNomeBolsa.Text.Trim(); } projetoPesquisa.DataInicio = Convert.ToDateTime(TxtDataInicio.Text.Trim()); idProjeto = BLLProjeto_Pesquisa.Inserir(projetoPesquisa); } foreach (RepeaterItem dli in RptLinhas.Items) { if (dli.ItemType == ListItemType.Item || dli.ItemType == ListItemType.AlternatingItem) { DropDownList ddl = (DropDownList)dli.FindControl("DdlAddLinha"); if (ddl.Text == "Sim") { Label lbl = (Label)dli.FindControl("TxtNomeLinha"); string titulo = lbl.Text; linhaPesquisa.Linha = titulo; linhaPesquisa = BLLLinha_Pesquisa.PesquisarLinha(linhaPesquisa, "nome"); projetoLinha.FkLinha = linhaPesquisa.Id; projetoLinha.FkProjeto = idProjeto; BLLProjeto_Pesquisa.InserirLinha(projetoLinha); LblResposta.Text = "Projeto cadastrado com sucesso!"; } } } } }