Esempio n. 1
0
 public static CursoEntity CursoDCConvertirCursoBE(CursoDC oCursoDC)
 {
     try
     {
         CursoEntity oCursoBE = new CursoEntity();
         oCursoBE.CursoId = oCursoDC.CursoId;
         oCursoBE.CursoNombre = oCursoDC.Nombre;
         oCursoBE.CursoControl = oCursoDC.CursoControl;
         oCursoBE.CursoCreditos = oCursoDC.CursoCreditos;
         oCursoBE.CursoVerificacion = oCursoDC.CursoVerificacion;
         return oCursoBE;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public List<CursoEntity> ListarCursosPorCarreraPorNivelPorPeriodoActual(int? carreraId, int? nivel)
        {
            List<CursoEntity> lista = new List<CursoEntity>();
            SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["SSIA2013"].ToString());
            SqlCommand cmd = cn.CreateCommand();
            cmd.CommandText = "[SIGERCOV].[ListarCursoXCarreraXNivelXPeriodoActual]";
            cmd.CommandType = CommandType.StoredProcedure;

            CursoEntity item = null;

            SQLHelper.AddParam(ref cmd, "@CarreraId", ParameterDirection.Input, SqlDbType.Int, carreraId);
            SQLHelper.AddParam(ref cmd, "@Nivel", ParameterDirection.Input, SqlDbType.Int, nivel);
            try
            {
                cn.Open();
                SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    item = new CursoEntity();

                    item.CursoId = dr.GetInt32(dr.GetOrdinal("CursoId"));
                    item.CursoNombre = dr.GetString(dr.GetOrdinal("Nombre")).ToString();

                    item.CursoControl = Convert.ToBoolean(dr.GetInt32(dr.GetOrdinal("EsControl")));
                    item.CursoVerificacion = Convert.ToBoolean(dr.GetInt32(dr.GetOrdinal("EsVerificacion")));
                    item.CursoCreditos = dr.GetInt32(dr.GetOrdinal("Creditos"));

                    lista.Add(item);
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close();
                }
                cn.Dispose();
                cmd.Dispose();
                cn = null;
                cmd = null;

            }
            return lista;
        }
        public List<CursoEntity> ListarCursosPorTipoCursoCarreraId(int? CarreraId, int? TipoCurso)
        {
            List<CursoEntity> lista = new List<CursoEntity>();
            SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["SSIA2013"].ToString());
            SqlCommand cmd = cn.CreateCommand();
            cmd.CommandText = "[SIGERCOV].[uspListarCursosPorTipoCursoCarreraId]";
            cmd.CommandType = CommandType.StoredProcedure;

            CursoEntity item = null;

            SQLHelper.AddParam(ref cmd, "@CarreraId", ParameterDirection.Input, SqlDbType.Int, CarreraId);
            SQLHelper.AddParam(ref cmd, "@TipoCurso", ParameterDirection.Input, SqlDbType.Int, TipoCurso);
            try
            {
                cn.Open();
                SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    item = new CursoEntity();

                    item.CursoId = dr.GetInt32(dr.GetOrdinal("CursoId"));
                    item.CursoNombre = dr.GetString(dr.GetOrdinal("CursoNombre")).ToString();
                    lista.Add(item);
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close();
                }
                cn.Dispose();
                cmd.Dispose();
                cn = null;
                cmd = null;

            }
            return lista;
        }