/// <summary> /// Generates the and save age. /// </summary> /// <param name="date">The date.</param> /// <param name="buildDate">The build date.</param> public void GenerateAndSaveAge(DateTime date, DateTime buildDate) { date = new DateTime(date.Year, date.Month, date.Day); var start = date.AddDays(this.dateRange); var age = this.GenerateAgeDistr(start, date); var data = AnalysisDataConvert.ToCAData(DataType.AGE, buildDate, age); this.caDataManager.SaveCaData(data); }
/// <summary> /// Generates the and save news list. /// </summary> /// <param name="date">The date.</param> /// <param name="buildDate">The build date.</param> public void GenerateAndSaveNewsList(DateTime date, DateTime buildDate) { date = new DateTime(date.Year, date.Month, date.Day); var start = date.AddDays(this.dateRange); var events = this.GenerateEventResult(start, date, 3); var data = AnalysisDataConvert.ToCAData(DataType.SELFTOPNEWS, buildDate, events); this.caDataManager.SaveCaData(data); }
/// <summary> /// Generates the and save sentiment. /// </summary> /// <param name="date">The date.</param> /// <param name="buildDate">The build date.</param> public void GenerateAndSaveSentiment(DateTime date, DateTime buildDate) { date = new DateTime(date.Year, date.Month, date.Day); var start = date.AddDays(this.dateRange); var sentiment = this.GenerateSentiments(start, date); var data = AnalysisDataConvert.ToCAData(DataType.SENTIMENTS, buildDate, sentiment); this.caDataManager.SaveCaData(data); }
/// <summary> /// Generates the and save map. /// </summary> /// <param name="date">The date.</param> /// <param name="buildDate">The build date.</param> public void GenerateAndSaveMap(DateTime date, DateTime buildDate) { date = new DateTime(date.Year, date.Month, date.Day); var start = date.AddDays(this.dateRange); var location = this.GenerateLocationPv(start, date); var data = AnalysisDataConvert.ToCAData(DataType.LOCATION, buildDate, location); this.caDataManager.SaveCaData(data); }
/// <summary> /// Generates the and save media. /// </summary> /// <param name="date">The date.</param> /// <param name="buildDate">The build date.</param> public void GenerateAndSaveMedia(DateTime date, DateTime buildDate) { date = new DateTime(date.Year, date.Month, date.Day); var start = date.AddDays(this.dateRange); var media = this.GenerateMediaExposure(start, date); var data = AnalysisDataConvert.ToCAData(DataType.MEDIA, buildDate, media); this.caDataManager.SaveCaData(data); }
/// <summary> /// Generates the and save top senti news. /// </summary> /// <param name="date">The date.</param> /// <param name="buildDate">The build date.</param> public void GenerateAndSaveTopSentiNews(DateTime date, DateTime buildDate) { date = new DateTime(date.Year, date.Month, date.Day); var start = date.AddDays(this.dateRange); var events = this.GenerateMostSentimentEvent(start, date, 3); var data = AnalysisDataConvert.ToCAData(DataType.TOPSENTINEWS, buildDate, events); this.caDataManager.SaveCaData(data); }
/// <summary> /// Generates the and save weekly report. /// </summary> /// <param name="enddate">The enddate.</param> /// <param name="buildDate">The build date.</param> public void GenerateAndSaveWeeklyReport(DateTime enddate, DateTime buildDate) { var result = new WeeklyReportModel { VisitSentimentTrend = this.weeklyReportRepository.GetSentiments( this.currentClientUser.UserFilter, enddate) }; var dbRowDataList = this.weeklyReportRepository.GetWeeklyReportCountByHour( this.currentClientUser.UserFilter, enddate); // Generate Daily ReportCountTrend from 24*7 data result.ReportCountTrend = new List <TimeCount>(); var dayHourCounts = dbRowDataList as IList <DayHourCount> ?? dbRowDataList.ToList(); for (var daySequence = 6; daySequence >= 0; daySequence--) { var datetime = new DateTime(enddate.Year, enddate.Month, enddate.Day, 0, 0, 0).AddDays(-daySequence); var dayTotalCount = 0; foreach (var dbItem in dayHourCounts) { if (dbItem.date == datetime) { dayTotalCount += dbItem.Count; } } result.ReportCountTrend.Add(new TimeCount(datetime.Month + "/" + datetime.Day, dayTotalCount)); } result.VisitCountTrend = new List <TimeCount>(); try { result.VisitCountTrend = this.weeklyReportRepository.GetVisitCountTrend(this.currentClientUser.UserFilter, enddate); } catch (Exception e) { Debug.WriteLine(e.Message); } try { result.TopNewsSource = this.weeklyReportRepository.GetTop5NewsSource( this.currentClientUser.UserFilter, enddate); } catch (Exception e) { Debug.WriteLine(e.Message); } try { var ageGenderForSort = this.weeklyReportRepository.GetVisitAgeGenderCount(this.currentClientUser.UserFilter, enddate); var list = new List <AgeGenderCount>(); foreach (var dbItem in ageGenderForSort) { var AgeGroup = dbItem.AgeGroup; AgeGroup = AgeGroup.Replace("[", ""); AgeGroup = AgeGroup.Replace(")", ""); AgeGroup = AgeGroup.Replace(",", "-"); list.Add(new AgeGenderCount { AgeGroup = AgeGroup, Gender = dbItem.Gender, Count = dbItem.Count }); } var Comparer = new AgeGenderGroupComparer(); list.Sort(Comparer); result.AgeGenderCount = list; } catch (Exception e) { Debug.WriteLine(e.Message); } var data = AnalysisDataConvert.ToCAData(DataType.WEEKLYREPORT, buildDate, result); this.caDataManager.SaveCaData(data); }