public static ReportState FromTask( DistributedTask task, IHttpContextAccessor httpContextAccessor, int tenantId, Guid userId) { var data = new ReportStateData( task.GetProperty <string>("fileName"), task.GetProperty <string>("tmpFileName"), task.GetProperty <string>("script"), task.GetProperty <int>("reportType"), task.GetProperty <ReportOrigin>("reportOrigin"), null, null, tenantId, userId ); return(new ReportState(null, data, httpContextAccessor) { Id = task.GetProperty <string>("id"), FileId = task.GetProperty <int>("fileId"), Status = task.GetProperty <ReportStatus>("status"), Exception = task.GetProperty <string>("exception") }); }
public static ReportState FromTask(DistributedTask task) { return(new ReportState( task.GetProperty <string>("fileName"), task.GetProperty <string>("tmpFileName"), task.GetProperty <string>("script"), task.GetProperty <int>("reportType"), task.GetProperty <ReportOrigin>("reportOrigin"), null, null) { Id = task.GetProperty <string>("id"), FileId = task.GetProperty <int>("fileId"), Status = task.GetProperty <ReportStatus>("status"), Exception = task.GetProperty <string>("exception") }); }
/// <summary> /// Method for translation mail operation statuses /// </summary> /// <param name="op">instance of DistributedTask</param> /// <returns>translated status text</returns> private static string TranslateMailOperationStatus(DistributedTask op) { var type = op.GetProperty <MailOperationType>(MailOperation.OPERATION_TYPE); var status = op.GetProperty <string>(MailOperation.STATUS); //TODO: Move strings to Resource file switch (type) { case MailOperationType.RemoveMailbox: { var progress = op.GetProperty <MailOperationRemoveMailboxProgress>(MailOperation.PROGRESS); switch (progress) { case MailOperationRemoveMailboxProgress.Init: return("Setup tenant and user"); case MailOperationRemoveMailboxProgress.RemoveFromDb: return("Remove mailbox from Db"); case MailOperationRemoveMailboxProgress.FreeQuota: return("Decrease newly freed quota space"); case MailOperationRemoveMailboxProgress.RecalculateFolder: return("Recalculate folders counters"); case MailOperationRemoveMailboxProgress.ClearCache: return("Clear accounts cache"); case MailOperationRemoveMailboxProgress.Finished: return("Finished"); default: return(status); } } case MailOperationType.RecalculateFolders: { var progress = op.GetProperty <MailOperationRecalculateMailboxProgress>(MailOperation.PROGRESS); switch (progress) { case MailOperationRecalculateMailboxProgress.Init: return("Setup tenant and user"); case MailOperationRecalculateMailboxProgress.CountUnreadMessages: return("Calculate unread messages"); case MailOperationRecalculateMailboxProgress.CountTotalMessages: return("Calculate total messages"); case MailOperationRecalculateMailboxProgress.CountUreadConversation: return("Calculate unread conversations"); case MailOperationRecalculateMailboxProgress.CountTotalConversation: return("Calculate total conversations"); case MailOperationRecalculateMailboxProgress.UpdateFoldersCounters: return("Update folders counters"); case MailOperationRecalculateMailboxProgress.Finished: return("Finished"); default: return(status); } } default: return(status); } }
/// <summary> /// Translates a mail operation status. /// </summary> /// <short>Translate a mail operation status</short> /// <category>Operations</category> /// <param name="op">Instance of distributed task</param> /// <returns>Translated status</returns> private static string TranslateMailOperationStatus(DistributedTask op) { var type = op.GetProperty <MailOperationType>(MailOperation.OPERATION_TYPE); var status = op.GetProperty <string>(MailOperation.STATUS); //TODO: Move strings to Resource file switch (type) { case MailOperationType.DownloadAllAttachments: { var progress = op.GetProperty <MailOperationDownloadAllAttachmentsProgress>(MailOperation.PROGRESS); switch (progress) { case MailOperationDownloadAllAttachmentsProgress.Init: return(MailApiResource.SetupTenantAndUserHeader); case MailOperationDownloadAllAttachmentsProgress.GetAttachments: return(MailApiResource.GetAttachmentsHeader); case MailOperationDownloadAllAttachmentsProgress.Zipping: return(MailApiResource.ZippingAttachmentsHeader); case MailOperationDownloadAllAttachmentsProgress.ArchivePreparation: return(MailApiResource.PreparationArchiveHeader); case MailOperationDownloadAllAttachmentsProgress.CreateLink: return(MailApiResource.CreatingLinkHeader); case MailOperationDownloadAllAttachmentsProgress.Finished: return(MailApiResource.FinishedHeader); default: return(status); } } case MailOperationType.RemoveMailbox: { var progress = op.GetProperty <MailOperationRemoveMailboxProgress>(MailOperation.PROGRESS); switch (progress) { case MailOperationRemoveMailboxProgress.Init: return("Setup tenant and user"); case MailOperationRemoveMailboxProgress.RemoveFromDb: return("Remove mailbox from Db"); case MailOperationRemoveMailboxProgress.FreeQuota: return("Decrease newly freed quota space"); case MailOperationRemoveMailboxProgress.RecalculateFolder: return("Recalculate folders counters"); case MailOperationRemoveMailboxProgress.ClearCache: return("Clear accounts cache"); case MailOperationRemoveMailboxProgress.Finished: return("Finished"); default: return(status); } } case MailOperationType.RecalculateFolders: { var progress = op.GetProperty <MailOperationRecalculateMailboxProgress>(MailOperation.PROGRESS); switch (progress) { case MailOperationRecalculateMailboxProgress.Init: return("Setup tenant and user"); case MailOperationRecalculateMailboxProgress.CountUnreadMessages: return("Calculate unread messages"); case MailOperationRecalculateMailboxProgress.CountTotalMessages: return("Calculate total messages"); case MailOperationRecalculateMailboxProgress.CountUreadConversation: return("Calculate unread conversations"); case MailOperationRecalculateMailboxProgress.CountTotalConversation: return("Calculate total conversations"); case MailOperationRecalculateMailboxProgress.UpdateFoldersCounters: return("Update folders counters"); case MailOperationRecalculateMailboxProgress.CountUnreadUserFolderMessages: return("Calculate unread messages in user folders"); case MailOperationRecalculateMailboxProgress.CountTotalUserFolderMessages: return("Calculate total messages in user folders"); case MailOperationRecalculateMailboxProgress.CountUreadUserFolderConversation: return("Calculate unread conversations in user folders"); case MailOperationRecalculateMailboxProgress.CountTotalUserFolderConversation: return("Calculate total conversations in user folders"); case MailOperationRecalculateMailboxProgress.UpdateUserFoldersCounters: return("Update user folders counters"); case MailOperationRecalculateMailboxProgress.Finished: return("Finished"); default: return(status); } } case MailOperationType.RemoveUserFolder: { var progress = op.GetProperty <MailOperationRemoveUserFolderProgress>(MailOperation.PROGRESS); switch (progress) { case MailOperationRemoveUserFolderProgress.Init: return("Setup tenant and user"); case MailOperationRemoveUserFolderProgress.MoveMailsToTrash: return("Move mails into Trash folder"); case MailOperationRemoveUserFolderProgress.DeleteFolders: return("Delete folder"); case MailOperationRemoveUserFolderProgress.Finished: return("Finished"); default: return(status); } } default: return(status); } }