// Generate Google Sitemap - URL submission public static async Task <string> BuildGoogleSiteMap(ApplicationDbContext context, int pagenumber, int Records) { var str = new StringBuilder(); str.AppendLine("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">"); // start sitemap url var _items = await ForumTopicBLL.LoadItems(context, new ForumTopicEntity() { pagenumber = pagenumber, pagesize = Records, order = "topic.created_at desc" }); foreach (var item in _items) { str.AppendLine("<url>"); string url = Forum_Urls.Prepare_Topic_Url(item.id, item.title, false); str.AppendLine("<loc>" + url + "</loc>"); str.AppendLine("</url>"); } // close sitemap url str.AppendLine("</urlset>"); return(str.ToString()); }
private static IQueryable <TopicUserEntity> prepareQuery(ApplicationDbContext context, ForumTopicEntity entity) { return(context.JGN_ForumTopics .Join(context.AspNetusers, topic => topic.userid, user => user.Id, (topic, user) => new { topic, user }) .Join(context.JGN_AbuseReports, topic => topic.topic.id, abusereports => abusereports.contentid, (topic, abusereports) => new TopicUserEntity { topic = topic.topic, user = topic.user, abusereports = abusereports }) .Where(ForumTopicBLL.returnWhereClause(entity))); }
public static async Task <GoogleChartEntity> GroupByMonth(ApplicationDbContext context, ForumTopicEntity entity) { var reportData = await context.JGN_ForumTopics .Join(context.AspNetusers, topic => topic.userid, user => user.Id, (topic, user) => new TopicUserEntity { topic = topic, user = user }) .Where(ForumTopicBLL.returnWhereClause(entity)) .GroupBy(o => new { month = o.topic.created_at.Month }) .Select(g => new ReportEntity { Month = g.Key.month, Total = g.Count() }) .OrderBy(a => a.Month) .ToListAsync(); var newObject = new { role = "style" }; var data = new GoogleChartEntity() { chartType = entity.chartType, dataTable = new List <dynamic[]> { new dynamic[] { "Month", "Posted Blogs", newObject }, new dynamic[] { "Copper", 8.94, "#b87333" }, new dynamic[] { "Silver", 10.49, "silver" }, new dynamic[] { "Gold", 19.30, "gold" }, } }; data.report = reportData; foreach (var item in reportData) { // data.dataTable.Add(new dynamic[] { item.Year.ToString(), item.Total, "color: #76A7FA" }); } return(data); }
public static async Task <GoogleChartEntity> GroupByDay(ApplicationDbContext context, ForumTopicEntity entity) { var reportData = await context.JGN_ForumTopics .Join(context.AspNetusers, topic => topic.userid, user => user.Id, (topic, user) => new TopicUserEntity { topic = topic, user = user }) .Where(ForumTopicBLL.returnWhereClause(entity)) .GroupBy(o => new { day = o.topic.created_at.Day }) .Select(g => new ReportEntity { Day = g.Key.day, Total = g.Count() }) .OrderBy(a => a.Day) .ToListAsync(); var newObject = new { role = "style" }; var data = new GoogleChartEntity() { chartType = entity.chartType, dataTable = new List <dynamic[]> { new dynamic[] { "Day", "Posted Blogs", newObject }, } }; data.report = reportData; foreach (var item in reportData) { data.dataTable.Add(new dynamic[] { item.Year.ToString(), item.Total, "color: #76A7FA" }); } return(data); }
// Generate ROR Sitemap - Yahoo URL submission public static async Task <string> BuildYahooSiteMap(ApplicationDbContext context, int pagenumber, int Records) { var str = new StringBuilder(); str.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); str.AppendLine("<rss version=\"2.0\" xmlns:ror=\"http://rorweb.com/0.1/\" >"); str.AppendLine("<channel>"); str.AppendLine("<title>" + Jugnoon.Settings.Configs.GeneralSettings.website_title + "</title>"); str.AppendLine("<link>" + Config.GetUrl() + "</link>"); // start sitemap url var _items = await ForumTopicBLL.LoadItems(context, new ForumTopicEntity() { pagenumber = pagenumber, pagesize = Records, order = "topic.created_at desc" }); foreach (var item in _items) { str.AppendLine("<item>"); string url = Forum_Urls.Prepare_Topic_Url(item.id, item.title, false); str.AppendLine("<link>" + url + "</link>"); str.AppendLine("<ror:updatePeriod></ror:updatePeriod>"); str.AppendLine("<ror:sortOrder>2</ror:sortOrder>"); str.AppendLine("<ror:resourceOf>sitemap</ror:resourceOf> "); str.AppendLine("</item>"); } // close sitemap url str.AppendLine("</channel>"); str.AppendLine("</rss>"); return(str.ToString()); }
public static Task <List <JGN_ForumTopics> > LoadItems(ApplicationDbContext context, ForumTopicEntity entity) { return(ForumTopicBLL.processOptionalConditions(prepareQuery(context, entity), entity) .Select(ForumTopicBLL.prepareSummaryList()).ToListAsync()); }