public Instrument Retrieve(string name)
        {
            Key key = new Key(typeof(Instrument), true);
            key.Add("name", name);

            Instrument anInstrument = Broker.SessionBroker.TryRetrieveInstance(
                typeof(Instrument), key) as Instrument;

            if (anInstrument != null)
                return anInstrument;

            throw new InstrumentDoesNotExistException("No existe un instrumento con ese nombre");
        }
        public Event Retrieve(int id)
        {
            Key key = new Key(typeof(Event), true);
            key.Add("id", id);

            Event anEvent = Broker.SessionBroker.TryRetrieveInstance(
                typeof(Event), key) as Event;

            if (anEvent != null)
                return anEvent;

            throw new EventDoesNotExistException();
        }
Beispiel #3
0
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static GroupMap Retrieve(Key key)
 {
   return Broker.RetrieveInstance<GroupMap>(key);
 }
Beispiel #4
0
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static Recording Retrieve(Key key)
 {
   return Broker.RetrieveInstance<Recording>(key);
 }
Beispiel #5
0
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static DiSEqCMotor Retrieve(Key key)
 {
   return Broker.RetrieveInstance<DiSEqCMotor>(key);
 }
Beispiel #6
0
 /// <summary>
 /// Retrieves an entity given it's id.
 /// </summary>
 public static Schedule Retrieve(int id)
 {
   // Return null if id is smaller than seed and/or increment for autokey
   if (id < 1)
   {
     return null;
   }
   Key key = new Key(typeof (Schedule), true, "id_Schedule", id);
   return Broker.TryRetrieveInstance<Schedule>(key);
 }
Beispiel #7
0
    /// <summary>
    /// Refresh the recording
    /// </summary>
    public static Recording Refresh(int id)
    {
      // Return null if id is smaller than seed and/or increment for autokey
      if (id < 1)
      {
        return null;
      }
      Key key = new Key(typeof (Recording), true, "idRecording", id);

      Recording rec = Broker.TryRetrieveInstance<Recording>(key);

      if (rec != null)
      {
        Broker.Refresh(rec);
      }
      return rec;
    }
Beispiel #8
0
		/// <summary>
		/// Retrieve the object of the specified type and identified by the given key.
		/// </summary>
		/// <param name="type">The type of the Persistent descendant</param>
		/// <param name="key">The key identifying the object</param>
		/// <returns>An SqlResult instance</returns>
		public static object Retrieve( Type type, Key key )
		{
			return Retrieve( null, type, key );
		}
Beispiel #9
0
 /// <summary>
 /// Retrieves an entity given it's id.
 /// </summary>
 public static Channel Retrieve(int id)
 {
   // Return null if id is smaller than seed and/or increment for autokey
   if (id < 1)
   {
     return null;
   }
   Key key = new Key(typeof (Channel), true, "idChannel", id);
   return Broker.TryRetrieveInstance<Channel>(key);
 }
Beispiel #10
0
 /// <summary>
 /// Retrieves an entity given it's id.
 /// </summary>
 public static Keyword Retrieve(int id)
 {
   // Return null if id is smaller than seed and/or increment for autokey
   if (id < 1)
   {
     return null;
   }
   Key key = new Key(typeof (Keyword), true, "idKeyword", id);
   return Broker.RetrieveInstance<Keyword>(key);
 }
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static RadioChannelGroup Retrieve(Key key)
 {
   return Broker.RetrieveInstance<RadioChannelGroup>(key);
 }
        public Person RetrieveById(int id)
        {
            // I look for a person by his DNI
            Key key = new Key(typeof(Person), true);
            key.Add("id", id);

            Person aPerson = Broker.SessionBroker.TryRetrieveInstance(typeof(Person), key) as Person;

            // If found, it's returned
            if (aPerson != null)
                return aPerson;

            // the person who is looked for does not exist
            throw new PersonDoesNotExistException("No existe una persona con ese Id");
        }
Beispiel #13
0
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static Satellite Retrieve(Key key)
 {
   return Broker.RetrieveInstance<Satellite>(key);
 }
Beispiel #14
0
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static TuningDetail Retrieve(Key key)
 {
   return Broker.RetrieveInstance<TuningDetail>(key);
 }
