/// <summary>
        /// Deserialize to object instance from SyncCollectionsCollectionCommandsChangeApplicationData
        /// </summary>
        /// <typeparam name="T">The generic type parameter</typeparam>
        /// <param name="applicationData">The application data which contains new changed information</param>
        /// <returns>The object instance</returns>
        public static T DeserializeFromChangeApplicationData <T>(Response.SyncCollectionsCollectionCommandsChangeApplicationData applicationData)
        {
            T obj = Activator.CreateInstance <T>();

            if (applicationData.ItemsElementName.Length > 0)
            {
                for (int itemIndex = 0; itemIndex < applicationData.ItemsElementName.Length; itemIndex++)
                {
                    switch (applicationData.ItemsElementName[itemIndex])
                    {
                    case Response.ItemsChoiceType7.Categories1:
                    case Response.ItemsChoiceType7.Categories2:
                    case Response.ItemsChoiceType7.Categories3:
                    case Response.ItemsChoiceType7.Categories4:
                    case Response.ItemsChoiceType7.Recurrence1:
                    case Response.ItemsChoiceType7.Sensitivity1:
                    case Response.ItemsChoiceType7.Subject1:
                    case Response.ItemsChoiceType7.Subject2:
                    case Response.ItemsChoiceType7.Subject3:
                        break;

                    default:
                        SetCalendarPropertyValue(obj, applicationData.ItemsElementName[itemIndex].ToString(), applicationData.Items[itemIndex]);
                        break;
                    }
                }
            }

            return(obj);
        }
        /// <summary>
        /// Deserialize to object instance from SyncCollectionsCollectionCommandsChangeApplicationData.
        /// </summary>
        /// <typeparam name="T">The generic type parameter.</typeparam>
        /// <param name="applicationData">The application data which contains changes information.</param>
        /// <returns>The returned instance.</returns>
        public static T DeserializeFromChangeApplicationData <T>(Response.SyncCollectionsCollectionCommandsChangeApplicationData applicationData)
        {
            T obj = Activator.CreateInstance <T>();

            if (applicationData.ItemsElementName.Length > 0)
            {
                for (int itemIndex = 0; itemIndex < applicationData.ItemsElementName.Length; itemIndex++)
                {
                    switch (applicationData.ItemsElementName[itemIndex])
                    {
                    case Response.ItemsChoiceType7.Categories:
                    case Response.ItemsChoiceType7.Categories2:
                    case Response.ItemsChoiceType7.Categories3:
                    case Response.ItemsChoiceType7.Categories4:
                        break;

                    case Response.ItemsChoiceType7.Categories1:
                        Common.SetSpecifiedPropertyValueByName(obj, "Categories", applicationData.Items[itemIndex]);
                        break;

                    default:
                        Common.SetSpecifiedPropertyValueByName(obj, applicationData.ItemsElementName[itemIndex].ToString(), applicationData.Items[itemIndex]);
                        break;
                    }
                }
            }

            return(obj);
        }
Exemple #3
0
        /// <summary>
        /// Get note instance from the ApplicationData element of Sync change response
        /// </summary>
        /// <typeparam name="T">The generic type parameter</typeparam>
        /// <param name="applicationData">The data which contains information for note</param>
        /// <returns>The returned instance</returns>
        public static T DeserializeFromChangeApplicationData <T>(Response.SyncCollectionsCollectionCommandsChangeApplicationData applicationData)
        {
            T obj = Activator.CreateInstance <T>();

            if (applicationData.ItemsElementName.Length > 0)
            {
                for (int itemIndex = 0; itemIndex < applicationData.ItemsElementName.Length; itemIndex++)
                {
                    switch (applicationData.ItemsElementName[itemIndex])
                    {
                    case Response.ItemsChoiceType7.Categories:
                    case Response.ItemsChoiceType7.Categories1:
                    case Response.ItemsChoiceType7.Categories2:
                    case Response.ItemsChoiceType7.Categories4:
                    case Response.ItemsChoiceType7.Subject:
                    case Response.ItemsChoiceType7.Subject1:
                    case Response.ItemsChoiceType7.Subject3:
                    case Response.ItemsChoiceType7.LastModifiedDate:
                    case Response.ItemsChoiceType7.MessageClass:
                        break;

                    case Response.ItemsChoiceType7.Categories3:
                        Common.SetSpecifiedPropertyValueByName(obj, "Categories", applicationData.Items[itemIndex]);
                        break;

                    case Response.ItemsChoiceType7.Subject2:
                        Common.SetSpecifiedPropertyValueByName(obj, "Subject", applicationData.Items[itemIndex]);
                        break;

                    case Response.ItemsChoiceType7.Body:
                        Common.SetSpecifiedPropertyValueByName(obj, "Body", applicationData.Items[itemIndex]);
                        break;

                    case Response.ItemsChoiceType7.LastModifiedDate1:
                        string lastModifiedDateString = applicationData.Items[itemIndex].ToString();
                        if (!string.IsNullOrEmpty(lastModifiedDateString))
                        {
                            Common.SetSpecifiedPropertyValueByName(obj, "IsLastModifiedDateSpecified", true);
                            Common.SetSpecifiedPropertyValueByName(obj, "LastModifiedDate", Common.GetNoSeparatorDateTime(lastModifiedDateString));
                            Common.SetSpecifiedPropertyValueByName(obj, "LastModifiedDateString", lastModifiedDateString);
                        }

                        break;

                    case Response.ItemsChoiceType7.MessageClass1:
                        Common.SetSpecifiedPropertyValueByName(obj, "MessageClass", applicationData.Items[itemIndex]);
                        break;

                    default:
                        Common.SetSpecifiedPropertyValueByName(obj, applicationData.ItemsElementName[itemIndex].ToString(), applicationData.Items[itemIndex]);
                        break;
                    }
                }
            }

            return(obj);
        }
