//select public ItensPedido Select(string codigo) { ItensPedido obj = null; System.Data.IDbConnection objConexao; System.Data.IDbCommand objCommand; System.Data.IDataReader objDataReader; objConexao = Mapped.Connection(); objCommand = Mapped.Command("SELECT * FROM ite_itenspedido WHERE ite_guid = ?codigo", objConexao); objCommand.Parameters.Add(Mapped.Parameter("?codigo", codigo)); objDataReader = objCommand.ExecuteReader(); while (objDataReader.Read()) { obj = new ItensPedido(); obj.Status = Convert.ToString(objDataReader["ite_status"]); } objDataReader.Close(); objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); objDataReader.Dispose(); return(obj); }
public static DataSet SelectLOGIN(usu_usuario usu) { DataSet ds = new DataSet(); IDbConnection objConexao; IDbCommand objCommand; IDataAdapter objDataAdapter; string sql = "select usu_id, usu_email, usu_senha, usu_tipo, pes_nome from usu_usuario usu inner join pes_pessoa pes on pes.pes_id = usu.pes_id where usu_email = ?usu_email and usu_senha = ?usu_senha"; objConexao = Mapped.Connection(); objCommand = Mapped.Command(sql, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?usu_email", usu.Usu_email)); objCommand.Parameters.Add(Mapped.Parameter("?usu_senha", usu.Usu_senha)); objDataAdapter = Mapped.Adapter(objCommand); objDataAdapter.Fill(ds); objConexao.Close(); objConexao.Dispose(); objCommand.Dispose(); return(ds); }
//update public bool Update(Area area) { System.Data.IDbConnection objConexao; System.Data.IDbCommand objCommand; string sql = "UPDATE are_area SET are_nome = ?are_nome, lof_id = ?lof_id, tis_id = ?tis_id WHERE are_id = ?are_id"; try { objConexao = Mapped.Connection(); objCommand = Mapped.Command(sql, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?are_nome", area.Nome)); objCommand.Parameters.Add(Mapped.Parameter("?lof_id", area.Local.Id)); objCommand.Parameters.Add(Mapped.Parameter("?tis_id", area.Tipo_solo.Id)); objCommand.Parameters.Add(Mapped.Parameter("?are_id", area.Id)); objCommand.ExecuteNonQuery(); objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); return(true); }catch (Exception e) { return(false); } }
public int Delete(int codigo) { int retorno = 0; try { IDbConnection objConexao; IDbCommand objcommand; String sql = "delete from que_questionarios where que_codidgo = ?que_codigo"; objConexao = Mapped.Connection(); objcommand = Mapped.Command(sql, objConexao); objcommand.Parameters.Add(Mapped.Parameter("?que_codigo", codigo)); objcommand.ExecuteNonQuery(); objConexao.Close(); objcommand.Dispose(); objConexao.Dispose(); } catch (Exception e) { retorno = -2; } return(retorno); }
public int Update(DTOPostagem postagem) { int errNumber = 0; try { IDbConnection objConnnexao; IDbCommand objCommand; string sql = "UPDATE tbl_postagem SET tip_id = ?tipo, pos_data = ?data, pos_titulo = ?titulo, pos_conteudo = ?conteudo WHERE Pos_id = ?codigo and pos_ativo = true"; //recebendo a conexão e executando o cmd objConnnexao = Mapped.Connection(); objCommand = Mapped.Command(sql, objConnnexao); //atribuindo os parametros da string sql objCommand.Parameters.Add(Mapped.Parameter("?codigo", postagem.PostagemId)); objCommand.Parameters.Add(Mapped.Parameter("?tipo", postagem.TipoPostagem.TipoPostagemId)); objCommand.Parameters.Add(Mapped.Parameter("?data", postagem.DataPostagem)); objCommand.Parameters.Add(Mapped.Parameter("?titulo", postagem.Titulo)); objCommand.Parameters.Add(Mapped.Parameter("?conteudo", postagem.Conteudo)); //objCommand.Parameters.Add(Mapped.Parameter("?usuario", postagem.Usuario.UsuarioId)); objCommand.ExecuteNonQuery(); objConnnexao.Close(); //abrindo novamente conexão objConnnexao.Dispose(); objCommand.Dispose(); }//try catch (Exception ex) { errNumber = -2; } return(errNumber); }//metodo update
//INSERE UM NOVO FORNECEDOR NO BANCO DE DADOS public bool Insert(Supplier supplier) { System.Data.IDbConnection objConn; System.Data.IDbCommand objCommand; string sql = "INSERT INTO fornecedor(for_nome, for_cnpj, for_email, for_cidade, for_uf)" + "VALUES (?name, ?cnpj, ?email, ?city, ?uf);"; objConn = Mapped.Connection(); objCommand = Mapped.Command(sql, objConn); objCommand.Parameters.Add(Mapped.Parameter("?name", supplier.Name)); objCommand.Parameters.Add(Mapped.Parameter("?cnpj", supplier.CNPJ)); objCommand.Parameters.Add(Mapped.Parameter("?email", supplier.Email)); objCommand.Parameters.Add(Mapped.Parameter("?city", supplier.City)); objCommand.Parameters.Add(Mapped.Parameter("?uf", supplier.UF)); objCommand.ExecuteNonQuery(); objConn.Close(); objCommand.Dispose(); objConn.Dispose(); return(true); }
//update public bool Update(Espetos espeto) { System.Data.IDbConnection objConexao; System.Data.IDbCommand objCommand; string sql = "UPDATE tbl_espetos SET esp_nome=?nome, esp_valor=?valor, esp_quantidade=?quantidade, esp_entradadia=?entradadia WHERE esp_id=?id"; objConexao = Mapped.Connection(); objCommand = Mapped.Command(sql, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?nome", espeto.Nome)); objCommand.Parameters.Add(Mapped.Parameter("?valor", espeto.Valor)); objCommand.Parameters.Add(Mapped.Parameter("?quantidade", espeto.Quantidade)); objCommand.Parameters.Add(Mapped.Parameter("?entradadia", espeto.Entradadia)); objCommand.Parameters.Add(Mapped.Parameter("?id", espeto.Codigo)); objCommand.ExecuteNonQuery(); objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); return(true); }
public static DataSet procurarUsuarioPorEmpresa(int emp_id) { DataSet ds = new DataSet(); IDbConnection objConexao; IDbCommand objCommand; IDataAdapter dataAdapter; objConexao = Mapped.Connection(); string query = "SELECT usu_id, usu_nome, usu_email, tus_id, set_id, usu_statususuario from usuario WHERE emp_id = ?emp_id and tus_id <> '3' order by usu_nome"; objCommand = Mapped.Command(query, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?emp_id", emp_id)); dataAdapter = Mapped.Adapter(objCommand); dataAdapter.Fill(ds); objConexao.Close(); objConexao.Dispose(); objCommand.Dispose(); return(ds); }
public TipoSolo Select(int id) { TipoSolo obj = null; System.Data.IDbConnection objConexao; System.Data.IDbCommand objCommand; System.Data.IDataReader objDataReader; objConexao = Mapped.Connection(); objCommand = Mapped.Command("SELECT * FROM tic_tipo_cultivo WHERE tic_id = ?tic_id", objConexao); objCommand.Parameters.Add(Mapped.Parameter("?tic_id", id)); objDataReader = objCommand.ExecuteReader(); while (objDataReader.Read()) { obj = new TipoSolo(); obj.Nome = Convert.ToString(objDataReader["tis_nome"]); obj.Acidez = Convert.ToDouble(objDataReader["tis_acidez"]); } objDataReader.Close(); objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); objDataReader.Dispose(); return(obj); }
public static string procurarNomeUsuario(int usu_id) { DataSet ds = new DataSet(); IDbConnection objConexao; IDbCommand objCommand; IDataAdapter dataAdapter; objConexao = Mapped.Connection(); string query = "SELECT usu_nome from usuario WHERE usu_id = ?usu_id"; objCommand = Mapped.Command(query, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?usu_id", usu_id)); dataAdapter = Mapped.Adapter(objCommand); dataAdapter.Fill(ds); objConexao.Close(); objConexao.Dispose(); objCommand.Dispose(); return(ds.Tables[0].Rows[0]["usu_nome"].ToString()); }
public static DataSet procurarUsuarioPorEmail(string usu_email) { DataSet ds = new DataSet(); IDbConnection objConexao; IDbCommand objCommand; IDataAdapter dataAdapter; objConexao = Mapped.Connection(); string query = "SELECT * from usuario WHERE usu_email = ?usu_email"; objCommand = Mapped.Command(query, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?usu_email", usu_email)); dataAdapter = Mapped.Adapter(objCommand); dataAdapter.Fill(ds); objConexao.Close(); objConexao.Dispose(); objCommand.Dispose(); return(ds); }
public int Delete(int codigo) { int retorno = 0; try { IDbConnection objConexao; IDbCommand objcommand; String sql = "CALL alt_delete (?alt_codigo)"; objConexao = Mapped.Connection(); objcommand = Mapped.Command(sql, objConexao); objcommand.Parameters.Add(Mapped.Parameter("?alt_codigo", codigo)); objcommand.ExecuteNonQuery(); objConexao.Close(); objcommand.Dispose(); objConexao.Dispose(); } catch (Exception e) { retorno = -2; } return(retorno); }
/*public DataSet SelectCount() * { * DataSet ds = new DataSet(); * * System.Data.IDbConnection objConexao; * System.Data.IDbCommand objCommand; * System.Data.IDataAdapter objDataAdapter; * objConexao = Mapped.Connection(); * objCommand = Mapped.Command("SELECT COUNT(*) AS total FROM ped_pedido", objConexao); * objDataAdapter = Mapped.Adapter(objCommand); * objDataAdapter.Fill(ds); * objConexao.Close(); * objCommand.Dispose(); * objConexao.Dispose(); * return ds; * }*/ //select public ItensPedido Select(string id) { ItensPedido obj = null; System.Data.IDbConnection objConexao; System.Data.IDbCommand objCommand; System.Data.IDataReader objDataReader; objConexao = Mapped.Connection(); objCommand = Mapped.Command("SELECT * FROM ite_itenspedido WHERE ite_guid = ?codigo", objConexao); objCommand.Parameters.Add(Mapped.Parameter("?codigo", id)); objDataReader = objCommand.ExecuteReader(); while (objDataReader.Read()) { obj.Produto = Convert.ToString(objDataReader["ite_produto"]); obj.Quantidade = Convert.ToInt32(objDataReader["ite_quantidade"]); } objDataReader.Close(); objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); objDataReader.Dispose(); return(obj); }
}//insert public List <DTOTipoPostagem> SelectAll() { List <DTOTipoPostagem> tipopostagens = new List <DTOTipoPostagem>(); IDbConnection objConexao; IDbCommand objCommand; IDataReader objDataReader; try { objConexao = Mapped.Connection(); string sql = "SELECT * FROM tbl_tipopostagem"; objCommand = Mapped.Command(sql, objConexao); objDataReader = objCommand.ExecuteReader(); while (objDataReader.Read()) { DTOTipoPostagem tipopostagem = new DTOTipoPostagem(); tipopostagem.TipoPostagemId = Convert.ToInt32(objDataReader["tip_id"]); tipopostagem.Tipo = Convert.ToString(objDataReader["tip_tipo"]); tipopostagens.Add(tipopostagem); } objConexao.Close(); objConexao.Dispose(); objCommand.Dispose(); return(tipopostagens); } catch (Exception) { throw new Exception("Ocorreu um erro ao selecionar os dados de tipoPostagems."); } }
public static int Update(int cod) { int retorno = 0; try { IDbConnection conexao; IDbCommand objCommand; string sql = "UPDATE gru_grupo SET gru_finalizado = 0 WHERE gru_codigo = ?codigo "; conexao = Mapped.Connection(); objCommand = Mapped.Command(sql, conexao); objCommand.Parameters.Add(Mapped.Parameter("?codigo", cod)); objCommand.ExecuteNonQuery(); conexao.Close(); objCommand.Dispose(); conexao.Dispose(); } catch (Exception e) { string erro = e.Message; retorno = -2; } return(retorno); }
//update public bool Update(TipoSolo tipo) { System.Data.IDbConnection objConexao; System.Data.IDbCommand objCommand; string sql = "UPDATE tis_tipo_solo SET tis_nome = ?tis_nome, tis_acidez = ?tis_acidez WHERE tis_id = ?tis_id"; try { objConexao = Mapped.Connection(); objCommand = Mapped.Command(sql, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?tis_nome", tipo.Nome)); objCommand.Parameters.Add(Mapped.Parameter("?tis_acidez", tipo.Acidez)); objCommand.Parameters.Add(Mapped.Parameter("?tis_id", tipo.Id)); objCommand.ExecuteNonQuery(); objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); return(true); } catch (Exception e) { return(false); } }
public static int Insert(sco_servicoscondutor sco) { int retorno = 0; try { //Correto IDbConnection objConexao; //Abrir a conexão IDbCommand objCommand; // Criar e executar os comandos string sql = "insert into sco_servicocondutor "; sql += "(con_id, ser_id)"; sql += "values "; sql += "(?con_id, ?ser_id)"; objConexao = Mapped.Connection(); objCommand = Mapped.Command(sql, objConexao); // Chave estrangeira objCommand.Parameters.Add(Mapped.Parameter("?con_id", sco.Con_id.Con_id)); objCommand.Parameters.Add(Mapped.Parameter("?ser_id", sco.Ser_id.Ser_id)); objCommand.ExecuteNonQuery(); objConexao.Close(); objConexao.Dispose(); objCommand.Dispose(); } catch (Exception) { //erro retorno = -2; } return(retorno); }
//select public Pedidodetalhe Select(int id) { Pedidodetalhe obj = null; System.Data.IDbConnection objConexao; System.Data.IDbCommand objCommand; System.Data.IDataReader objDataReader; objConexao = Mapped.Connection(); objCommand = Mapped.Command("SELECT * FROM tbl_detalhe WHERE det_registro = ?registro", objConexao); objCommand.Parameters.Add(Mapped.Parameter("?registro", id)); objDataReader = objCommand.ExecuteReader(); while (objDataReader.Read()) { obj = new Pedidodetalhe(); obj.Produto = Convert.ToString(objDataReader["det_produto"]); obj.Quantidade = Convert.ToDouble(objDataReader["det_quantidade"]); } objDataReader.Close(); objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); objDataReader.Dispose(); return(obj); }
//insert public bool Insert(Usuarios usuario) { System.Data.IDbConnection objConexao; System.Data.IDbCommand objCommand; string sql = "INSERT INTO tbl_usuario(usu_nome, usu_email, usu_login, usu_tipo, usu_ativo, usu_senha, usu_priacesso) VALUES (?nome, ?email, ?login, ?tipo, ?ativo, ?senha, ?priacesso)"; objConexao = Mapped.Connection(); objCommand = Mapped.Command(sql, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?nome", usuario.Nome)); objCommand.Parameters.Add(Mapped.Parameter("?email", usuario.Email)); objCommand.Parameters.Add(Mapped.Parameter("?login", usuario.Login)); objCommand.Parameters.Add(Mapped.Parameter("?tipo", usuario.Tipo)); objCommand.Parameters.Add(Mapped.Parameter("?ativo", usuario.Ativo)); objCommand.Parameters.Add(Mapped.Parameter("?senha", usuario.Senha)); objCommand.Parameters.Add(Mapped.Parameter("?priacesso", usuario.PriAcesso)); objCommand.ExecuteNonQuery(); objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); return(true); }
public static int Delete(int id) { int retorno = 0; try { IDbConnection objConexao; IDbCommand objCommand; string sql = "DELETE FROM ava_avaliacao WHERE ava_codigo = ?ava_codigo"; objConexao = Mapped.Connection(); objCommand = Mapped.Command(sql, objConexao); objCommand.Parameters.Add(Mapped.Parameter("ava_codigo", id)); objCommand.ExecuteNonQuery(); objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); } catch (Exception e) { retorno = -2; } return(retorno); }
public int Update(Que_questionarios questionarios) { int retorno = 0; try { IDbConnection objConexao; IDbCommand objcommand; String sql = "update que_questionarios set"; sql += "que_pontos= ?que_pontos"; sql += "que_inicio= ?que_inicio"; sql += "que_fim= ?que_fim"; sql += "modCla= ?_modCla";//? sql += "where que_codigo = ?que_codigo"; objConexao = Mapped.Connection(); objcommand = Mapped.Command(sql, objConexao); objcommand.Parameters.Add(Mapped.Parameter("?que_pontos", questionarios.PontoQuestionario)); objcommand.Parameters.Add(Mapped.Parameter("?que_inicio", questionarios.InicioQuestionario)); objcommand.Parameters.Add(Mapped.Parameter("?que_fim", questionarios.FimQuestionario)); objcommand.Parameters.Add(Mapped.Parameter("?que_codigo", questionarios.CodigoQuestionario)); objcommand.Parameters.Add(Mapped.Parameter("?_modCla", questionarios.ModCla));//? objcommand.ExecuteNonQuery(); objConexao.Close(); objcommand.Dispose(); objConexao.Dispose(); } catch (Exception e) { retorno = -2; } return(retorno); }
public static int Insert(Hsp_Historico_Pessoa historico) { int retorno = 0; try { IDbConnection objConexao; IDbCommand objCommand; string sql = "INSERT INTO hsp_historico_pessoa (hsp_codigo, pes_codigo) VALUES (?hsp_codigo, ?pes_codigo)"; objConexao = Mapped.Connection(); objCommand = Mapped.Command(sql, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?hst_codigo", historico.Hst_codigo)); objCommand.Parameters.Add(Mapped.Parameter("?pes_codigo", historico.Pes_codigo)); objCommand.ExecuteNonQuery(); objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); } catch (Exception e) { retorno = -2; } return(retorno); }
public static int Insert(Disciplinas_Gerais disciplina) { int retorno = 0; try { IDbConnection conexao; IDbCommand objCommand; string sql = "INSERT INTO dge_disciplinas_gerais(dge_codigo, dge_nome, dge_sigla) VALUES (?dge_codigo, ?dge_nome, ?dge_sigla)"; conexao = Mapped.Connection(); objCommand = Mapped.Command(sql, conexao); objCommand.Parameters.Add(Mapped.Parameter("?dge_codigo", disciplina.Dge_codigo)); objCommand.Parameters.Add(Mapped.Parameter("?dge_nome", disciplina.Dge_nome)); objCommand.Parameters.Add(Mapped.Parameter("?dge_sigla", disciplina.Dge_sigla)); conexao.Close(); objCommand.Dispose(); conexao.Dispose(); } catch (Exception e) { retorno = -2; } return(retorno); }
public static DataSet procurarUsuariosPlacarGeral(int emp_id) { DataSet ds = new DataSet(); IDbConnection objConexao; IDbCommand objCommand; IDataAdapter dataAdapter; objConexao = Mapped.Connection(); string query = "SELECT usu_nome, usu_qtdPontos from usuario WHERE emp_id = ?emp_id AND tus_id <> '3' order by usu_qtdpontos desc"; objCommand = Mapped.Command(query, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?emp_id", emp_id)); dataAdapter = Mapped.Adapter(objCommand); dataAdapter.Fill(ds); objConexao.Close(); objConexao.Dispose(); objCommand.Dispose(); return(ds); }
public static int Insert(usu_usuario usu) { int retorno = 0; try { //Correto IDbConnection objConexao; //Abrir a conexão IDbCommand objCommand; // Criar e executar os comandos string sql = "insert into usu_usuario "; sql += "(usu_email, usu_senha, usu_tipo, pes_id)"; sql += "values "; sql += "(?usu_email, ?usu_senha, ?usu_tipo, ?pes_id)"; objConexao = Mapped.Connection(); objCommand = Mapped.Command(sql, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?usu_email", usu.Usu_email)); objCommand.Parameters.Add(Mapped.Parameter("?usu_senha", usu.Usu_senha)); objCommand.Parameters.Add(Mapped.Parameter("?usu_tipo", usu.Usu_tipo)); // Chave estrangeira objCommand.Parameters.Add(Mapped.Parameter("?pes_id", usu.Pes_id.Pes_id)); objCommand.ExecuteNonQuery(); objConexao.Close(); objConexao.Dispose(); objCommand.Dispose(); } catch (Exception) { //erro retorno = -2; } return(retorno); }
public static DataSet procurarUsuariosPlacarMensal(int emp_id) { DataSet ds = new DataSet(); IDbConnection objConexao; IDbCommand objCommand; IDataAdapter dataAdapter; objConexao = Mapped.Connection(); string query = "SELECT SUM(mis.mis_qtd_pontos) as usu_qtdPontos, usu.usu_nome as usu_nome FROM missao_usuario mus JOIN missao mis ON mis.mis_id = mus.mis_id JOIN usuario usu ON usu.usu_id = mus.usu_id WHERE usu.emp_id = ?emp_id AND MONTH(mus.mus_dt_conclusao) = MONTH(SYSDATE()) GROUP BY usu.usu_id ORDER BY usu_qtdPontos desc"; objCommand = Mapped.Command(query, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?emp_id", emp_id)); dataAdapter = Mapped.Adapter(objCommand); dataAdapter.Fill(ds); objConexao.Close(); objConexao.Dispose(); objCommand.Dispose(); return(ds); }
public Categoria SelectID(int cat) { Categoria cate = null; System.Data.IDbConnection objConexao; System.Data.IDbCommand objCommand; System.Data.IDataReader objDataReader; objConexao = Mapped.Connection(); objCommand = Mapped.Command("SELECT * FROM cat_categorias WHERE cat_codigo = ?cat", objConexao); objCommand.Parameters.Add(Mapped.Parameter("?cat", cat)); objDataReader = objCommand.ExecuteReader(); while (objDataReader.Read()) { cate = new Categoria(); cate.Cat_codigo = Convert.ToInt32(objDataReader["cat_codigo"]); cate.Cat_nome = Convert.ToString(objDataReader["cat_nome"]); } objDataReader.Close(); objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); objDataReader.Dispose(); return(cate); }
//INSERE UM NOVO ORCAMENTO NO BANCO DE DADOS public bool Insert(RequestItem requestItem) { System.Data.IDbConnection objConn; System.Data.IDbCommand objCommand; string sql = "INSERT INTO pedido_item(pei_descricao, pei_tipo, pei_quantidade, pei_preco_uni, ped_id)" + "VALUES (?desc, ?type_of_item, ?qty, ?price, ?ped_id);"; objConn = Mapped.Connection(); objCommand = Mapped.Command(sql, objConn); objCommand.Parameters.Add(Mapped.Parameter("?desc", requestItem.Desc)); objCommand.Parameters.Add(Mapped.Parameter("?type_of_item", requestItem.TypeOfItem)); objCommand.Parameters.Add(Mapped.Parameter("?qty", requestItem.Qty)); objCommand.Parameters.Add(Mapped.Parameter("?price", requestItem.Price)); objCommand.Parameters.Add(Mapped.Parameter("?ped_id", requestItem.PedId)); objCommand.ExecuteNonQuery(); objConn.Close(); objCommand.Dispose(); objConn.Dispose(); return(true); }
public Tipo_usuario Select(int tip_codigo) { Tipo_usuario tipo = null; System.Data.IDbConnection objConexao; System.Data.IDbCommand objCommand; System.Data.IDataReader objDataReader; objConexao = Mapped.Connection(); objCommand = Mapped.Command("SELECT * FROM tip_tipo WHERE tip_codigo = ?tip_codigo", objConexao); objCommand.Parameters.Add(Mapped.Parameter("?tip_codigo", tip_codigo)); objDataReader = objCommand.ExecuteReader(); while (objDataReader.Read()) { tipo = new Tipo_usuario(); tipo.Tip_codigo = Convert.ToInt32(objDataReader["tip_codigo"]); tipo.Tip_nome_tipo = Convert.ToString(objDataReader["tip_nome_tipo"]); } objDataReader.Close(); objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); objDataReader.Dispose(); return(tipo); }
public static int Insert(Mod_modelos modelos) { int retorno = 0; try { IDbConnection objConexao; IDbCommand objcommand; String sql = "insert into Mod_modelos "; sql += "eve_nome, mod_codigo, mod_nome, mod_tipo, mod_ativo, mod_editar, eve_codigo"; // variável questão?? sql += "values (?eve_nome, ?mod_codigo, ?mod_nome, ?mod_tipo, ?mod_ativo, ?mod_editar, ?eve_codigo )"; objConexao = Mapped.Connection(); objcommand = Mapped.Command(sql, objConexao); objcommand.Parameters.Add(Mapped.Parameter("?eve_nome", modelos.EventoNome)); objcommand.Parameters.Add(Mapped.Parameter("?mod_codigo", modelos.CodigoModelo)); objcommand.Parameters.Add(Mapped.Parameter("?mod_nome", modelos.NomeModelo)); objcommand.Parameters.Add(Mapped.Parameter("?mod_tipo", modelos.TipoModelo)); objcommand.Parameters.Add(Mapped.Parameter("?mod_ativo", modelos.AtivoModelo)); objcommand.Parameters.Add(Mapped.Parameter("?mod_editar", modelos.EditarModelo)); objcommand.Parameters.Add(Mapped.Parameter("?eve_codigo", modelos.EventoCodigo)); objcommand.ExecuteNonQuery(); objConexao.Close(); objcommand.Dispose(); objConexao.Dispose(); } catch (Exception e) { retorno = -2; } return(retorno); }