예제 #1
0
        public void LoadUserDashboardTiles(UrlHelper urlHelper)
        {
            var dashboardTasks = new DashboardHelper();

            var assignedUserDashboards = dashboardTasks.GetUserAssignedDashboards(userId);
            var userDashboardData = dashboardTasks.UserDashboardDataList(userId);

            foreach (var assignedUserDashboard in assignedUserDashboards)
            {
                var assignedDashboard = assignedUserDashboard;
                KpiTableEntity dashboardData;

                if (dashboardTasks.IsUserDashboardDataPopulated(userDashboardData, assignedDashboard.DashboardGuid, out dashboardData))
                {
                    var url = String.Empty;
                    if (!String.IsNullOrWhiteSpace(dashboardData.ActionName) || 
                        !String.IsNullOrWhiteSpace(dashboardData.ControllerName))
                    {
                        url = String.IsNullOrWhiteSpace(dashboardData.AreaName)
                            ? urlHelper.Action(dashboardData.ActionName, dashboardData.ControllerName)
                            : urlHelper.Action(dashboardData.ActionName, dashboardData.ControllerName, new { Area = dashboardData.AreaName });
                    }

                    Tiles.Add(new DashboardTile
                    {
                        TilePosition = dashboardData.TilePosition,
                        TileContext = dashboardData.Image,
                        HasImageData = true,
                        Url = url
                    });
                }
                else
                {
                    Tiles.Add(new DashboardTile
                    {
                        TilePosition = assignedDashboard.TilePosition
                    });

                    dashboardTasks.UpdateDashboard(assignedDashboard.DashboardGuid);
                }
            }
        }
예제 #2
0
        public ActionResult ViewDashboard(int tilePosition)
        {
            var userId = CloudCoreIdentity.UserId;
            var dashboardTasks = new DashboardHelper();

            var userDashboardData = dashboardTasks.GetUserDashboardTileData(userId, tilePosition);

            var model = new ViewDashboardModel();

            if (userDashboardData != null)
            {
                model.TilePosition = tilePosition;
                model.UserId = CloudCoreIdentity.UserId;
                model.TileContextDefined = true;
                model.TileContext = userDashboardData.ResultData;
            }
            else
            {
                model.TilePosition = tilePosition;
                model.UserId = CloudCoreIdentity.UserId;
            }

            return View(model);
        }