Exemple #4
0
        /// <summary>
        /// Deserialize to object instance from SyncCollectionsCollectionCommandsChangeApplicationData
        /// </summary>
        /// <typeparam name="T">The generic type parameter</typeparam>
        /// <param name="applicationData">The application data which contains changes information</param>
        /// <returns>The returned instance</returns>
        public static T DeserializeFromChangeApplicationData <T>(Response.SyncCollectionsCollectionCommandsChangeApplicationData applicationData)
        {
            T obj = Activator.CreateInstance <T>();

            if (applicationData.ItemsElementName.Length > 0)
            {
                for (int itemIndex = 0; itemIndex < applicationData.ItemsElementName.Length; itemIndex++)
                {
                    switch (applicationData.ItemsElementName[itemIndex])
                    {
                    case Response.ItemsChoiceType7.Categories:
                    case Response.ItemsChoiceType7.Categories1:
                    case Response.ItemsChoiceType7.Categories3:
                    case Response.ItemsChoiceType7.Categories4:
                    case Response.ItemsChoiceType7.Importance1:
                    case Response.ItemsChoiceType7.MessageClass1:
                    case Response.ItemsChoiceType7.Subject:
                    case Response.ItemsChoiceType7.Subject2:
                    case Response.ItemsChoiceType7.Subject3:
                        break;

                    case Response.ItemsChoiceType7.Read:
                        Common.SetSpecifiedPropertyValueByName(obj, "ReadIsInclude", true);
                        Common.SetSpecifiedPropertyValueByName(obj, "Read", applicationData.Items[itemIndex]);
                        break;

                    case Response.ItemsChoiceType7.Flag:
                        Common.SetSpecifiedPropertyValueByName(obj, "FlagIsInclude", true);
                        Common.SetSpecifiedPropertyValueByName(obj, "Flag", applicationData.Items[itemIndex]);
                        break;

                    case Response.ItemsChoiceType7.Categories2:
                        Common.SetSpecifiedPropertyValueByName(obj, "Categories", applicationData.Items[itemIndex]);
                        Common.SetSpecifiedPropertyValueByName(obj, "CategoriesIsInclude", true);
                        break;

                    case Response.ItemsChoiceType7.Subject1:
                        Common.SetSpecifiedPropertyValueByName(obj, "Subject", applicationData.Items[itemIndex]);
                        break;

                    case Response.ItemsChoiceType7.Bcc:
                        Common.SetSpecifiedPropertyValueByName(obj, "Bcc", applicationData.Items[itemIndex]);
                        break;

                    case Response.ItemsChoiceType7.IsDraft:
                        Common.SetSpecifiedPropertyValueByName(obj, "IsDraft", applicationData.Items[itemIndex]);
                        break;

                    case Response.ItemsChoiceType7.Cc:
                        Common.SetSpecifiedPropertyValueByName(obj, "CC", applicationData.Items[itemIndex]);
                        break;

                    default:
                        Common.SetSpecifiedPropertyValueByName(obj, applicationData.ItemsElementName[itemIndex].ToString(), applicationData.Items[itemIndex]);
                        break;
                    }
                }
            }

            return(obj);
        }