public override void Create(Event e)
{
if (e == null)
return;
repositoryItemDAO.Create (e);
if (e.EventType == EventType.DELETE || e.EventType == EventType.MOVE)
{
repositoryItemDAO.MarkAsMoved(e.Item);
}
DateTime dateOfEvent = e.InsertTime;
if(dateOfEvent==DateTime.MinValue){
dateOfEvent = GlobalDateTime.Now;
}
//Verify ignore
RepositoryIgnoreDAO ignoreDato = new SQLiteRepositoryIgnoreDAO();
List<RepositoryIgnore> ignores = ignoreDato.All(this.repo);
foreach (RepositoryIgnore ignoreItem in ignores)
{
if (e.Item.Key.StartsWith(ignoreItem.Path))
{
e.Synchronized = true;
e.Response = RESPONSE.IGNORED;
}
}
string sql =string.Format("INSERT INTO EVENT (ITEMID, TYPE, REPOSITORY, SYNCHRONIZED, INSERTTIME, USER, APPLICATION, APPLICATION_VERSION, DEVICE_ID, OS, BUCKET, TRY_QNT, RESPONSE, RepositoryId) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}')",
e.Item.Id, e.EventType.ToString(), e.RepositoryType.ToString(), e.Synchronized.ToString(), dateOfEvent.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"), e.User, e.Application, e.ApplicationVersion, e.DeviceId, e.OS, e.Bucket, e.TryQnt, e.Response.ToString(), e.Repository.Id);
if (e.Response != RESPONSE.IGNORED)
{
e.Id = (int)database.ExecuteNonQuery(sql, true);
Logger.LogEvent("EVENT CREATED", e);
}
}