예제 #1
0
        /// <summary>
        /// Deserialize to object instance from SyncCollectionsCollectionCommandsAddApplicationData
        /// </summary>
        /// <typeparam name="T">The generic type parameter</typeparam>
        /// <param name="applicationData">The application data which contains new added information</param>
        /// <returns>The object instance</returns>
        public static T DeserializeFromAddApplicationData <T>(Response.SyncCollectionsCollectionCommandsAddApplicationData 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.ItemsChoiceType8.Categories1:
                    case Response.ItemsChoiceType8.Categories2:
                    case Response.ItemsChoiceType8.Categories3:
                    case Response.ItemsChoiceType8.Categories4:
                    case Response.ItemsChoiceType8.Recurrence1:
                    case Response.ItemsChoiceType8.Sensitivity1:
                    case Response.ItemsChoiceType8.Subject1:
                    case Response.ItemsChoiceType8.Subject2:
                    case Response.ItemsChoiceType8.Subject3:
                        break;

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

            return(obj);
        }
예제 #2
0
        /// <summary>
        /// Deserialize to object instance from SyncCollectionsCollectionCommandsAddApplicationData.
        /// </summary>
        /// <typeparam name="T">The generic type parameter.</typeparam>
        /// <param name="applicationData">The application data which contains new added information.</param>
        /// <returns>The returned instance.</returns>
        public static T DeserializeFromAddApplicationData <T>(Response.SyncCollectionsCollectionCommandsAddApplicationData 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.ItemsChoiceType8.Categories:
                    case Response.ItemsChoiceType8.Categories2:
                    case Response.ItemsChoiceType8.Categories3:
                    case Response.ItemsChoiceType8.Categories4:
                        break;

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

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

            return(obj);
        }
예제 #3
0
        /// <summary>
        /// Get note instance from the ApplicationData element of Sync add 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 DeserializeFromAddApplicationData <T>(Response.SyncCollectionsCollectionCommandsAddApplicationData 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.ItemsChoiceType8.Categories:
                    case Response.ItemsChoiceType8.Categories1:
                    case Response.ItemsChoiceType8.Categories2:
                    case Response.ItemsChoiceType8.Categories4:
                    case Response.ItemsChoiceType8.Subject:
                    case Response.ItemsChoiceType8.Subject1:
                    case Response.ItemsChoiceType8.Subject3:
                    case Response.ItemsChoiceType8.LastModifiedDate:
                    case Response.ItemsChoiceType8.MessageClass:
                        break;

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

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

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

                    case Response.ItemsChoiceType8.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.ItemsChoiceType8.MessageClass1:
                        Common.SetSpecifiedPropertyValueByName(obj, "MessageClass", applicationData.Items[itemIndex]);
                        break;

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

            return(obj);
        }
예제 #4
0
        /// <summary>
        /// Deserialize to object instance from SyncCollectionsCollectionCommandsAddApplicationData"
        /// </summary>
        /// <typeparam name="T">The generic type parameter</typeparam>
        /// <param name="applicationData">The application data which contains new added information</param>
        /// <returns>The returned instance</returns>
        public static T DeserializeFromAddApplicationData <T>(Response.SyncCollectionsCollectionCommandsAddApplicationData 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.ItemsChoiceType8.Categories:
                    case Response.ItemsChoiceType8.Categories1:
                    case Response.ItemsChoiceType8.Categories3:
                    case Response.ItemsChoiceType8.Categories4:
                    case Response.ItemsChoiceType8.Importance1:
                    case Response.ItemsChoiceType8.MessageClass1:
                    case Response.ItemsChoiceType8.Subject:
                    case Response.ItemsChoiceType8.Subject2:
                    case Response.ItemsChoiceType8.Subject3:
                        break;

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

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

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

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

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

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

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

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

            return(obj);
        }