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); }