Beispiel #15
0
 /// <summary>
 /// Retrieves an entity given it's id.
 /// </summary>
 public static TuningDetail Retrieve(int id)
 {
   // Return null if id is smaller than seed and/or increment for autokey
   if (id < 1)
   {
     return null;
   }
   Key key = new Key(typeof (TuningDetail), true, "idTuning", id);
   return Broker.RetrieveInstance<TuningDetail>(key);
 }
 void IEpgDataSink.WriteChannel(string id, string name)
 {
   string channelKey = name + "-" + id;
   if (!_channels.ContainsKey(channelKey))
   {
     try
     {
       Key dbKey = new Key(false, "displayName", name);
       //Channel dbChannel = Broker.TryRetrieveInstance<Channel>(dbKey);
       List<Channel> dbChannels = (List<Channel>)Broker.RetrieveList<Channel>(dbKey);
       if (dbChannels.Count > 0)
       {
         _channels.Add(channelKey, dbChannels);
       }
     }
     catch (Exception ex)
     {
       Log.Error("WebEPG: failed to retrieve channels with display name '{0}':", name);
       Log.Write(ex);
     }
   }
 }
 /// <summary>
 /// Retrieves an entity given it's id.
 /// </summary>
 public static ChannelLinkageMap Retrieve(int id)
 {
   // Return null if id is smaller than seed and/or increment for autokey
   if (id < 1)
   {
     return null;
   }
   Key key = new Key(typeof (ChannelLinkageMap), true, "idMapping", id);
   return Broker.RetrieveInstance<ChannelLinkageMap>(key);
 }
Beispiel #18
0
 /// <summary>
 /// Retrieves an entity given it's id.
 /// </summary>
 public static RadioGroupMap Retrieve(int id)
 {
   // Return null if id is smaller than seed and/or increment for autokey
   if (id < 1)
   {
     return null;
   }
   Key key = new Key(typeof (GroupMap), true, "idMap", id);
   return Broker.RetrieveInstance<RadioGroupMap>(key);
 }
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static ChannelLinkageMap Retrieve(Key key)
 {
   return Broker.RetrieveInstance<ChannelLinkageMap>(key);
 }
Beispiel #20
0
 /// <summary>
 /// Retrieves an entity given it's id.
 /// </summary>
 public static TvMovieMapping Retrieve(int id)
 {
   Key key = new Key(typeof (TvMovieMapping), true, "idMapping", id);
   return Broker.RetrieveInstance<TvMovieMapping>(key);
 }
Beispiel #21
0
		/// <summary>
		/// Retrieve the object of the specified type and identified by the given key. This method will
		/// throw an exception if not exactly one row in the database matches.
		/// </summary>
		/// <param name="broker">The PersistenceBroker and associated provider used fetch the data</param>
		/// <param name="type">The type of the Persistent descendant</param>
		/// <param name="key">The key identifying the object</param>
		/// <returns>An object instance of the specified type</returns>
		public static object Retrieve( PersistenceBroker broker, Type type, Key key )
		{
			if( broker == null )
			{
				// use default broker instance by use of the Broker class
				return Broker.RetrieveInstance( type, key );
			}
			else // use supplied broker instance
			{
				return broker.RetrieveInstance( type, key );
			}
		}
Beispiel #22
0
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static TvMovieMapping Retrieve(Key key)
 {
   return Broker.RetrieveInstance<TvMovieMapping>(key);
 }
Beispiel #23
0
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static Channel Retrieve(Key key)
 {
   return Broker.RetrieveInstance<Channel>(key);
 }
Beispiel #24
0
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static Card Retrieve(Key key)
 {
   return Broker.RetrieveInstance<Card>(key);
 }
Beispiel #25
0
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static Schedule Retrieve(Key key)
 {
   return Broker.TryRetrieveInstance<Schedule>(key);
 }
        public Event Retrieve(DateTime date)
        {
            // Seconds are not important
            DateTime dateWithoutSeconds = new DateTime(date.Year, date.Month, date.Day,
                                                     date.Hour, date.Minute, 0);

            Key key = new Key(typeof(Event), true);
            key.Add("date", dateWithoutSeconds);

            Event anEvent = Broker.SessionBroker.TryRetrieveInstance(
                typeof(Event), key) as Event;

            if (anEvent != null)
                return anEvent;

            throw new EventDoesNotExistException();
        }
Beispiel #27
0
    /// <summary>
    /// Retrieves an entity given it's id.
    /// </summary>
    public static Recording Retrieve(int id)
    {
      // Return null if id is smaller than seed and/or increment for autokey
      if (id < 1)
      {
        return null;
      }
      Key key = new Key(typeof (Recording), true, "idRecording", id);

      return Broker.RetrieveInstance<Recording>(key);
    }
Beispiel #28
0
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static Server Retrieve(Key key)
 {
   return Broker.RetrieveInstance<Server>(key);
 }
Beispiel #29
0
 /// <summary>
 /// Retrieves an entity given it's id.
 /// </summary>
 public static Server Retrieve(int id)
 {
   // Return null if id is smaller than seed and/or increment for autokey
   if (id < 1)
   {
     return null;
   }
   Key key = new Key(typeof (Server), true, "idServer", id);
   return Broker.RetrieveInstance<Server>(key);
 }
 /// <summary>
 /// Retrieves an entity given it's id, using Gentle.Framework.Key class.
 /// This allows retrieval based on multi-column keys.
 /// </summary>
 public static SoftwareEncoder Retrieve(Key key)
 {
   return Broker.RetrieveInstance<SoftwareEncoder>(key);
 }