public static bool NeedLock(DateTime lockDate, ComplianceState state)
 {
     if (lockDate == DateTime.MinValue)
         return false;
     if (state.IsLocked)
         return false;
     var now = GetCurrentBusinessTime();
     var ret = (lockDate - now).TotalDays <= 0;
     return ret;
 }
 public static bool NeedNotifyLock(DateTime lockDate, ComplianceState state)
 {
     if (lockDate == DateTime.MinValue)
         return false;
     var now = GetCurrentBusinessTime();
     var first = (lockDate - now).TotalDays <= FirstLockNotificationDays &&
                 !state.FirstLockNotificationSent;
     var second = (lockDate - now).TotalDays <= SecondLockNotificationDays
                  && !state.SecondLockNotificationSent;
     return first || second;
 }
        public static bool NeedNotifyDelete(DateTime lockDate, ComplianceState state)
        {
            if (lockDate == DateTime.MinValue)
                return false;
            var now = GetCurrentBusinessTime();
            var ret = (now - lockDate).TotalDays >= DeleteNotificationDays &&
                      !state.DeleteNotificationSent;
            if (ret)
            {
                state.DeleteDate = lockDate.AddDays(DeleteDays);
            }

            return ret;
        }