示例#1
0
        public void Map1To2(TaskItemWrapper source, ITodo target, iCalTimeZone localIcalTimeZone, IEntityMappingLogger logger)
        {
            target.Summary = source.Inner.Subject;

            if (_configuration.MapBody)
            {
                target.Description = source.Inner.Body;
            }

            if (source.Inner.StartDate != _dateNull)
            {
                target.Start = new iCalDateTime(source.Inner.StartDate.Year, source.Inner.StartDate.Month, source.Inner.StartDate.Day, true);
                target.Start.SetTimeZone(localIcalTimeZone);
            }

            if (source.Inner.Complete && source.Inner.DateCompleted != _dateNull)
            {
                target.Completed = new iCalDateTime(source.Inner.DateCompleted.ToUniversalTime())
                {
                    IsUniversalTime = true, HasTime = true
                };
            }

            target.PercentComplete = source.Inner.PercentComplete;

            if (_configuration.MapRecurringTasks)
            {
                MapRecurrance1To2(source.Inner, target, localIcalTimeZone);
            }

            if (source.Inner.DueDate != _dateNull)
            {
                target.Due = new iCalDateTime(source.Inner.DueDate.Year, source.Inner.DueDate.Month, source.Inner.DueDate.Day, 23, 59, 59);
                target.Due.SetTimeZone(localIcalTimeZone);
                // Workaround for a bug in DDay.iCal, according to RFC5545 DUE must not occur together with DURATION
                target.Properties.Remove(new CalendarProperty("DURATION"));
            }

            target.Properties.Set("STATUS", MapStatus1To2(source.Inner.Status));

            if (_configuration.MapPriority)
            {
                target.Priority = CommonEntityMapper.MapPriority1To2(source.Inner.Importance);
            }

            target.Class = CommonEntityMapper.MapPrivacy1To2(source.Inner.Sensitivity, false);

            MapReminder1To2(source, target);

            MapCategories1To2(source, target);

            if (_configuration.MapCustomProperties || _configuration.UserDefinedCustomPropertyMappings.Length > 0)
            {
                using (var userPropertiesWrapper = GenericComObjectWrapper.Create(source.Inner.UserProperties))
                {
                    CommonEntityMapper.MapCustomProperties1To2(userPropertiesWrapper, target.Properties, _configuration.MapCustomProperties, _configuration.UserDefinedCustomPropertyMappings, logger, s_logger);
                }
            }
        }
        public void Map1To2(TaskItemWrapper source, ITodo target, iCalTimeZone localIcalTimeZone)
        {
            target.Summary     = source.Inner.Subject;
            target.Description = source.Inner.Body;

            if (source.Inner.StartDate != _dateNull)
            {
                target.Start = new iCalDateTime(source.Inner.StartDate.Year, source.Inner.StartDate.Month, source.Inner.StartDate.Day, true);
                target.Start.SetTimeZone(localIcalTimeZone);
            }

            if (source.Inner.DueDate != _dateNull)
            {
                target.Due = new iCalDateTime(source.Inner.DueDate.Year, source.Inner.DueDate.Month, source.Inner.DueDate.Day, 23, 59, 59);
                target.Due.SetTimeZone(localIcalTimeZone);
                // Workaround for a bug in DDay.iCal, according to RFC5545 DUE must not occur together with DURATION
                target.Properties.Remove(new CalendarProperty("DURATION"));
            }

            if (source.Inner.Complete && source.Inner.DateCompleted != _dateNull)
            {
                target.Completed = new iCalDateTime(source.Inner.DateCompleted.Year, source.Inner.DateCompleted.Month, source.Inner.DateCompleted.Day, true);
                target.Completed.SetTimeZone(localIcalTimeZone);
            }

            target.PercentComplete = source.Inner.PercentComplete;

            MapRecurrance1To2(source.Inner, target, localIcalTimeZone);

            target.Properties.Set("STATUS", MapStatus1To2(source.Inner.Status));

            target.Priority = CommonEntityMapper.MapPriority1To2(source.Inner.Importance);

            target.Class = CommonEntityMapper.MapPrivacy1To2(source.Inner.Sensitivity, false);

            MapReminder1To2(source, target);

            MapCategories1To2(source, target);
        }