/// <exception cref="System.Exception"></exception> public virtual void NewDownload(string name, string email, string downloadType, string fileName) { NeoDatis.Odb.ODB odb = null; User user = null; try { odb = Open("download.neodatis"); NeoDatis.Odb.Objects<User> users = odb.GetObjects<User>(new CriteriaQuery(Where.Equal("email", email))); if (users.Count!=0()) { user = (User)users.GetFirst(); user.SetLastDownload(new System.DateTime()); user.SetNbDownloads(user.GetNbDownloads() + 1); odb.Store(user); } else { user = new User(); user.SetName(name); user.SetEmail(email); user.SetLastDownload(new System.DateTime()); user.SetNbDownloads(1); odb.Store(user); } NeoDatis.Odb.Test.VO.Download.Download download = new NeoDatis.Odb.Test.VO.Download.Download (); download.SetFileName(fileName); download.SetType(downloadType); download.SetUser(user); download.SetWhen(new System.DateTime()); odb.Store(download); } finally { if (odb != null) { odb.Close(); } } }