protected override VoidResult OnExecute() { CalendarGroupEntryDataProvider calendarGroupEntryDataProvider = this.Scope.CalendarGroupEntryDataProvider; using (ICalendarGroupEntry calendarGroupEntry = calendarGroupEntryDataProvider.Bind(this.Scope.IdConverter.ToStoreObjectId(base.EntityKey))) { bool isLocalMailboxCalendar = calendarGroupEntry.IsLocalMailboxCalendar; if (isLocalMailboxCalendar) { this.Scope.CalendarFolderDataProvider.Delete(calendarGroupEntry.CalendarId, DeleteItemFlags.MoveToDeletedItems); } try { calendarGroupEntryDataProvider.Delete(calendarGroupEntry.Id, DeleteItemFlags.HardDelete); } catch (StoragePermanentException arg) { if (!isLocalMailboxCalendar) { throw; } this.Trace.TraceError <DeleteCalendar, StoragePermanentException>(0L, "{0}. Local calendar folder was moved to deleted items but calendar group entry failed to be deleted. {1}", this, arg); } } return(VoidResult.Value); }
protected override StoreId ResolveReference() { StoreId calendarId; using (ICalendarGroupEntry calendarGroupEntry = base.XsoFactory.BindToCalendarGroupEntry(base.StoreSession, base.GetCalendarFolderId())) { calendarId = calendarGroupEntry.CalendarId; } return(calendarId); }
protected override Calendar OnExecute() { CalendarGroupEntryDataProvider calendarGroupEntryDataProvider = this.Scope.CalendarGroupEntryDataProvider; Calendar result; using (ICalendarGroupEntry calendarGroupEntry = calendarGroupEntryDataProvider.ValidateAndBindToWrite(base.Entity)) { if (calendarGroupEntry.IsLocalMailboxCalendar) { this.Scope.CalendarFolderDataProvider.UpdateOnly(base.Entity, calendarGroupEntry.CalendarId); } result = calendarGroupEntryDataProvider.Update(base.Entity, calendarGroupEntry, this.Context); } return(result); }
protected virtual StoreId ResolveCalendarFolderId() { StoreId storeId = base.GetStoreId(); StoreObjectId storeObjectId = StoreId.GetStoreObjectId(storeId); if (storeObjectId.IsFolderId) { return(storeId); } StoreId calendarId; using (ICalendarGroupEntry calendarGroupEntry = base.XsoFactory.BindToCalendarGroupEntry(base.StoreSession, storeObjectId)) { calendarId = calendarGroupEntry.CalendarId; } return(calendarId); }