public bool Attended(Person aPerson, Event anEvent)
 {
     if (this.Retrieve(aPerson, anEvent) != null)
         return true;
     else
         return false;
 }
Ejemplo n.º 2
0
        public ModifyEvent(Gtk.Window parent, ListStore eventsModel,
		                   Event anEvent, TreeIter eventIter)
            : base(parent, eventsModel)
        {
            this.eventIter = eventIter;

            this.dlgAddEvent.Title = "Modificar evento";

            this.dialogButtons.Remove(this.btnOkClose);
            this.btnOkAdd.Label = "Guardar";

            // Event data
            this.spbtnDay.Value = anEvent.Date.Day;
            this.cmbMonth.Active = anEvent.Date.Month - 1;
            this.spbtnYear.Value = anEvent.Date.Year;
            this.spbtnHour.Value = anEvent.Date.Hour;
            this.spbtnMinute.Value = anEvent.Date.Minute;

            this.cmbEventTypes.Active = anEvent.IdEventType - 1;

            this.entryName.Text = anEvent.Name;
            this.textviewGoals.Buffer.Text = anEvent.Goals;
            this.textviewObservations.Buffer.Text = anEvent.Observations;

            this.anEvent = anEvent;
        }
        public void RemoveAllAttendancesOfEvent(Event anEvent)
        {
            SqlBuilder sb = new SqlBuilder(StatementType.Delete, typeof(Attendance));
            sb.AddConstraint(Operator.Equals, "id_event", anEvent.Id);

            SqlStatement stmt = sb.GetStatement(true);
            stmt.Execute();
        }
        public void RemoveAttendance(Person aPerson, Event anEvent)
        {
            Attendance at = Retrieve(aPerson, anEvent);

            if (at == null)
                throw new Exception("La asistencia que se intenta eliminar no existe en la base de datos.");

            at.Remove();
        }
        public void Init()
        {
            //			this.person1 = PersonsManager.Instance.AddPerson(1, "Pividori", "Milton", true, false);
            //			this.person2 = PersonsManager.Instance.AddPerson(2, "Paduán", "Doli", false, false);

            this.event1 = EventsManager.Instance.IngresarEvento(new DateTime(DateTime.Now.Year, 1, 1), "Evento1", Types.ENSAYO);
            this.event2 = EventsManager.Instance.IngresarEvento(new DateTime(DateTime.Now.Year, 1, 2), "Evento2", Types.MISA);
            this.event3 = EventsManager.Instance.IngresarEvento(new DateTime(DateTime.Now.Year, 1, 3), "Evento3", Types.ENSAYO);
            this.event4 = EventsManager.Instance.IngresarEvento(new DateTime(DateTime.Now.Year, 1, 4), "Evento4", Types.OTRO);
        }
        public Attendance AddAttendance(Person aPerson, Event anEvent)
        {
            if (Retrieve(aPerson, anEvent) == null) {
                Attendance newAttendance = new Attendance(aPerson.Id, anEvent.Id);
                newAttendance.Persist();

                return newAttendance;
            }

            throw new AttendanceExistsException("Se está intentando ingresar una asistencia que" +
                    " ya existe en la base de datos.");
        }
        public Event AddEvent(DateTime date, string name, EventType eventType,
			string goals, string observations)
        {
            try {
                Retrieve(date);
            }
            catch (EventDoesNotExistException) {
                Event newEvent = new Event(date, name, eventType,
                                                goals, observations);
                newEvent.Persist();

                return newEvent;
            }

            throw new EventExistsException("Se está intentando ingresar un evento que " +
                                           "ya existe en la base de datos. Cada evento " +
                                           "tiene una fecha y hora únicos.");
        }
Ejemplo n.º 8
0
 private string GenerateColumnTitle(Event anEvent)
 {
     return (anEvent.Name + "\n(" + this.FormatEventDateTime(anEvent.Date) + ")");
 }
Ejemplo n.º 9
0
        //        public TreeIter GetAttendancesListIterByPerson(Person aPerson)
        //        {
        //            TreeIter iter;
        //            
        //            this.attendances.GetIterFirst(out iter);
        //            
        //            if (this.GetPerson(iter).Equals(aPerson))
        //                return iter;
        //            
        //            while (this.attendances.IterNext(ref iter)) {
        //                if (this.GetPerson(iter).Equals(aPerson))
        //                    return iter;
        //            }
        //            
        //            return TreeIter.Zero;
        //        }
        public CustomTreeViewColumn GetAttendancesListColumnByEvent(Event anEvent)
        {
            foreach (CustomTreeViewColumn tvc in this.tvAttendances.Columns) {
                if (tvc.Event != null && tvc.Event.Equals(anEvent))
                    return tvc;
            }

            return null;
        }
Ejemplo n.º 10
0
        public void AddEventToList(Event e)
        {
            // Add to events list
            this.events.AppendValues(e);

            // Mange attendances treeview
            this.LoadAttendancesListData();
        }
 public CustomCellRendererToggle(int columnNumber, Event anEvent)
     : base()
 {
     this.columnNumber = columnNumber;
     this.anEvent = anEvent;
 }
 public CustomTreeViewColumn(Event anEvent)
     : base()
 {
     this.anEvent = anEvent;
 }
 public void Init()
 {
     ensayoSabado = controladorEventos.IngresarEvento(new DateTime(DateTime.Now.Year, 8, 11),
         "Ensayo", Types.ENSAYO);
     misaDomingo = controladorEventos.IngresarEvento(new DateTime(DateTime.Now.Year, 8, 12),
         "Misa", Types.MISA);
     otroEvento = controladorEventos.IngresarEvento(new DateTime(DateTime.Now.Year, 8, 13),
         "Otro evento", Types.OTRO);
 }
        private Attendance Retrieve(Person aPerson, Event anEvent)
        {
            Key key = new Key(true);
            key.Add("id_person", aPerson.Id);
            key.Add("id_event", anEvent.Id);

            Attendance anAttendance =
                Broker.SessionBroker.TryRetrieveInstance(typeof(Attendance), key) as Attendance;

            // If found, return it
            if (anAttendance != null)
                return anAttendance;

            return null;
        }
        public List<Person> WhoHadAttended(Event anEvent)
        {
            SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Attendance));
            sb.AddConstraint(Operator.Equals, "id_event", anEvent.Id);
            SqlStatement stmt = sb.GetStatement(true);

            IList attendances = ObjectFactory.GetCollection(typeof(Attendance), stmt.Execute());

            List<Person> persons = new List<Person>();
            foreach (Attendance at in attendances)
                persons.Add(at.Person);

            return persons;
        }
Ejemplo n.º 16
0
 public Attendance(int id_person, int id_event)
 {
     this.aPerson = PersonsManager.Instance.RetrieveById(id_person);
     this.anEvent = EventsManager.Instance.Retrieve(id_event);
 }