Example #1
0
        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));
        }
Example #2
0
        public void ExportToXLS(long ID, string Type, AnalysisSearchViewModel searchViewModel)
        {
            DateTime SearchStartDate = DateTime.Now.AddDays(-14);
            DateTime SearchEndDate   = DateTime.Now;
            string   SelectMembers   = "";

            if (!string.IsNullOrEmpty(searchViewModel.SearchStartDate))
            {
                SearchStartDate = DateTime.Parse(searchViewModel.SearchStartDate);
            }
            if (!string.IsNullOrEmpty(searchViewModel.SearchEndDate))
            {
                SearchEndDate = DateTime.Parse(searchViewModel.SearchEndDate);
            }
            int totalRecord = 0;
            AnalysisOrderByViewModel orderBy = new AnalysisOrderByViewModel()
            {
                SortColumn = SortColumn.TotalViewCount,
                SortDesc   = SortDesc.Desc
            };

            if (!string.IsNullOrEmpty(Request.QueryString["OrderColumn"]))
            {
                try
                {
                    SortColumn sortColumn = (SortColumn)int.Parse(Request.QueryString["OrderColumn"]);
                    orderBy.SortColumn = sortColumn;
                }
                catch
                {
                    return;
                }
            }
            if (!string.IsNullOrEmpty(Request.QueryString["OrderSort"]))
            {
                try
                {
                    SortDesc sortDesc = (SortDesc)int.Parse(Request.QueryString["OrderSort"]);
                    orderBy.SortDesc = sortDesc;
                }
                catch
                {
                    return;
                }
            }
            long siteId = 1;

            var       StatisticConditionModel = Models.DataAccess.StatisticConditionDAO.GetItem(ID);
            DataTable pageLogTable            = new DataTable();

            if (string.IsNullOrEmpty(Type) || Type == "main")
            {
                pageLogTable = Models.DataAccess.StatisticConditionDAO.GetStatistionDetailTable(siteId, StatisticConditionModel, SearchStartDate, SearchEndDate, orderBy, 99999, 1, out totalRecord);
            }
            else if (Type == "user")
            {
                pageLogTable = Models.DataAccess.StatisticConditionDAO.GetStatistionUserDetailTable(siteId, StatisticConditionModel, SearchStartDate, SearchEndDate, orderBy, 99999, 1, out totalRecord);
            }
            else if (Type == "member")
            {
                pageLogTable = Models.DataAccess.StatisticConditionDAO.GetStatistionMemberDetailTable(siteId, StatisticConditionModel, SearchStartDate, SearchEndDate, orderBy, 99999, 1, out totalRecord);
            }

            if (pageLogTable != null)
            {
                pageLogTable.Columns.Add("裝置");
                pageLogTable.Columns.Add("目標網址");
                foreach (DataRow pageRow in pageLogTable.Rows)
                {
                    pageRow["裝置"]   = WorkV3.Areas.Backend.ViewModels.AnalysisPageLogViewModel.GetOSNumber(pageRow["UserAgent"].ToString());
                    pageRow["目標網址"] = Url.Action("Index", "Home", new { SiteSN = pageRow["SiteSN"].ToString(), PageSN = pageRow["SN"].ToString(), area = string.Empty });
                }
                string[] removeColumns = "MenuTitle,No,SN,SiteID,SiteSN,ID,PagesNo,Lang,Browser,UserAgent,SiteID1,MemberID,IPNum,ReferrerUrlPageNo,Photo,ROWSTAT".Split(',');
                foreach (string removeColumn in removeColumns)
                {
                    if (pageLogTable.Columns.Contains(removeColumn))
                    {
                        pageLogTable.Columns.Remove(removeColumn);
                    }
                }
                pageLogTable.Columns["ReferrerUrl"].ColumnName      = "來源網址";
                pageLogTable.Columns["ReferrerUrlTitle"].ColumnName = "來源網址名稱";
                pageLogTable.Columns["Title"].ColumnName            = "目標網址名稱";
                pageLogTable.Columns["StaySeconds"].ColumnName      = "停留秒數";
                pageLogTable.Columns["MemberInfo"].ColumnName       = "會員姓名 / 帳號";
                pageLogTable.Columns["Name"].ColumnName             = "創建者";
                pageLogTable.Columns["AddTime"].ColumnName          = "進入時間";
                pageLogTable.Columns["來源網址"].SetOrdinal(0);
                pageLogTable.Columns["來源網址名稱"].SetOrdinal(1);
                pageLogTable.Columns["目標網址"].SetOrdinal(2);
                pageLogTable.Columns["目標網址名稱"].SetOrdinal(3);
                pageLogTable.Columns["創建者"].SetOrdinal(4);
                pageLogTable.Columns["進入時間"].SetOrdinal(5);
                pageLogTable.Columns["停留秒數"].SetOrdinal(6);
                pageLogTable.Columns["SessionID"].SetOrdinal(7);
                pageLogTable.Columns["裝置"].SetOrdinal(8);
                pageLogTable.Columns["會員姓名 / 帳號"].SetOrdinal(9);
                pageLogTable.Columns["IP"].SetOrdinal(10);
                string sheetName = string.Format("條件{2}-{0}~{1}比較分析表",
                                                 SearchStartDate.ToString("yyyyMMdd"), SearchEndDate.ToString("yyyyMMdd"), StatisticConditionModel.Title);
                WorkLib.uXls.DTExpExcel(pageLogTable, string.Format("{0}", sheetName), sheetName);
            }
        }
Example #3
0
        // 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));
        }