示例#1
0
        public override void ExecuteCmdlet()
        {
            try
            {
                if (!ProcessParameters())
                {
                    return;
                }
                GetBackupResponse backupList = null;
                backupList = StorSimpleClient.GetAllBackups(deviceId, filterType, isAllSelected, IdToPass,
                                                            FromDateTime.ToString(),
                                                            ToDateTime.ToString(), Skip == null ? "0" : Skip.ToString(), First == null ? null : First.ToString());
                WriteObject(backupList.BackupSetsList, true);
                WriteVerbose(string.Format(Resources.BackupsReturnedCount, backupList.BackupSetsList.Count));

                if (backupList.NextPageUri != null &&
                    backupList.NextPageStartIdentifier != "1")
                {
                    if (First != null)
                    {
                        //user has provided First(Top) parameter while calling the commandlet
                        //so we need to provide it to him for calling the next page
                        WriteVerbose(string.Format(Resources.BackupNextPageFormatMessage, First, backupList.NextPageStartIdentifier));
                    }
                    else
                    {
                        //user has NOT provided First(Top) parameter while calling the commandlet
                        //so we DONT need to provide it to him for calling the next page
                        WriteVerbose(string.Format(Resources.BackupNextPagewithNoFirstMessage, backupList.NextPageStartIdentifier));
                    }
                }
                else
                {
                    WriteVerbose(Resources.BackupNoMorePagesMessage);
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }