예제 #1
0
        public Reforzamiento CrearReforzamiento(Reforzamiento refor)
        {
            Reforzamiento reforzamientoCreado = null;
            string        sql = "INSERT INTO TUTOR.Reforzamiento (cod_Reforzamiento, COD_PLAN, hor_Inicio, hor_Fin, dia, duracion, fec_inicio, objetivo, observacion, cod_alumno, cod_profesor, cod_curso, fec_grabacion) VALUES(:p_cod_Reforzamiento, :p_COD_PLAN, :p_hor_Inicio, :p_hor_Fin, :p_dia, :p_duracion, TO_DATE(:p_fec_inicio,'DD/MM/YYYY'), :p_objetivo, :p_observacion, :p_cod_alumno, :p_cod_profesor, :p_cod_curso, TO_DATE(:FechaRegistro,'DD/MM/YYYY'))";

            using (OracleConnection conexion = new OracleConnection(CadenaConexion))
            {
                conexion.Open();
                using (OracleCommand comando = new OracleCommand(sql, conexion))
                {
                    comando.Parameters.AddWithValue(":p_cod_Reforzamiento", refor.CodReforzamiento);
                    comando.Parameters.AddWithValue(":p_COD_PLAN", refor.CodPlan);
                    comando.Parameters.AddWithValue(":p_hor_Inicio", refor.HorarioInicio);
                    comando.Parameters.AddWithValue(":p_hor_Fin", refor.HorarioFin);
                    comando.Parameters.AddWithValue(":p_dia", refor.Dia);
                    comando.Parameters.AddWithValue(":p_duracion", refor.Duracion);
                    comando.Parameters.AddWithValue(":p_fec_inicio", refor.FechaInicio);
                    comando.Parameters.AddWithValue(":p_objetivo", refor.Objetivo);
                    comando.Parameters.AddWithValue(":p_observacion", refor.Observacion);
                    comando.Parameters.AddWithValue(":p_cod_alumno", refor.CodAlumno);
                    comando.Parameters.AddWithValue(":p_cod_profesor", refor.CodProfesor);
                    comando.Parameters.AddWithValue(":p_cod_curso", refor.CodCurso);
                    comando.Parameters.AddWithValue(":FechaRegistro", DateTime.Now);

                    var executeResult = comando.ExecuteNonQuery();
                    reforzamientoCreado = ObtenerReforzamiento(refor.CodReforzamiento);
                    return(reforzamientoCreado);
                }
            }
        }
예제 #2
0
 public List <Reforzamiento> ListarReforzamiento()
 {
     try
     {
         List <Reforzamiento> reforzamientosEncontrado = new List <Reforzamiento>();
         Reforzamiento        reforzamientoEncontrado;
         string sql = "SELECT * FROM TUTOR.REFORZAMIENTO";
         using (OracleConnection conexion = new OracleConnection(CadenaConexion))
         {
             conexion.Open();
             using (OracleCommand comando = new OracleCommand(sql, conexion))
             {
                 using (OracleDataReader resultado = comando.ExecuteReader())
                 {
                     if (resultado.HasRows)
                     {
                         while (resultado.Read())
                         {
                             reforzamientoEncontrado = new Reforzamiento()
                             {
                                 CodReforzamiento = Convert.ToString(resultado["cod_Reforzamiento"]),
                                 CodPlan          = Convert.ToString(resultado["COD_PLAN"]),
                                 HorarioInicio    = Convert.ToString(resultado["HOR_INICIO"]),
                                 HorarioFin       = Convert.ToString(resultado["HOR_FIN"]),
                                 Dia         = Convert.ToInt32(resultado["DIA"]),
                                 FechaInicio = Convert.ToDateTime(resultado["FEC_INICIO"]),
                                 CodAlumno   = Convert.ToString(resultado["COD_ALUMNO"]),
                                 CodProfesor = Convert.ToString(resultado["COD_PROFESOR"]),
                                 CodCurso    = Convert.ToString(resultado["COD_CURSO"]),
                                 Duracion    = Convert.ToInt32(resultado["DURACION"]),
                                 Objetivo    = Convert.ToString(resultado["OBJETIVO"]),
                                 Observacion = Convert.ToString(resultado["OBSERVACION"])
                             };
                             reforzamientosEncontrado.Add(reforzamientoEncontrado);
                         }
                     }
                 }
             }
         }
         return(reforzamientosEncontrado);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
 public Reforzamiento ObtenerReforzamiento(string p_cod_reforzamiento)
 {
     try
     {
         Reforzamiento reforzamientoEncontrado = null;
         string        sql = "SELECT * FROM TUTOR.REFORZAMIENTO WHERE cod_Reforzamiento= :p_cod_reforzamiento";
         using (OracleConnection conexion = new OracleConnection(CadenaConexion))
         {
             conexion.Open();
             using (OracleCommand comando = new OracleCommand(sql, conexion))
             {
                 comando.Parameters.AddWithValue(":p_cod_reforzamiento", p_cod_reforzamiento);
                 using (OracleDataReader resultado = comando.ExecuteReader())
                 {
                     if (resultado.HasRows)
                     {
                         if (resultado.Read())
                         {
                             return(reforzamientoEncontrado = new Reforzamiento()
                             {
                                 CodReforzamiento = Convert.ToString(resultado["cod_Reforzamiento"]),
                                 CodPlan = Convert.ToString(resultado["COD_PLAN"]),
                                 HorarioInicio = Convert.ToString(resultado["HOR_INICIO"]),
                                 HorarioFin = Convert.ToString(resultado["HOR_FIN"]),
                                 Dia = Convert.ToInt32(resultado["DIA"]),
                                 FechaInicio = Convert.ToDateTime(resultado["FEC_INICIO"]),
                                 CodAlumno = Convert.ToString(resultado["COD_ALUMNO"]),
                                 CodProfesor = Convert.ToString(resultado["COD_PROFESOR"]),
                                 CodCurso = Convert.ToString(resultado["COD_CURSO"]),
                                 Duracion = Convert.ToInt32(resultado["DURACION"]),
                                 Objetivo = Convert.ToString(resultado["OBJETIVO"]),
                                 Observacion = Convert.ToString(resultado["OBSERVACION"])
                             });
                         }
                     }
                 }
             }
             return(reforzamientoEncontrado);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
 public Reforzamiento Registrar(Reforzamiento reforzamientoACrear)
 {
     return(reforzamientoDAO.CrearReforzamiento(reforzamientoACrear));
 }