Beispiel #1
0
 public List <Concepto> Concepto_Obtener(enum_Proposito proposito)
 {
     try
     {
         return(InformeNegocio.Concepto_Obtener(proposito));
     }
     catch (Exception err)
     {
         log.Error(string.Format("{0} - Error:{1}->{2}", System.Reflection.MethodBase.GetCurrentMethod().Name, err.Source, err.Message));
         return(null);
     }
 }
Beispiel #2
0
        public static List <Concepto> Concepto_Obtener(enum_Proposito proposito)
        {
            SqlConnection   oCnn      = new SqlConnection();
            SqlCommand      oCmd      = new SqlCommand();
            List <Concepto> conceptos = new List <Concepto>();

            try
            {
                oCnn             = Conexion.ObtenerConnexionSQL();
                oCmd.CommandText = "MensualesYConceptosObtener";
                oCnn.Open();
                oCmd.CommandType = CommandType.StoredProcedure;
                oCmd.Parameters.Add(new SqlParameter("@Proposito", proposito));
                oCmd.Connection = oCnn;
                using (SqlDataReader dr = oCmd.ExecuteReader())
                {
                    dr.NextResult();
                    while (dr.Read())
                    {
                        conceptos.Add(obtenerEntidadConcepto(dr));
                    }
                }
                return(conceptos);
            }
            catch (Exception err)
            {
                throw (err);
            }
            finally
            {
                if (oCnn.State != ConnectionState.Closed)
                {
                    oCnn.Close();
                }
                oCnn.Dispose();
                oCmd.Dispose();
            }
        }