Пример #1
0
        public override string AsString()
        {
            string resultTimeString = "";

            if (NumberOfPointsInUse > 0)
            {
                resultTimeString += DayInMonthValue.ToString("D2");
            }
            if (NumberOfPointsInUse > 1)
            {
                resultTimeString += ".";
                resultTimeString += MonthValue.ToString("D2");;
            }
            if (NumberOfPointsInUse > 2)
            {
                resultTimeString += ".";
                resultTimeString += "20" + YearValue.ToString("D2");
            }
            if (NumberOfPointsInUse > 3)
            {
                resultTimeString += "  ";
                resultTimeString += HoursValue.ToString("D2");;
            }
            if (NumberOfPointsInUse > 4)
            {
                resultTimeString += ":";
                resultTimeString += MinutesValue.ToString("D2");;
            }
            if (NumberOfPointsInUse > 5)
            {
                resultTimeString += ":";
                resultTimeString += SecondsValue.ToString("D2");;
            }
            if (NumberOfPointsInUse > 6)
            {
                resultTimeString += ",";
                resultTimeString += MillisecondsValue.ToString("D" + MillisecondsDecimalsPlaces);
            }


            return(resultTimeString);
        }
Пример #2
0
        /// <summary>
        /// Gets the analysis month value.
        /// </summary>
        /// <typeparam name="T">The actual type of scores.</typeparam>
        /// <param name="month">The month corresponding to scores.</param>
        /// <param name="scores">The scores.</param>
        /// <returns>The analysis month value.</returns>
        private static OverallThresholdAnalysisMonthValue GetAnalysisMonthValue <T>(MonthValue month, IList <T> scores)
            where T : KPIScore
        {
            var result = new OverallThresholdAnalysisMonthValue();

            result.OverallScore = GetOverallScore(scores);
            result.Month        = month;
            if (result.OverallScore >= ExceedingTarget)
            {
                result.Rating = OverallThresholdAnalysisRating.ExceedingTargets;
            }
            else if (result.OverallScore >= MeetingTarget)
            {
                result.Rating = OverallThresholdAnalysisRating.MeetingTargets;
            }
            else
            {
                result.Rating = OverallThresholdAnalysisRating.BelowTargets;
            }
            return(result);
        }
Пример #3
0
 /// <summary>
 /// Validates that today is allowed date to perform action based on year, month and allowed input days.
 /// </summary>
 /// <param name="yearValue">The year value.</param>
 /// <param name="monthValue">The month value.</param>
 /// <param name="inputAllowedInDays">The allowed input in days.</param>
 /// <exception cref="BusinessProcessingException">
 /// If current action is forbidden due to restriction of input allowed days.
 /// </exception>
 /// <exception cref="ArgumentException">
 /// If <paramref name="yearValue"/> or <paramref name="monthValue"/> is null or cannot be parsed.
 /// </exception>
 internal static void ValidateTodayIsAllowedUpdateDate(
     YearValue yearValue, MonthValue monthValue, int inputAllowedInDays)
 {
     try
     {
         int      month   = DateTime.ParseExact(monthValue?.Value, "MMMM", CultureInfo.InvariantCulture).Month;
         int      year    = Convert.ToInt32(yearValue?.Value);
         DateTime maxDate = new DateTime(year, month, 1).AddDays(inputAllowedInDays);
         if (DateTime.Today > maxDate)
         {
             throw new BusinessProcessingException(
                       "Current action is forbidden due to restriction of input allowed days.");
         }
     }
     catch (BusinessProcessingException)
     {
         throw;
     }
     catch (Exception ex)
     {
         throw new ArgumentException(
                   $"Either Year='{yearValue?.Value}' or Month='{monthValue?.Value}' is invalid.", ex);
     }
 }