public bool GetById(int id) { string Statement = string.Format("select * from t08_notas_abonos where t08_pk01 = '{0}'", id); MySqlDataReader data = null; bool result = false; try { data = DBMysql_.DoQuery(Statement); if (data.HasRows) { while (data.Read()) { Id = data.IsDBNull(0) ? 0 : (int)data.GetUInt32(0); Id_pedido = data.IsDBNull(1) ? 0 : data.GetInt32(1); Total = data.IsDBNull(2) ? 0 : data.GetDouble(2); Id_invercionista = data.IsDBNull(3) ? 0 : data.GetInt32(3); Created = data.IsDBNull(4) ? DateTime.Now : data.GetDateTime(4); Updated = data.IsDBNull(5) ? DateTime.Now : data.GetDateTime(5);; } data.Close(); Inversionista_ = new Inversionista(DBMysql_); Inversionista_.GetById(Id_invercionista); Pedido_ = new Pedido(DBMysql_); Pedido_.GetById(Id_pedido); result = true; } return(result); } catch (DBException ex) { throw ex; } catch (MySqlException ex) { throw ex; } catch (Exception ex) { throw ex; } finally { if (data != null) { data.Close(); } } }
public List <Inversionista> List() { string Statement = string.Format("select * from t07_inversionistas"); MySqlDataReader data = null; List <Inversionista> List; try { data = DBMysql_.DoQuery(Statement); List = new List <Inversionista>(); if (data.HasRows) { while (data.Read()) { Inversionista Inversionista_ = new Inversionista(); Inversionista_.Id = data.IsDBNull(0) ? 0 : (int)data.GetUInt32(0); Inversionista_.Nombre = data.IsDBNull(1) ? " -- " : data.GetString(1); Inversionista_.isActive = data.IsDBNull(2) ? false : (data.GetInt32(2) == 1 ? true : false); Inversionista_.Created = data.IsDBNull(3) ? DateTime.Now : data.GetDateTime(3); Inversionista_.Updated = data.IsDBNull(4) ? DateTime.Now : data.GetDateTime(4); List.Add(Inversionista_); } } return(List); } catch (DBException ex) { throw ex; } catch (MySqlException ex) { throw ex; } catch (Exception ex) { throw ex; } finally { if (data != null) { data.Close(); } } }