Пример #1
0
        public static PeriodoEntity PeriodoDCConvertirPeriodoBE(PeriodoDC oPeriodoDC)
        {
            try
            {
                PeriodoEntity oPeriodoBE = new PeriodoEntity();
                oPeriodoBE.PeriodoId = oPeriodoDC.PeriodoId;
                oPeriodoBE.PeriodoNombre = oPeriodoDC.Descripcion;

                return oPeriodoBE;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        public static PeriodoDC PeriodoBEConvertirPeriodoDC(PeriodoEntity oPeriodoBE)
        {
            try
            {
                PeriodoDC oPeriodoDC = new PeriodoDC();
                oPeriodoDC.PeriodoId = oPeriodoBE.PeriodoId;
                oPeriodoDC.Descripcion = oPeriodoBE.PeriodoNombre;

                return oPeriodoDC;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        public List<PeriodoEntity> ListarPeriodoPorCarreraId(int CarreraId)
        {
            List<PeriodoEntity> lista = new List<PeriodoEntity>();
            SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["SSIA2013"].ToString());
            SqlCommand cmd = cn.CreateCommand();
            cmd.CommandText = "[SIGERCOV].[uspListarPeriodosXCarreraId]";
            cmd.CommandType = CommandType.StoredProcedure;

            PeriodoEntity item = null;

            SQLHelper.AddParam(ref cmd, "@CarreraId", ParameterDirection.Input, SqlDbType.Int, CarreraId);

            try
            {
                cn.Open();
                SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    item = new PeriodoEntity();

                    item.PeriodoId = dr.GetInt32(dr.GetOrdinal("PeriodoId"));
                    item.PeriodoNombre = dr.GetString(dr.GetOrdinal("PeriodoNombre")).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;
        }
Пример #4
0
        public PeriodoEntity ObtenerPeriodoActual()
        {
            List<PeriodoEntity> lista = new List<PeriodoEntity>();
            SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["SSIA2013"].ToString());
            SqlCommand cmd = cn.CreateCommand();
            cmd.CommandText = "[SIGERCOV].[DevolverPeriodoActual]";
            cmd.CommandType = CommandType.StoredProcedure;

            PeriodoEntity item = null;

            try
            {
                cn.Open();
                SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    item = new PeriodoEntity();

                    item.PeriodoNombre = dr.GetString(dr.GetOrdinal("DescripcionPeriodo")).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.First();
        }