예제 #1
0
 private BackupRequest ToBackupRequest(BackupResult result)
 {
     return new BackupRequest
     {
         Id = result.Id,
         Completed = result.Completed,
         FileLink = result.Link,
         Percentdone = result.Percent,
         Status = BackupRequestStatus.Started,
     };
 }
예제 #2
0
 private static string ToJsonSuccess(BackupResult result)
 {
     return JsonConvert.SerializeObject(new {success = true, data = result});
 }
 private static string ToJsonSuccess(BackupResult result)
 {
     var data = new { result.Completed, result.Id, result.Percent };
     return JsonConvert.SerializeObject(new { success = true, data });
 }
예제 #4
0
        private static BackupResult ToResult(IProgressItem task)
        {
            if (task == null)
                return null;

            if (task.Error != null)
                throw new FaultException(((Exception)task.Error).Message);

            var result = new BackupResult
                {
                    Id = task.Id.ToString(),
                    Completed = task.IsCompleted,
                    Percent = (int)task.Percentage,
                };

            var backupTask = task as BackupTask;
            if (backupTask != null)
            {
                result.Link = task.Status as string;
                result.ExpireDate = backupTask.ExpireDate;
            }
            return result;
        }
 private static ProgressInfo ToProgressInfo(BackupResult response)
 {
     return new ProgressInfo
         {
             IsCompleted = response.Completed,
             Progress = response.Percent,
             Link = response.Link
         };
 }