Example #1
0
 public string CreateDeleteSyncJob(bool create, int interval)
 {
     try {
         if (create)
         {
             MailSynchronizer.CreateSyncJob(UserConnection, interval);
         }
         else
         {
             MailSynchronizer.RemoveSyncJob(UserConnection);
         }
     } catch (ImapException e) {
         return(e.Message);
     }
     return(string.Empty);
 }
Example #2
0
        /// <summary>
        /// Creates (or deletes, if necessary) Imap synchronization job.
        /// </summary>
        /// <param name="userConnection">User connection.</param>
        /// <param name="interval">Synchronization interval.</param>
        /// <param name="create">Determines if synchronization job creation is necessary.</param>
        /// <param name="senderEmailAddress">Sender email address.</param>
        private string CreateDeleteImapJob(UserConnection userConnection, int interval, bool create,
                                           string senderEmailAddress)
        {
            var parameters = new Dictionary <string, object> {
                { "SenderEmailAddress", senderEmailAddress },
                { "CurrentUserId", userConnection.CurrentUser.Id }
            };

            if (create)
            {
                MailSynchronizer.CreateSyncJob(userConnection, interval, parameters);
            }
            else
            {
                MailSynchronizer.RemoveSyncJob(userConnection, parameters);
            }
            return(string.Empty);
        }