public void ProcessFullEmail(LoadEmailCommand emailsData) { _log.Info($"ProcessFullEmail id = {emailsData.SubscriptionInfo.Id}," + $" username= {emailsData.SubscriptionInfo.SysAdminUnit}, emails = {GetReadableEmailsList(emailsData.Emails)}"); var emailEventsProcessor = ClassFactory.Get <IEmailEventsProcessor>(); emailEventsProcessor.ProcessLoadEmailCommand(emailsData); }
public void ProcessFullEmail(LoadEmailCommand emailsData) { if (emailsData.Emails.IsNullOrEmpty()) { _log.Warn($"ProcessFullEmail for = {emailsData.SubscriptionInfo.Id} stopped - no emails passed"); return; } _log.Info($"ProcessFullEmail id = {emailsData.SubscriptionInfo.Id}," + $" username= {emailsData.SubscriptionInfo.SysAdminUnit}, emails = {GetReadableEmailsList(emailsData.Emails)}"); var emailEventsProcessor = ClassFactory.Get <IEmailEventsProcessor>(); emailEventsProcessor.ProcessLoadEmailCommand(emailsData); }
/// <summary> /// Creates user connection and starts <paramref name="emailsData"/> synchronization. /// </summary> /// <param name="emailsData"><see cref="LoadEmailCommand"/> instance.</param> public void ProcessLoadEmailCommand(LoadEmailCommand emailsData) { _log.Info($"ProcessLoadEmailCommand for {emailsData.SubscriptionInfo.MailboxId} started."); var userName = emailsData.SubscriptionInfo.SysAdminUnit; var userConnection = CreateUserConnection(userName, emailsData.SubscriptionInfo.TimeZoneId); _log.Info($"UserConnection for {emailsData.SubscriptionInfo.SysAdminUnit} created."); try { StartSynchronization(userConnection, emailsData); } finally { userConnection?.Close(SessionEndMethod.Logout, false); } _log.Info($"ProcessLoadEmailCommand for {emailsData.SubscriptionInfo.MailboxId} ended."); }
/// <summary> /// Starts <paramref name="emailsData"/> synchronization. /// </summary> /// <param name="userConnection"><see cref="UserConnection"/> instance.</param> /// <param name="emailsData"><see cref="LoadEmailCommand"/> instance.</param> protected void StartSynchronization(UserConnection userConnection, LoadEmailCommand emailsData) { Guid mailboxSyncSettingsId = emailsData.SubscriptionInfo.MailboxId; CheckMailboxAvaliable(userConnection, mailboxSyncSettingsId); var parameters = new Dictionary <string, object> { { "MailboxId", mailboxSyncSettingsId }, { "Items", emailsData.Emails } }; _log.Info($"StartSynchronization mailbox {mailboxSyncSettingsId} avaliable."); ValidateEvent(userConnection, parameters); _log.Info($"StartSynchronization mailbox {mailboxSyncSettingsId} valid."); Terrasoft.Core.Tasks.Task.StartNewWithUserConnection <LoadEmailEventExecutor, IDictionary <string, object> >(parameters); }
/// <summary> /// Creates user connection and starts <paramref name="emailsData"/> synchronization. /// </summary> /// <param name="emailsData"><see cref="LoadEmailCommand"/> instance.</param> public void ProcessLoadEmailCommand(LoadEmailCommand emailsData) { var userName = emailsData.SubscriptionInfo.SysAdminUnit; var userConnection = CreateUserConnection(userName, emailsData.SubscriptionInfo.TimeZoneId); _log = ClassFactory.Get <ISynchronizationLogger>(new ConstructorArgument("userId", userConnection.CurrentUser.Id)); _log.Info($"UserConnection for {emailsData.SubscriptionInfo.SysAdminUnit} created."); try { StartSynchronization(userConnection, emailsData); } finally { userConnection?.Close(SessionEndMethod.Logout, false); } _log.Info($"ProcessLoadEmailCommand for {emailsData.SubscriptionInfo.MailboxId} ended."); }