/// <summary> /// Unregisters the guest from the guest list. /// </summary> /// <param name="matricID">Matric ID of the guest.</param> /// <returns><c>true</c> if successful; <c>false</c> if unsuccessful.</returns> public bool UnregisterGuest(string matricID) { bool result = DBLayer.DomainModels.EventModel.unregisterGuest(matricID, this.Event.Id); DBLayer.Event tempEvent = DBLayer.DomainModels.EventModel.getByID(this.Event.Id); this.Event.Guests = tempEvent.Guests; this.UpdateCapacityUI(); return(result); }
public EventModel() { this._dbObj = new DBLayer.Event(); this.Id = -1; this.Name = ""; this.Description = ""; this.Capacity = 50; this.DBObj.Start = DateTime.Now; this.DBObj.End = DateTime.Now; this.DBObj.TimeCreated = DateTime.Now; if (SessionModel.GetInstance().LoggedIn) { this.StudentMatricID = SessionModel.GetInstance().LoggedInUser.MatricId; } this.DBObj.Budget = new DBLayer.Budget(); this._budget = new BudgetModel(this.DBObj.Budget); }
public EventModel(DBLayer.Event e) { this._dbObj = e; }
public void getByIDTest() { int id = 20; Event expected = new Event(); expected.Id = id; expected.Budget = BudgetModel.getByID(37); expected.Capacity = 50; expected.Description = "asdasd"; expected.End = new DateTime(2012, 4, 4, 2, 33, 3); expected.Start = new DateTime(2012, 4, 4, 2, 33, 3); expected.Guests.Add(StudentModel.getByMatricId("test2")); expected.Name = "Hello World"; expected.Owner = StudentModel.getByMatricId("test"); expected.StudentMatricId = "test"; expected.SubEvents = SubEventModel.getAllByEventID(20); expected.TimeCreated = new DateTime(2012, 4, 4, 2, 33, 3); expected.ViewAtLoginPage = 1; Event actual = EventModel.getByID(id); Assert.IsTrue(PropertiesEqual(actual, expected)); }