Example #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();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="EMailRouterPop3BoxActivity"/> class.
 /// </summary>
 /// <param name="row">The row.</param>
 private EMailRouterPop3BoxActivity(EMailRouterPop3BoxActivityRow row)
 {
     _srcRow = row;
 }
Example #3
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();
        }
        /// <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);
        }