public ActionResult PageAnalysisDetails(long ID, AnalysisSearchViewModel searchViewModel, int?index) { long siteId = 1; ViewBag.VMemberPath = WorkV3.Golbal.UpdFileInfo.GetVPathBySiteID(1, "Member"); if (Request.HttpMethod == "GET") { if (index == null) { WorkV3.Common.Utility.ClearSearchValue(); } else { AnalysisSearchViewModel prevSearch = WorkV3.Common.Utility.GetSearchValue <AnalysisSearchViewModel>(); if (prevSearch != null) { searchViewModel = prevSearch; } } } else if (Request.HttpMethod == "POST") { WorkV3.Common.Utility.SetSearchValue(searchViewModel); } AnalysisOrderByViewModel orderBy = new AnalysisOrderByViewModel() { SortColumn = SortColumn.AddTime, SortDesc = SortDesc.Desc }; if (!string.IsNullOrEmpty(Request.QueryString["OrderColumn"])) { try { SortColumn sortColumn = (SortColumn)int.Parse(Request.QueryString["OrderColumn"]); orderBy.SortColumn = sortColumn; } catch { return(HttpNotFound()); } } if (!string.IsNullOrEmpty(Request.QueryString["OrderSort"])) { try { SortDesc sortDesc = (SortDesc)int.Parse(Request.QueryString["OrderSort"]); orderBy.SortDesc = sortDesc; } catch { return(HttpNotFound()); } } string qType = ""; if (!string.IsNullOrEmpty(Request.QueryString["type"])) { qType = Request.QueryString["type"]; } bool IsShowLabelLine = GetCustomLableCookie(); DateTime SearchStartDate = DateTime.Now.AddDays(-14); DateTime SearchEndDate = DateTime.Now; WorkV3.Common.DateRange rangeType = DateRange.DoubleWeeks; string SelectMembers = ""; if (!string.IsNullOrEmpty(searchViewModel.SearchStartDate)) { SearchStartDate = DateTime.Parse(searchViewModel.SearchStartDate); } if (!string.IsNullOrEmpty(searchViewModel.SearchEndDate)) { SearchEndDate = DateTime.Parse(searchViewModel.SearchEndDate); } if (searchViewModel != null) { rangeType = searchViewModel.RangeType; } if (!string.IsNullOrEmpty(searchViewModel.SelectMembers)) { SelectMembers = searchViewModel.SelectMembers; } if (searchViewModel != null && searchViewModel.IsShowCustomLableLine.HasValue) { IsShowLabelLine = searchViewModel.IsShowCustomLableLine.Value; } int totalRecord = 0; Pagination pagination = new Pagination { PageIndex = index ?? 1, PageSize = WebInfo.PageSize }; ViewBag.UploadUrl = uploadUrl; var StatisticConditionModel = Models.DataAccess.StatisticConditionDAO.GetItem(ID); AnalysisPageStatLogViewModel pageLogModel = new AnalysisPageStatLogViewModel(); //AnalysisPageStatLogViewModel pageLogModel = Models.DataAccess.PagesView_LogDAO.GetWebPageStatLogStatistics(PageID, qType, SearchStartDate, SearchEndDate, orderBy, // pagination.PageSize, pagination.PageIndex, out totalRecord); pageLogModel.TotalViewCount = Models.DataAccess.StatisticConditionDAO.GetStatistionValue(siteId, StatisticConditionModel, SearchStartDate, SearchEndDate); if (StatisticConditionModel.StatisticType == StatisticType.SummaryViewCount) { pageLogModel.SessionList = Models.DataAccess.StatisticConditionDAO.GeViewLogs(siteId, SearchStartDate, SearchEndDate, StatisticConditionModel, orderBy, pagination.PageSize, pagination.PageIndex, out totalRecord); } if (StatisticConditionModel.StatisticType == StatisticType.MemberViewCount) { pageLogModel.SessionList = Models.DataAccess.StatisticConditionDAO.GeMemberViewLogs(siteId, SearchStartDate, SearchEndDate, StatisticConditionModel, orderBy, pagination.PageSize, pagination.PageIndex, out totalRecord); } //pageLogModel.LogDailyList = Models.DataAccess.StatisticConditionDAO.GetDailyStatistionValue(siteId, StatisticConditionModel, SearchStartDate, SearchEndDate); if (StatisticConditionModel.StatisticType == StatisticType.DailyViewCount) { pageLogModel.SessionList = Models.DataAccess.StatisticConditionDAO.GetUserViewLogs(siteId, SearchStartDate, SearchEndDate, StatisticConditionModel, orderBy, pagination.PageSize, pagination.PageIndex, out totalRecord); } if (pageLogModel != null && pageLogModel.SessionList != null && pageLogModel.SessionList.Count() > 0) { foreach (AnalysisPageViewSessionViewModel item in pageLogModel.SessionList) { item.Url = Url.Action("Index", "Home", new { SiteSN = item.SiteSN, PageSN = item.SN, area = string.Empty }); } } pageLogModel.LogDailyList = Models.DataAccess.StatisticConditionDAO.GetDailyStatistionValue(siteId, StatisticConditionModel, SearchStartDate, SearchEndDate); pageLogModel.Title = StatisticConditionModel.Title; List <AnalysisLogCustomLabelLineViewModel> LabelLineList = new List <AnalysisLogCustomLabelLineViewModel>(); var EnabledLabelLineModels = Models.DataAccess.LogStatisticLabelDAO.GetShowLabelLine(SearchStartDate, SearchEndDate); if (EnabledLabelLineModels != null && EnabledLabelLineModels.Count() > 0) { foreach (LogStatisticLabelModels model in EnabledLabelLineModels) { LabelLineList.Add(new ViewModels.AnalysisLogCustomLabelLineViewModel() { Title = model.Title, LabelDate = model.LabelDate.ToString("MM/dd"), LabelColor = model.LabelColor }); } } pageLogModel.SearchStartDate = SearchStartDate; pageLogModel.SearchEndDate = SearchEndDate; pageLogModel.RangeType = rangeType; pageLogModel.IsShowCustomLableLine = IsShowLabelLine; pageLogModel.LabelLineList = LabelLineList; pageLogModel.OrderBy = orderBy; pageLogModel.PageID = ID.ToString(); pagination.TotalRecord = totalRecord; ViewBag.Pagination = pagination; SetCustomLableCookie(IsShowLabelLine); return(View(pageLogModel)); }
// GET: Backend/Statistic public ActionResult ListWeb(long siteId, AnalysisSearchViewModel searchViewModel) { bool IsShowLabelLine = GetCustomLableCookie(); DateTime SearchStartDate = DateTime.Now.AddDays(-14); DateTime SearchEndDate = DateTime.Now; WorkV3.Common.DateRange rangeType = DateRange.DoubleWeeks; string SelectMembers = ""; if (!string.IsNullOrEmpty(searchViewModel.SearchStartDate)) { SearchStartDate = DateTime.Parse(searchViewModel.SearchStartDate); } if (!string.IsNullOrEmpty(searchViewModel.SearchEndDate)) { SearchEndDate = DateTime.Parse(searchViewModel.SearchEndDate); } if (!string.IsNullOrEmpty(searchViewModel.SelectMembers)) { SelectMembers = searchViewModel.SelectMembers; } if (searchViewModel != null) { rangeType = searchViewModel.RangeType; } if (searchViewModel != null && searchViewModel.IsShowCustomLableLine.HasValue) { IsShowLabelLine = searchViewModel.IsShowCustomLableLine.Value; } StatisticViewModel viewModel = new StatisticViewModel(); //StatisticViewModel siteLogModel = Models.DataAccess.PagesView_LogDAO.GetWebSiteLogStatistics(SearchStartDate, SearchEndDate, SelectMembers, orderBy, // pagination.PageSize, pagination.PageIndex, out totalRecord); List <AnalysisLogCustomLabelLineViewModel> LabelLineList = new List <AnalysisLogCustomLabelLineViewModel>(); var EnabledLabelLineModels = Models.DataAccess.LogStatisticLabelDAO.GetShowLabelLine(SearchStartDate, SearchEndDate); if (EnabledLabelLineModels != null && EnabledLabelLineModels.Count() > 0) { foreach (LogStatisticLabelModels model in EnabledLabelLineModels) { LabelLineList.Add(new ViewModels.AnalysisLogCustomLabelLineViewModel() { Title = model.Title, LabelDate = model.LabelDate.ToString("MM/dd"), LabelColor = model.LabelColor }); } } viewModel.SearchStartDate = SearchStartDate; viewModel.SearchEndDate = SearchEndDate; viewModel.RangeType = rangeType; viewModel.IsShowCustomLableLine = IsShowLabelLine; viewModel.LabelLineList = LabelLineList; viewModel.StatisticConditionList = Models.DataAccess.StatisticConditionDAO.GetItems(); if (viewModel.StatisticConditionList != null && viewModel.StatisticConditionList.Count() > 0) { foreach (Models.StatisticConditionModels model in viewModel.StatisticConditionList) { model.StatisticValue = Models.DataAccess.StatisticConditionDAO.GetStatistionValue(siteId, model, SearchStartDate, SearchEndDate); if (model.ShowStatus) { model.LogDailyList = Models.DataAccess.StatisticConditionDAO.GetDailyStatistionValue(siteId, model, SearchStartDate, SearchEndDate); } } } ViewBag.SiteId = siteId; SetCustomLableCookie(IsShowLabelLine); return(View(viewModel)); }