/// <summary> /// Creates an EventRegistration <seealso cref="EventRegistration"/> and persists the entity in the database. /// </summary> public E.Event CreateEvent(string name, string eventDate, string importantInformation, string eventLanguage, DateTime startDate, DateTime deadline, int participantsLimitation, bool editAllowed, string logInPassword, string emailBCC, string emailCC, string emailReply, MetadataStructure metadataStructure, string javaScriptPath) { E.Event newEvent = new E.Event(); newEvent.Name = name; newEvent.EventDate = eventDate; newEvent.ImportantInformation = importantInformation; newEvent.EventLanguage = eventLanguage; newEvent.MetadataStructure = metadataStructure; newEvent.StartDate = startDate; newEvent.Deadline = deadline; newEvent.ParticipantsLimitation = participantsLimitation; newEvent.EditAllowed = editAllowed; newEvent.LogInPassword = logInPassword; newEvent.EmailBCC = emailBCC; newEvent.EmailCC = emailCC; newEvent.EmailReply = emailReply; newEvent.JavaScriptPath = javaScriptPath; using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository <E.Event> repo = uow.GetRepository <E.Event>(); repo.Put(newEvent); uow.Commit(); } return(newEvent); }
public E.Event UpdateEvent(E.Event eEvent) { Contract.Requires(eEvent != null); using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository <E.Event> repo = uow.GetRepository <E.Event>(); repo.Put(eEvent); uow.Commit(); } return(eEvent); }
/// <summary> /// If the <paramref name="Activity"/> is not associated to any <see cref="Event"/>, the method deletes it from the database. /// </summary> public bool DeleteEvent(E.Event eEvent) { Contract.Requires(eEvent != null); Contract.Requires(eEvent.Id >= 0); using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository <E.Event> repo = uow.GetRepository <E.Event>(); eEvent = repo.Reload(eEvent); repo.Delete(eEvent); uow.Commit(); } return(true); }
/// <summary> /// Creates an EventRegistration <seealso cref="EventRegistration"/> and persists the entity in the database. /// </summary> public E.EventRegistration CreateEventRegistration(XmlDocument data, E.Event e, User user, bool deleted, string token) { E.EventRegistration eventRegistration = new E.EventRegistration(); eventRegistration.Data = data; eventRegistration.Deleted = deleted; eventRegistration.Event = e; eventRegistration.Person = user; eventRegistration.Token = token; using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository <E.EventRegistration> repo = uow.GetRepository <E.EventRegistration>(); repo.Put(eventRegistration); uow.Commit(); } return(eventRegistration); }