public List <Proyecto_Response> obtenerProyectosDisponibles(Proyecto_Request obj)
 {
     try
     {
         return(programaService.obtenerProyectosDisponibles(obj));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #2
0
 public List <Proyecto_Response> obtenerProyectosDisponibles(Proyecto_Request obj)
 {
     try
     {
         if (obj.no_nombre == null)
         {
             obj.no_nombre = "";
         }
         return(programaDA.obtenerProyectosDisponibles(obj));
     }
     catch (Exception)
     {
         throw;
     }
 }
        public List <Proyecto_Response> obtenerProyectosDisponibles(Proyecto_Request entidad)
        {
            List <Proyecto_Response> retorno = new List <Proyecto_Response>();
            Proyecto_Response        obj     = null;

            try
            {
                using (SqlConnection conection = new SqlConnection(ConfigurationManager.ConnectionStrings["cnxIndra"].ConnectionString))
                {
                    conection.Open();

                    using (SqlCommand command = new SqlCommand("[pa_sps_proyectosdisponibles]", conection))
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.AddWithValue("@vi_no_nombre", entidad.no_nombre);
                        command.Parameters.AddWithValue("@vi_nid_programa", entidad.nid_programa);

                        using (SqlDataReader dr = command.ExecuteReader())
                        {
                            if (dr.HasRows)
                            {
                                obj = new Proyecto_Response();
                                while (dr.Read())
                                {
                                    obj = new Proyecto_Response();
                                    obj.nid_proyecto = dr.GetInt32(dr.GetOrdinal("nid_proyecto"));
                                    obj.no_nombre    = dr.GetString(dr.GetOrdinal("no_nombre"));
                                    obj.no_codigo    = dr.GetString(dr.GetOrdinal("no_codigo"));
                                    retorno.Add(obj);
                                }
                            }
                            else
                            {
                                retorno = new List <Proyecto_Response>();
                            }
                        }
                    }
                    conection.Close();
                }
                return(retorno);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }