public override ISyncItem CreateSyncItem(SyncCommandItem item) { string classType = item.ClassType; AirSyncDiagnostics.TraceInfo <string>(ExTraceGlobals.RequestsTracer, this, "EntitySyncCollection.CreateSyncItem({0})", classType); base.CheckFullAccess(); string a; if ((a = classType) != null && a == "Calendar") { return(EntitySyncItem.Bind(new Event())); } throw new AirSyncPermanentException(HttpStatusCode.NotImplemented, StatusCode.UnexpectedItemClass, null, false) { ErrorStringForProtocolLogger = "BadClassType(" + classType + ")onSync" }; }
protected override ISyncItem GetItem(Item item) { return(EntitySyncItem.Bind(item)); }
protected ISyncItemId ApplyChanges(SyncCommandItem syncCommandItem) { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "SyncCollection.ApplyChanges"); EntitySyncItem entitySyncItem = (EntitySyncItem)syncCommandItem.Item; EntitySyncProviderFactory factory = (EntitySyncProviderFactory)base.SyncProviderFactory; Event @event = entitySyncItem.Item as Event; try { if (@event == null) { throw new NotImplementedException(string.Format("SyncCollection.ApplyChanges item type {0} is not supported", entitySyncItem.GetType().FullName)); } switch (syncCommandItem.ChangeType) { case ChangeType.Add: { List <IAttachment> list = null; if (@event.Attachments != null && @event.Attachments.Count > 0) { list = @event.Attachments; @event.Attachments = null; @event.IsDraft = true; } @event = this.Events.Create(@event, null); entitySyncItem.UpdateId(factory, @event.Id); base.ItemIdMapping.Add(entitySyncItem.Id); syncCommandItem.UID = @event.Id; if (list == null) { goto IL_16A; } @event = new Event { Id = @event.Id, Attachments = list }; entitySyncItem = EntitySyncItem.Bind(@event); break; } case ChangeType.Change: break; case (ChangeType)3: goto IL_134; case ChangeType.Delete: throw new InvalidOperationException("SyncCollection.ApplyChanges does not support Delete, use DeleteItem."); default: goto IL_134; } syncCommandItem.AddedAttachments = this.ApplyAttachmentChanges(entitySyncItem); @event.Id = this.Events.Update(@event, null).Id; ((EntitySyncItem)syncCommandItem.Item).Reload(); goto IL_16A; IL_134: throw new NotImplementedException(string.Format("SyncCollection.ApplyChanges ChangeType {0} is not supported", syncCommandItem.ChangeType)); IL_16A :; } finally { if (!object.ReferenceEquals(entitySyncItem, (EntitySyncItem)syncCommandItem.Item)) { entitySyncItem.Dispose(); } } return(syncCommandItem.Item.Id); }
protected override ISyncItem CreateSyncItem(Item mailboxItem) { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "EntitySyncCollection.CreateSyncItem(mailboxItem)"); return(EntitySyncItem.Bind(mailboxItem)); }