예제 #1
0
        public static void UpdateStatistic(int EMailRouterPop3BoxId, bool IsSuccesfull, string ErrorText, int ProcessedMessageCount)
        {
            EMailRouterPop3BoxActivityRow[] rows = EMailRouterPop3BoxActivityRow.List(EMailRouterPop3BoxId);

            EMailRouterPop3BoxActivityRow activityRow = null;

            if (rows.Length > 0)
            {
                activityRow = rows[0];
            }
            else
            {
                activityRow = new EMailRouterPop3BoxActivityRow();
                activityRow.EMailRouterPop3BoxId = EMailRouterPop3BoxId;
            }

            activityRow.LastRequest = DateTime.UtcNow;
            if (IsSuccesfull)
            {
                activityRow.LastSuccessfulRequest = activityRow.LastRequest;
            }
            activityRow.ErrorText          = ErrorText;
            activityRow.TotalMessageCount += ProcessedMessageCount;

            activityRow.Update();
        }
예제 #2
0
        public static void Activate(int EMailRouterPop3BoxId, bool IsActive)
        {
            if (!CanModify())
            {
                throw new AccessDeniedException();
            }

            if (!CanActivate(EMailRouterPop3BoxId))
            {
                throw new Exception("Can not activate email box with empty mapping block.");
            }

            EMailRouterPop3BoxActivityRow[] rows = EMailRouterPop3BoxActivityRow.List(EMailRouterPop3BoxId);

            EMailRouterPop3BoxActivityRow activityRow = null;

            if (rows.Length > 0)
            {
                activityRow = rows[0];
            }
            else
            {
                activityRow = new EMailRouterPop3BoxActivityRow();
                activityRow.EMailRouterPop3BoxId = EMailRouterPop3BoxId;
            }

            activityRow.IsActive = IsActive;
            activityRow.Update();
        }
예제 #3
0
        /// <summary>
        /// Loads the specified E mail router POP3 box id.
        /// </summary>
        /// <param name="EMailRouterPop3BoxId">The E mail router POP3 box id.</param>
        /// <returns></returns>
        public static EMailRouterPop3BoxActivity Load(int EMailRouterPop3BoxId)
        {
            EMailRouterPop3BoxActivityRow[] rows = EMailRouterPop3BoxActivityRow.List(EMailRouterPop3BoxId);

            if (rows.Length > 0)
            {
                return(new EMailRouterPop3BoxActivity(rows[0]));
            }

            EMailRouterPop3BoxActivityRow newRow = new EMailRouterPop3BoxActivityRow();

            newRow.EMailRouterPop3BoxId = EMailRouterPop3BoxId;

            return(new EMailRouterPop3BoxActivity(newRow));
        }