Exemple #1
0
        // Token: 0x06000FDC RID: 4060 RVA: 0x0005A2CC File Offset: 0x000584CC
        protected override void InternalCopyFrom(IProperty srcProperty)
        {
            IExceptionsProperty exceptionsProperty = srcProperty as IExceptionsProperty;

            if (exceptionsProperty == null)
            {
                throw new UnexpectedTypeException("IExceptionsProperty", srcProperty);
            }
            base.XmlNode = base.XmlParentNode.OwnerDocument.CreateElement(base.AirSyncTagNames[0], base.Namespace);
            foreach (ExceptionInstance exceptionInstance in exceptionsProperty)
            {
                XmlNode           xmlNode = base.XmlParentNode.OwnerDocument.CreateElement("Exception", base.Namespace);
                AirSyncDataObject innerAirSyncDataObject = this.schemaState.GetInnerAirSyncDataObject(this.missingPropertyStrategy);
                try
                {
                    innerAirSyncDataObject.Bind(xmlNode);
                    if (exceptionInstance.Deleted == 1)
                    {
                        XmlNode xmlNode2 = base.XmlParentNode.OwnerDocument.CreateElement("Deleted", base.Namespace);
                        xmlNode2.InnerText = "1";
                        xmlNode.AppendChild(xmlNode2);
                        XmlNode xmlNode3 = base.XmlParentNode.OwnerDocument.CreateElement("ExceptionStartTime", base.Namespace);
                        xmlNode3.InnerText = exceptionInstance.ExceptionStartTime.ToString("yyyyMMdd\\THHmmss\\Z", DateTimeFormatInfo.InvariantInfo);
                        xmlNode.AppendChild(xmlNode3);
                    }
                    else
                    {
                        innerAirSyncDataObject.CopyFrom(exceptionInstance.ModifiedException);
                    }
                }
                finally
                {
                    innerAirSyncDataObject.Unbind();
                }
                base.XmlNode.AppendChild(xmlNode);
            }
            if (base.XmlNode.HasChildNodes)
            {
                base.XmlParentNode.AppendChild(base.XmlNode);
            }
        }
Exemple #2
0
        protected override void InternalCopyFromModified(IProperty srcProperty)
        {
            CalendarItem        calendarItem       = base.XsoItem as CalendarItem;
            IExceptionsProperty exceptionsProperty = srcProperty as IExceptionsProperty;
            XsoDataObject       xsoDataObject      = null;

            foreach (ExceptionInstance exceptionInstance in exceptionsProperty)
            {
                ExDateTime exDateTime  = ExTimeZone.UtcTimeZone.ConvertDateTime(exceptionInstance.ExceptionStartTime);
                ExDateTime exDateTime2 = calendarItem.ExTimeZone.ConvertDateTime(exDateTime);
                if (exceptionInstance.Deleted == 1)
                {
                    if (calendarItem.Id == null)
                    {
                        calendarItem.Save(SaveMode.ResolveConflicts);
                        calendarItem.Load();
                    }
                    try
                    {
                        this.ValidateCalendarItem(calendarItem);
                        calendarItem.DeleteOccurrenceByOriginalStartTime(exDateTime2);
                        continue;
                    }
                    catch (OccurrenceNotFoundException)
                    {
                        AirSyncDiagnostics.TraceDebug <ExDateTime>(ExTraceGlobals.XsoTracer, this, "Exception with OriginalStartTime: {0} already deleted.", exDateTime2);
                        continue;
                    }
                }
                if (xsoDataObject == null)
                {
                    xsoDataObject = this.schemaState.GetInnerXsoDataObject();
                }
                CalendarItemOccurrence calendarItemOccurrence = null;
                try
                {
                    if (calendarItem.Id != null)
                    {
                        this.ValidateCalendarItem(calendarItem);
                        calendarItemOccurrence = calendarItem.OpenOccurrenceByOriginalStartTime(exDateTime2, xsoDataObject.GetPrefetchProperties());
                    }
                    else
                    {
                        AirSyncDiagnostics.TraceDebug(ExTraceGlobals.XsoTracer, this, "New calendar recurrence item added with exceptions.  Extra save (RPC to store) needed for this");
                        calendarItem.Save(SaveMode.ResolveConflicts);
                        calendarItem.Load();
                        this.ValidateCalendarItem(calendarItem);
                        calendarItemOccurrence = calendarItem.OpenOccurrenceByOriginalStartTime(exDateTime2, xsoDataObject.GetPrefetchProperties());
                    }
                    if (calendarItemOccurrence == null)
                    {
                        throw new ConversionException("Could not open the Calendar Occurrence using the Original StartTime");
                    }
                    calendarItemOccurrence.OpenAsReadWrite();
                    try
                    {
                        xsoDataObject.Bind(calendarItemOccurrence);
                        xsoDataObject.CopyFrom(exceptionInstance.ModifiedException);
                    }
                    finally
                    {
                        xsoDataObject.Unbind();
                    }
                    calendarItemOccurrence.Save(SaveMode.NoConflictResolution);
                }
                finally
                {
                    if (calendarItemOccurrence != null)
                    {
                        calendarItemOccurrence.Dispose();
                    }
                }
            }
        }