} // GetCustomerUserInfo private void SaveFeedbackInfo( IDatabaseCustomerMarketPlace databaseCustomerMarketPlace, ResultInfoEbayFeedBack feedbackInfo, MP_CustomerMarketplaceUpdatingHistory historyRecord ) { if (feedbackInfo == null) { return; } var submittedDate = feedbackInfo.SubmittedDate; var data = new DatabaseEbayFeedbackData(submittedDate) { RepeatBuyerCount = feedbackInfo.RepeatBuyerCount, RepeatBuyerPercent = feedbackInfo.RepeatBuyerPercent, TransactionPercent = feedbackInfo.TransactionPercent, UniqueBuyerCount = feedbackInfo.UniqueBuyerCount, UniqueNegativeCount = feedbackInfo.UniqueNegativeFeedbackCount, UniquePositiveCount = feedbackInfo.UniquePositiveFeedbackCount, UniqueNeutralCount = feedbackInfo.UniqueNeutralFeedbackCount }; var timePeriodsFeedback = new[] { TimePeriodEnum.Zero, TimePeriodEnum.Month, TimePeriodEnum.Month6, TimePeriodEnum.Year }; foreach (TimePeriodEnum timePeriod in timePeriodsFeedback) { data.FeedbackByPeriod.Add(timePeriod, new DatabaseEbayFeedbackDataByPeriod(timePeriod) { Negative = feedbackInfo.GetNegativeFeedbackByPeriod(timePeriod), Neutral = feedbackInfo.GetNeutralFeedbackByPeriod(timePeriod), Positive = feedbackInfo.GetPositiveFeedbackByPeriod(timePeriod), }); } // for var timePeriodsRaiting = new[] { new Tuple <TimePeriodEnum, FeedbackSummaryPeriodCodeType>( TimePeriodEnum.Month, FeedbackSummaryPeriodCodeType.ThirtyDays ), new Tuple <TimePeriodEnum, FeedbackSummaryPeriodCodeType>( TimePeriodEnum.Year, FeedbackSummaryPeriodCodeType.FiftyTwoWeeks ) }; foreach (var pair in timePeriodsRaiting) { var timePeriod = pair.Item1; var periodCodeType = pair.Item2; data.RaitingByPeriod.Add(timePeriod, new DatabaseEbayRaitingDataByPeriod(timePeriod) { Communication = feedbackInfo.GetRaitingData( periodCodeType, FeedbackRatingDetailCodeType.Communication ), ItemAsDescribed = feedbackInfo.GetRaitingData( periodCodeType, FeedbackRatingDetailCodeType.ItemAsDescribed ), ShippingAndHandlingCharges = feedbackInfo.GetRaitingData( periodCodeType, FeedbackRatingDetailCodeType.ShippingAndHandlingCharges ), ShippingTime = feedbackInfo.GetRaitingData( periodCodeType, FeedbackRatingDetailCodeType.ShippingTime ) }); } // for Helper.StoreEbayFeedbackData(databaseCustomerMarketPlace, data, historyRecord); } // SaveFeedbackInfo
public void StoreEbayFeedbackData(IDatabaseCustomerMarketPlace databaseCustomerMarketPlace, DatabaseEbayFeedbackData data, MP_CustomerMarketplaceUpdatingHistory historyRecord) { if (data == null) { WriteToLog("StoreEbayUserData: invalid data to store", WriteLogType.Error); return; } MP_CustomerMarketPlace customerMarketPlace = GetCustomerMarketPlace(databaseCustomerMarketPlace.Id); var feedBack = new MP_EbayFeedback { CustomerMarketPlace = customerMarketPlace, Created = data.Submitted, RepeatBuyerCount = data.RepeatBuyerCount, RepeatBuyerPercent = data.RepeatBuyerPercent, TransactionPercent = data.TransactionPercent, UniqueBuyerCount = data.UniqueBuyerCount, UniqueNegativeCount = data.UniqueNegativeCount, UniqueNeutralCount = data.UniqueNeutralCount, UniquePositiveCount = data.UniquePositiveCount, HistoryRecord = historyRecord }; if (data.FeedbackByPeriod != null && data.FeedbackByPeriod.Count > 0) { feedBack.FeedbackByPeriodItems.AddAll(data.FeedbackByPeriod.Values.Select(f => new MP_EbayFeedbackItem { EbayFeedback = feedBack, Negative = f.Negative, Positive = f.Positive, Neutral = f.Neutral, TimePeriod = GetTimePeriod(TimePeriodFactory.Create(f.TimePeriod)) }).ToList()); } if (data.RaitingByPeriod != null && data.RaitingByPeriod.Count > 0) { feedBack.RaitingByPeriodItems.AddAll(data.RaitingByPeriod.Values.Select(r => new MP_EbayRaitingItem { EbayFeedback = feedBack, Communication = r.Communication, ItemAsDescribed = r.ItemAsDescribed, ShippingAndHandlingCharges = r.ShippingAndHandlingCharges, ShippingTime = r.ShippingTime, TimePeriod = GetTimePeriod(TimePeriodFactory.Create(r.TimePeriod)) }).ToList()); } customerMarketPlace.EbayFeedback.Add(feedBack); _CustomerMarketplaceRepository.Update(customerMarketPlace); }