Exemple #1
0
        public GraphdataValues GetGraphDataRank(int aantal, int interval_uren, bool puntNotatie = false)
        {
            InitNonExistingRepo();

            dataMgr = new DataManager();

            List <GraphData> graphs = dataMgr.GetRankingList(aantal, interval_uren, puntNotatie);

            GraphdataValues graphsVals = new GraphdataValues()
            {
                values = new double[aantal],
                labels = new string[interval_uren]
            };

            int i = 0;

            foreach (GraphData graph in graphs)
            {
                graphsVals.values[i] = graph.Value;
                graphsVals.labels[i] = graph.Label;
                i++;
            }

            return(graphsVals);
        }
Exemple #2
0
        public GraphdataValues GetGraphData(int onderwerpId, int aantalDagen, string type, string objType)
        {
            InitNonExistingRepo();

            dataMgr = new DataManager();

            List <GraphData> graphs = new List <GraphData>();

            if (objType == "Persoon")
            {
                graphs = dataMgr.GetTweetsPerDagList(dataMgr.GetPersoon(onderwerpId), aantalDagen);
            }
            else if (objType == "Organisatie")
            {
                graphs = dataMgr.GetTweetsPerDagList(dataMgr.GetOrganisatie(onderwerpId), aantalDagen);
            }
            else if (objType == "Thema")
            {
                graphs = dataMgr.GetTweetsPerDagList(dataMgr.GetThema(onderwerpId), aantalDagen);
            }

            GraphdataValues graphsVals = new GraphdataValues()
            {
                values = new double[aantalDagen + 1],
                labels = new string[aantalDagen + 1]
            };

            int i = 0;

            foreach (GraphData graph in graphs)
            {
                graphsVals.values[i] = graph.Value;
                graphsVals.labels[i] = graph.Label;
                i++;
            }

            return(graphsVals);
        }
Exemple #3
0
        public Dashbord UpdateDashboard(Dashbord dashbord)
        {
            InitNonExistingRepo(true);
            dataMgr = new DataManager(uowManager);
            repo.SetUnitofWork(false);

            DateTime timeNow = DateTime.Now;

            foreach (TileZone tileZone in dashbord.TileZones)
            {
                double hours = (timeNow - tileZone.DashItem.LastModified).TotalHours;
                if (hours > 0.0001)
                {
                    int i = 0;
                    //deze array verwijst naar de personen in GraphData
                    int[] onderwerpId = { 0, 0, 0, 0, 0 };

                    foreach (Follow follow in tileZone.DashItem.Follows)
                    {
                        onderwerpId[i] = follow.Onderwerp.OnderwerpId;
                        i++;
                    }

                    int aantalDagen = tileZone.DashItem.AantalDagen;

                    if (tileZone.DashItem.Type == "Line" && tileZone.DashItem.Town != "Vlaanderen")
                    {
                        try
                        {
                            GraphdataValues graphs = GetGraphData(onderwerpId[0], aantalDagen, tileZone.DashItem.Type, "Persoon");

                            int j = 0;
                            foreach (var graph in tileZone.DashItem.Graphdata)
                            {
                                graph.Label = graphs.labels[j];
                                graph.Value = graphs.values[j];
                                repo.UpdateGraphData(graph);
                                j++;
                            }
                        }
                        catch { }
                        try
                        {
                            //Organisatie organisatie = dataMgr.GetOrganisatie(onderwerpId[0]);
                            GraphdataValues graphs = GetGraphData(onderwerpId[0], aantalDagen, tileZone.DashItem.Type, "Organisatie");

                            int j = 0;
                            foreach (var graph in tileZone.DashItem.Graphdata)
                            {
                                graph.Label = graphs.labels[j];
                                graph.Value = graphs.values[j];
                                repo.UpdateGraphData(graph);
                                j++;
                            }
                        }
                        catch { }
                        try
                        {
                            //Thema thema = dataMgr.GetThema(onderwerpId[0]);
                            GraphdataValues graphs = GetGraphData(onderwerpId[0], aantalDagen, tileZone.DashItem.Type, "Thema");

                            int j = 0;
                            foreach (var graph in tileZone.DashItem.Graphdata)
                            {
                                graph.Label = graphs.labels[j];
                                graph.Value = graphs.values[j];
                                repo.UpdateGraphData(graph);
                                j++;
                            }
                        }
                        catch { }

                        uowManager.Save();
                    }
                }
                //LastModified updaten
                tileZone.DashItem.LastModified = timeNow;
                repo.UpdateTileZone(tileZone);
                uowManager.Save();
            }
            repo.SetUnitofWork(true);
            return(dashbord);
        }