Ejemplo n.º 1
0
        public Task <bool> TryDelete(
            string entityId,
            DateTime version,
            Tcontext context)
        {
            var entityWithId = Get(new[] { entityId }, NullLoadEntityLogger.Instance, default(Tcontext)).Result.SingleOrDefault();

            if (entityWithId == null)
            {
                return(Task.FromResult(true));
            }

            using (var contact = entityWithId.Entity)
            {
                if (!contact.Inner.Birthday.Equals(OutlookUtility.OUTLOOK_DATE_NONE))
                {
                    try
                    {
                        Byte[] ba = contact.Inner.GetPropertySafe(PR_ASSOCIATED_BIRTHDAY_APPOINTMENT_ID);
                        string birthdayAppointmentItemID        = BitConverter.ToString(ba).Replace("-", string.Empty);
                        IAppointmentItemWrapper birthdayWrapper = _comWrapperFactory.Create(_session.GetAppointmentItem(birthdayAppointmentItemID),
                                                                                            entryId => _session.GetAppointmentItem(birthdayAppointmentItemID));
                        birthdayWrapper.Inner.Delete();
                    }
                    catch (COMException ex)
                    {
                        s_logger.Error("Could not delete associated Birthday Appointment.", ex);
                    }
                }
                contact.Inner.Delete();
            }

            return(Task.FromResult(true));
        }
        private async Task DeleteAppointment(IAppointmentItemWrapper item, Dictionary <AppointmentId, IEntityRelationData <AppointmentId, DateTime, WebResourceName, string> > relations)
        {
            IEntityRelationData <AppointmentId, DateTime, WebResourceName, string> relation;
            var appointmentId = new AppointmentId(item.Inner.EntryID, item.Inner.GlobalAppointmentID);

            if (relations.TryGetValue(appointmentId, out relation))
            {
                await _btypeRepository.TryDelete(relation.BtypeId, relation.BtypeVersion, NullEventSynchronizationContext.Instance);

                relations.Remove(appointmentId);
            }
            item.Inner.Delete();
        }
Ejemplo n.º 3
0
 public TestAppointmentItemWrapper(Action <TestAppointmentItemWrapper> onDisposed, IAppointmentItemWrapper inner)
     : base(onDisposed)
 {
     _inner = inner ?? throw new ArgumentNullException(nameof(inner));
 }