annotate Agendas/trunk/src/Agendas.Repositories.NHibernate/EventoRepository.cs @ 63:963b71ea6028

Repositorios con NH
author nelopauselli
date Tue, 17 May 2011 14:02:25 -0300
parents
children b74734a1a755
rev   line source
63
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
1 using System;
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
2 using System.Collections.Generic;
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
3 using AltNetHispano.Agendas.Domain;
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
4 using AltNetHispano.Agendas.Domain.Repositories;
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
5 using NHibernate;
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
6
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
7 namespace AltNetHispano.Agendas.Repositories.NHibernate
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
8 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
9 public class EventoRepository : RepositoryBase<Evento>, IEventoRepository
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
10 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
11 public EventoRepository(ISessionFactory sessionFactory) : base(sessionFactory)
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
12 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
13 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
14
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
15 public void Delete(Evento evento)
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
16 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
17 Session.Delete(evento);
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
18 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
19
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
20 public Evento Get(Guid vanId)
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
21 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
22 return Session.Get<Evento>(vanId);
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
23 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
24
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
25 public IList<Evento> GetEventosConFecha()
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
26 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
27 return Session.QueryOver<Evento>().Where(e => e.Fecha != null).List();
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
28 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
29
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
30 public IList<Evento> GetEventosSinFecha()
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
31 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
32 return Session.QueryOver<Evento>().Where(e => e.Fecha == null).List();
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
33 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
34
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
35 public Evento GetPropuestaByTitulo(string titulo)
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
36 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
37 return Session.QueryOver<Evento>().Where(e => e.Titulo==titulo).SingleOrDefault();
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
38 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
39
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
40 public void Update(Evento evento)
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
41 {
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
42 //No es necesario implementarlo
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
43 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
44 }
963b71ea6028 Repositorios con NH
nelopauselli
parents:
diff changeset
45 }