Пример #1
0
        public void ResetStackData(string errorStackId)
        {
            if (String.IsNullOrEmpty(errorStackId))
            {
                return;
            }

            ErrorStack stack = _errorStackRepository.GetById(errorStackId);

            if (stack == null)
            {
                return;
            }

            try {
                stack.TotalOccurrences = 0;
                stack.LastOccurrence   = DateTime.MinValue.ToUniversalTime();
                stack.FirstOccurrence  = DateTime.MinValue.ToUniversalTime();
                _errorStackRepository.Update(stack);

                _statsHelper.DecrementDayProjectStatsByStackId(stack.ProjectId, errorStackId);
                _statsHelper.DecrementMonthProjectStatsByStackId(stack.ProjectId, errorStackId);

                _errorRepository.RemoveAllByErrorStackId(errorStackId);
                _dayStackStats.RemoveAllByErrorStackId(errorStackId);
                _monthStackStats.RemoveAllByErrorStackId(errorStackId);
            } catch (Exception e) {
                Log.Error().Project(stack.ProjectId).Exception(e).Message("Error resetting stack data.").Report().Write();
                throw;
            }
        }