コード例 #1
0
ファイル: DashboardBuilder.cs プロジェクト: etopcu/Dashboard
        private void InitDashboard(Dashboard dashboard)
        {
            dashboard.data = _widgetrepository.GetDashboardWidgets(dashboard);

            foreach (Widget x in dashboard.data)
            {
                x.metadata = _parameterrepository.GetParameters(x.id);
            }
        }
コード例 #2
0
ファイル: WidgetRepository.cs プロジェクト: etopcu/Dashboard
        public IEnumerable<Widget> GetDashboardWidgets(Dashboard dashboard)
        {
            if (dashboard.id == 1)
            {
                var list = new List<Widget>
                               {
                                   new Widget(1, "Widget One", "/Dashboard/widgets/widget1.html",
                                              "/Dashboard/widgets/editwidget1.html", "first", true),
                                   new Widget(2, "Widget Regular", "/Dashboard/widgets/MyProfile.html",
                                              "/Dashboard/widgets/editwidget2.html", "first", true),
                                    new Widget(3, "Widget test", "/Dashboard/widgets/KO_MyProfile.html",
                                              "/Dashboard/widgets/editwidget2.html", "first", true)
                               };

                foreach (var x in list)
                {
                    x.metadata = _parameterrepository.GetParameters(x.id);
                }
                return list;
            }
            else
            {
                var list = new List<Widget>
                               {
                                   new Widget(1, "Widget One", "/Dashboard/widgets/widget1.html",
                                              "/Dashboard/widgets/editwidget1.html", "first", true),
                                   new Widget(2, "Widget Regular", "/Dashboard/widgets/MyProfile.html",
                                              "/Dashboard/widgets/editwidget2.html", "first", true),
                                    new Widget(3, "Widget test", "/Dashboard/widgets/KO_MyProfile.html",
                                              "/Dashboard/widgets/editwidget2.html", "first", true)
                               };

                foreach (var x in list)
                {
                    x.metadata = _parameterrepository.GetParameters(x.id);
                }
                return list;
            }
        }
コード例 #3
0
 public void UpdateDashboard(Dashboard dashboard)
 {
     _dashboardrepository.UpdateDashboard(dashboard);
 }
コード例 #4
0
        public JsonResult CreateDashboard(Dashboard dashboard)
        {
            var createddashboard = _dashboardbuilder.CreateCustomDashboard(dashboard);

            return Json(createddashboard, JsonRequestBehavior.AllowGet);
        }
コード例 #5
0
 public void UpdateDashboard(Dashboard dashboard)
 {
     _widgetrepository.UpdateWidgets(dashboard.data);
 }
コード例 #6
0
 /// <summary>
 /// Create a new User Dashboard that can be customized
 /// </summary>
 /// <param name="dashboard">Holds the information for the Company Dashboard</param>
 /// <returns>The new User Dashboard</returns>
 public Dashboard CreateUserDashboard(Dashboard dashboard)
 {
     var userdashboard = new Dashboard(dashboard.id, dashboard.layout, "User");
     userdashboard.data = dashboard.data;
     return userdashboard;
 }
コード例 #7
0
 public Dashboard CreateCompanyDashboard(Dashboard dashboard)
 {
     var companydashboard = new Dashboard(1, "layout1", "Company");
     companydashboard.data = (IEnumerable<Widget>)new List<Widget>();
     return companydashboard;
 }
コード例 #8
0
ファイル: DashboardBuilder.cs プロジェクト: etopcu/Dashboard
 public Dashboard CreateCustomDashboard(Dashboard dashboard)
 {
     if (dashboard.type == "Company")
         return _dashboardrepository.CreateUserDashboard(dashboard);
     return _dashboardrepository.CreateCompanyDashboard(dashboard);
 }