Wrapper class of ApplicationData from Sync command response.
예제 #1
0
        /// <summary>
        /// Load add commands in sync response.
        /// </summary>
        /// <param name="collectionCommands">The add commands response.</param>
        /// <returns>The list of SyncItem in add commands.</returns>
        public static Collection <SyncItem> LoadAddCommands(Response.SyncCollectionsCollectionCommands collectionCommands)
        {
            if (collectionCommands.Add != null)
            {
                Collection <SyncItem> commands = new Collection <SyncItem>();
                if (collectionCommands.Add.Length > 0)
                {
                    foreach (Response.SyncCollectionsCollectionCommandsAdd addCommand in collectionCommands.Add)
                    {
                        SyncItem syncItem = new SyncItem {
                            ServerId = addCommand.ServerId
                        };
                        for (int i = 0; i < addCommand.ApplicationData.ItemsElementName.Length; i++)
                        {
                            switch (addCommand.ApplicationData.ItemsElementName[i])
                            {
                            case Response.ItemsChoiceType8.Subject1:
                                syncItem.Subject = addCommand.ApplicationData.Items[i].ToString();
                                break;

                            case Response.ItemsChoiceType8.Subject:
                                syncItem.Subject = addCommand.ApplicationData.Items[i].ToString();
                                break;
                            }
                        }

                        commands.Add(syncItem);
                    }
                }

                return(commands);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// Load add commands in sync response.
        /// </summary>
        /// <param name="collectionCommands">The add commands response.</param>
        /// <returns>The list of SyncItem in add commands.</returns>
        public static Collection<SyncItem> LoadAddCommands(Response.SyncCollectionsCollectionCommands collectionCommands)
        {
            if (collectionCommands.Add != null)
            {
                Collection<SyncItem> commands = new Collection<SyncItem>();
                if (collectionCommands.Add.Length > 0)
                {
                    foreach (Response.SyncCollectionsCollectionCommandsAdd addCommand in collectionCommands.Add)
                    {
                        SyncItem syncItem = new SyncItem { ServerId = addCommand.ServerId };
                        for (int i = 0; i < addCommand.ApplicationData.ItemsElementName.Length; i++)
                        {
                            switch (addCommand.ApplicationData.ItemsElementName[i])
                            {
                                case Response.ItemsChoiceType8.Subject1:
                                    syncItem.Subject = addCommand.ApplicationData.Items[i].ToString();
                                    break;
                                case Response.ItemsChoiceType8.Subject:
                                    syncItem.Subject = addCommand.ApplicationData.Items[i].ToString();
                                    break;
                            }
                        }

                        commands.Add(syncItem);
                    }
                }

                return commands;
            }
            else
            {
                return null;
            }
        }