/// <summary> /// Obteners the motivo sancion BD transaccional. /// </summary> /// <param name="configuracion">The configuracion.</param> /// <returns></returns> public List<MotivoSancion> obtenerMotivoSancionBDTransaccional(Configuraciones configuracion) { List<MotivoSancion> listadoMotivoSancion = null; try { using (MySqlCommand command = new MySqlCommand()) { conMySQL = new MySqlConnection(configuracion.valor); command.Connection = conMySQL; command.CommandText = @"SELECT * FROM motivosancion"; conMySQL.Open(); MySqlDataReader reader = command.ExecuteReader(); MotivoSancion unMotivoSancion; listadoMotivoSancion = new List<MotivoSancion>(); while (reader.Read()) { unMotivoSancion = new MotivoSancion(); unMotivoSancion.idMotivoSancion = 0; unMotivoSancion.idMotivoSancionTransaccional = (int)reader["id"]; unMotivoSancion.descripcion = reader["descripcion"].ToString(); listadoMotivoSancion.Add(unMotivoSancion); } command.Connection.Close(); return (listadoMotivoSancion); } } catch (MySqlException ex) { throw new CustomizedException(String.Format("Fallo en {0} - obtenerMotivoSancionBDTransaccional()", ClassName), ex, enuExceptionType.MySQLException); } catch (SqlException ex) { throw new CustomizedException(String.Format("Fallo en {0} - obtenerMotivoSancionBDTransaccional()", ClassName), ex, enuExceptionType.SqlException); } catch (Exception ex) { throw new CustomizedException(String.Format("Fallo en {0} - obteneMotivoSancionBDTransaccional()", ClassName), ex, enuExceptionType.DataAccesException); } finally { //if (sqlConnectionConfig.State == ConnectionState.Open) // sqlConnectionConfig.Close(); } }
public Sancion() { motivoSancion = new MotivoSancion(); tipoSancion = new TipoSancion(); alumno = new AlumnoCursoCicloLectivo(); }