public TiposIdentificadores TiposIdentificadoresGetById(string Id) { try { DataSet ds = new DataSet(); Conexion oConexion = new Conexion(); OracleConnection cn = oConexion.getConexion(); cn.Open(); string sqlSelect = "SELECT * FROM tipos_identificadores " + "WHERE tid_codigo='" + Id + "'"; cmd = new OracleCommand(sqlSelect, cn); adapter = new OracleDataAdapter(cmd); cmd.ExecuteNonQuery(); adapter.Fill(ds); DataTable dt; dt = ds.Tables[0]; TiposIdentificadores NewEnt = new TiposIdentificadores(); if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; NewEnt = CargarTiposIdentificadores(dr); } return(NewEnt); } catch (Exception ex) { throw ex; } }
public List <TiposIdentificadores> TiposIdentificadoresGetAll() { List <TiposIdentificadores> lstTiposIdentificadores = new List <TiposIdentificadores>(); try { ds = new DataSet(); Conexion oConexion = new Conexion(); OracleConnection cn = oConexion.getConexion(); cn.Open(); string sqlSelect = "SELECT * FROM tipos_identificadores "; cmd = new OracleCommand(sqlSelect, cn); adapter = new OracleDataAdapter(cmd); cmd.ExecuteNonQuery(); adapter.Fill(ds); DataTable dt = new DataTable(); dt = ds.Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; dt.Rows.Count > i; i++) { DataRow dr = dt.Rows[i]; TiposIdentificadores NewEnt = new TiposIdentificadores(); NewEnt = CargarTiposIdentificadores(dr); lstTiposIdentificadores.Add(NewEnt); } } return(lstTiposIdentificadores); } catch (Exception ex) { throw ex; } }
private void CargarTipoDni(string id) { TiposIdentificadores oTipoDoc = new TiposIdentificadores(); TiposIdentificadoresBus oTiposDocsBus = new TiposIdentificadoresBus(); oTipoDoc = oTiposDocsBus.TiposIdentificadoresGetById(id); _vista.strTipoDoc = oTipoDoc.TidCodigo; }
private TiposIdentificadores CargarTiposIdentificadores(DataRow dr) { try { TiposIdentificadores oObjeto = new TiposIdentificadores(); oObjeto.TidCodigo = dr["TID_CODIGO"].ToString(); oObjeto.TidDescripcion = dr["TID_DESCRIPCION"].ToString(); oObjeto.TidDescripcionCorta = dr["TID_DESCRIPCION_CORTA"].ToString(); oObjeto.TidCodigoAfip = dr["TID_CODIGO_AFIP"].ToString(); return(oObjeto); } catch (Exception ex) { throw ex; } }
// POST: api/Endereco public IHttpActionResult TiposIdentificadores([FromBody] TiposIdentificadores tipos_identificadores) { if (autenticar.autenticacao(Request, 3) == null) { return(Content(HttpStatusCode.Unauthorized, "Credenciais Invalidas ou Ausentes!")); } TiposIdentificadores tid = new TiposIdentificadores(); tid.Tid_titulo = tipos_identificadores.Tid_titulo; if (TiposIdentificadoresDB.Insert(tid) == 0) { return(Ok()); } else { return(BadRequest()); return(Content(HttpStatusCode.Unauthorized, "Credenciais Invalidas ou Ausentes!")); } }
public static int Insert(TiposIdentificadores tid) { int retorno = 0; try { IDbConnection objConexao; // Abre a conexao IDbCommand objCommand; // Cria o comando string sql = "INSERT INTO tipos_identificadores(tid_codigo, tid_titulo) VALUES(?tid_codigo, ?tid_titulo)"; objConexao = Mapped.Connection(); objCommand = Mapped.Command(sql, objConexao); objCommand.Parameters.Add(Mapped.Parameter("?tid_codigo", tid.Tid_codigo)); objCommand.Parameters.Add(Mapped.Parameter("?tid_titulo", tid.Tid_titulo)); objCommand.ExecuteNonQuery(); // utilizado quando cdigo não tem retorno, como seria o caso do SELECT objConexao.Close(); objCommand.Dispose(); objConexao.Dispose(); } catch (Exception e) { retorno = -2; } return(retorno); }
public bool TiposIdentificadoresUpdate(TiposIdentificadores oTid) { try { Conexion oConexion = new Conexion(); OracleConnection cn = oConexion.getConexion(); cn.Open(); ds = new DataSet(); cmd = new OracleCommand("UPDATE tipos_identificadores " + "SET tid_descripcion='" + oTid.TidDescripcion + "', " + "tid_descripcion_corta='" + oTid.TidDescripcionCorta + "', " + "tid_codigo_afip='" + oTid.TidCodigoAfip + "' " + "WHERE tid_codigo='" + oTid.TidCodigo + "'", cn); adapter = new OracleDataAdapter(cmd); response = cmd.ExecuteNonQuery(); cn.Close(); return(response > 0); } catch (Exception ex) { throw ex; } }
public int TiposIdentificadoresAdd(TiposIdentificadores oTid) { try { Conexion oConexion = new Conexion(); OracleConnection cn = oConexion.getConexion(); cn.Open(); //Clave ds = new DataSet(); cmd = new OracleCommand("INSERT INTO tipos_identificadores(tid_codigo, tid_descripcion, " + "tid_descripcion_corta, tid_codigo_afip) " + "VALUES('" + oTid.TidCodigo + "','" + oTid.TidDescripcion + "','" + oTid.TidDescripcionCorta + "','" + oTid.TidCodigoAfip + "')", cn); adapter = new OracleDataAdapter(cmd); response = cmd.ExecuteNonQuery(); cn.Close(); return(response); } catch (Exception ex) { throw ex; } }
public bool TiposIdentificadoresUpdate(TiposIdentificadores oTiposIdentificadores) { TiposIdentificadoresImpl oTiposIdentificadoresImpl = new TiposIdentificadoresImpl(); return(oTiposIdentificadoresImpl.TiposIdentificadoresUpdate(oTiposIdentificadores)); }
public int TiposIdentificadoresAdd(TiposIdentificadores oTiposIdentificadores) { TiposIdentificadoresImpl oTiposIdentificadoresImpl = new TiposIdentificadoresImpl(); return(oTiposIdentificadoresImpl.TiposIdentificadoresAdd(oTiposIdentificadores)); }