Example #1
0
        /// <summary>
        /// Returns mailbox last email recived date. When date is older thn synchronization period, then period used.
        /// </summary>
        /// <param name="mailboxId">Mailbox unique identifier.</param>
        ///
        /// <returns>Mailbox last email recived date.</returns>
        public static DateTime GetFailoverPeriodStartDate(Mailbox mailbox, UserConnection uc)
        {
            var lastEmailDate = mailbox.GetLastEmailSyncDate(uc);
            var periodDate    = mailbox.GetLoadFromDate(uc);
            var date          = new List <DateTime> {
                periodDate.Date,
                lastEmailDate
            }.Max();

            return(TimeZoneInfo.ConvertTime(date, TimeZoneInfo.Utc, uc.CurrentUser.TimeZone));
        }
        /// <summary>
        /// Returns mailbox last email recived date. When date is older thn synchronization period, then perion used.
        /// </summary>
        /// <param name="mailboxId">Mailbox unique identifier.</param>
        /// <returns>Mailbox last email recived date.</returns>
        private DateTime GetLastEmailDate(Mailbox mailbox)
        {
            var lastEmailDate = mailbox.GetLastEmailSyncDate(UserConnection);
            var periodDate    = mailbox.GetLoadFromDate(UserConnection);
            var date          = new List <DateTime> {
                periodDate.Date,
                lastEmailDate
            }.Max();

            return(TimeZoneInfo.ConvertTime(date, TimeZoneInfo.Utc, UserConnection.CurrentUser.TimeZone));
        }