示例#1
0
        public static TipoMoneda Fetch(int id)
        {
            TipoMoneda m_entidad = new TipoMoneda();

            using (MySqlConnection connection
                       = new MySqlConnection(
                             ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
            {
                using (MySqlCommand command = new MySqlCommand())
                {
                    command.Connection  = connection;
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.CommandText = "sun_tipmon_traerregistro";
                    command.Parameters.Add(new MySqlParameter("@n_id", id));
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            m_entidad = SetObject(reader);
                        }
                    }
                }
            }
            return(m_entidad);
        }
示例#2
0
        public static List <TipoMoneda> FetchList()
        {
            List <TipoMoneda> m_listentidad = new List <TipoMoneda>();

            using (MySqlConnection connection
                       = new MySqlConnection(
                             ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
            {
                using (MySqlCommand command = new MySqlCommand())
                {
                    command.Connection  = connection;
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.CommandText = "sun_tipmon_select";
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            TipoMoneda m_entidad = SetObject(reader);
                            m_listentidad.Add(m_entidad);
                        }
                    }
                }
            }
            return(m_listentidad);
        }