コード例 #1
0
ファイル: AppraiserAsync.cs プロジェクト: Vasar007/ProjectV
        public RatingDataContainer GetRatings(BasicInfo entityInfo, bool outputResults)
        {
            if (!(entityInfo is T convertedInfo))
            {
                throw new ArgumentException(
                          $"Element \"{entityInfo.Title}\" (ID = {entityInfo.ThingId.ToString()}) " +
                          $"type \"{entityInfo.GetType().FullName}\" is invalid for appraiser with " +
                          $"type \"{TypeId.FullName}\"."
                          );
            }

            double ratingValue = _appraisal.CalculateRating(convertedInfo);

            var resultInfo = new RatingDataContainer(entityInfo, ratingValue, RatingId);

            if (outputResults)
            {
                GlobalMessageHandler.OutputMessage(resultInfo.ToString());
            }

            return(resultInfo);
        }