public int?GetFeedbackValue(FeedbackPeriod amazonTimePeriod, FeedbackType feedbackType) { if (FeedbackHistory == null) { return(null); } return(FeedbackHistory.GetFeedbackHistoryValue(amazonTimePeriod, feedbackType)); }
private void ParceAndSaveUserFeedbackInfo(IDatabaseCustomerMarketPlace databaseCustomerMarketPlace, AmazonUserRatingInfo ratingInfo, MP_CustomerMarketplaceUpdatingHistory historyRecord) { var submittedDate = ratingInfo.SubmittedDate; var data = new DatabaseAmazonFeedbackData(submittedDate) { UserRaining = ratingInfo.Rating }; var timePeriodsFeedback = new[] { TimePeriodEnum.Month, TimePeriodEnum.Month3, TimePeriodEnum.Year, TimePeriodEnum.Lifetime }; foreach (var timePeriod in timePeriodsFeedback) { FeedbackPeriod amazonTimePeriod = AmazonDatabaseTypeConverter.ConvertToAmazonTimePeriod(timePeriod); var count = ratingInfo.GetFeedbackValue(amazonTimePeriod, FeedbackType.Count); var negativePercent = ratingInfo.GetFeedbackValue(amazonTimePeriod, FeedbackType.Negative); var neutralPercent = ratingInfo.GetFeedbackValue(amazonTimePeriod, FeedbackType.Neutral); var positivePercent = ratingInfo.GetFeedbackValue(amazonTimePeriod, FeedbackType.Positive); var negativeNumber = ConvertToNumber(negativePercent, count); var neutralNumber = ConvertToNumber(neutralPercent, count); var positiveNumber = ConvertToNumber(positivePercent, count); //Debug.Assert( count == negativeNumber + neutralNumber + positiveNumber ); data.FeedbackByPeriod.Add(timePeriod, new DatabaseAmazonFeedbackDataByPeriod(timePeriod) { Count = count, Negative = negativeNumber, Neutral = neutralNumber, Positive = positiveNumber }); } Helper.StoreAmazonFeedbackData(databaseCustomerMarketPlace, data, historyRecord); }
public FeedbackHistoryItem(FeedbackType type, FeedbackPeriod period, int value) { Type = type; Period = period; Value = value; }
public int?GetFeedbackHistoryValue(FeedbackPeriod amazonTimePeriod, FeedbackType feedbackType) { var item = _Items.FirstOrDefault(i => i.Period == amazonTimePeriod && i.Type == feedbackType); return(item == null ? (int?)null : item.Value); }
public void Add(FeedbackType feedbackType, FeedbackPeriod feedbackPeriod, int value) { Add(new FeedbackHistoryItem(feedbackType, feedbackPeriod, value)); }