/*hier worden de waardes die uit de functie getMonitoringFromMongo gesplitst.
         * iedere waarde word dan in een div gezet.
         */
        public static async Task <HtmlString> monitoringList(List <string> rest, List <Int64> id, List <string> date)
        {
            var listBuilder = "";

            listBuilder += "<b><tr><td>Unit ID</td><td>Type</td><td>Max Begin</td><td>Min Begin</td><td>Max Eind</td><td>Min Eind</td></tr></b>";
            foreach (var unit in id)
            {
                var i = 0;
                while (rest.Count > i)
                {
                    try {
                        var monitoring = await Task.Run(() => RaportMaker.getMonitoringFromMongo(date[1], date[2], unit, date[0] + " ", rest[i]));

                        var length = monitoring.Count - 1;
                        var min    = monitoring[0]["Min"].ToString();
                        var max    = monitoring[0]["Max"].ToString();
                        var minEnd = monitoring[length]["Min"].ToString();
                        var maxEnd = monitoring[length]["Max"].ToString();
                        listBuilder += "<tr><td>" + unit + "</td><td>" + rest[i] + "</td><td>" + max + "</td><td>" + max + "</td><td>" + maxEnd + "</td><td>" + minEnd + "</td></tr>";
                        i++;
                    }
                    catch { i++; }
                }
            }
            listBuilder = "<div id='reportTable'><table>" + listBuilder + "</table></div>";
            var htmlResult = new HtmlString(listBuilder);

            return(htmlResult);
        }
        public static async Task <HtmlString> positionList(List <Int64> id, List <string> date)
        {
            /*hier worden de waardes die uit de functie getCollectionFromMongo gesplitst.
             * iedere waarde word omgezet via de position class.
             * iedere omgezette waarde wordt dan in een aparte div gezet.
             */
            var listBuilder = "";

            foreach (var unit in id)
            {
                try {
                    var position = await Task.Run(() => RaportMaker.getCollectionFromMongo(unit, date, "Position"));

                    if (position[0] != null)
                    {
                        var length  = position.Count - 1;
                        var corx    = position[0]["Rdx"].ToDouble();
                        var cory    = position[0]["Rdy"].ToDouble();
                        var corxEnd = position[length]["Rdx"].ToDouble();
                        var coryEnd = position[length]["Rdy"].ToDouble();
                        IRijksdriehoekComponent convert = new Position();
                        var outcome    = convert.ConvertToLatLong(corx, cory);
                        var outcomeEnd = convert.ConvertToLatLong(corxEnd, coryEnd);
                        listBuilder += "<div><h4> de begin coördinaten van:" + unit + " zijn: " + outcome + "</h4></div>";
                        listBuilder += "<div><h4> de eind coördinaten van:" + unit + " zijn: " + outcomeEnd + "</h4></div>";
                    }
                }
                catch { }
            }
            var htmlResult = new HtmlString(listBuilder);

            return(htmlResult);
        }
예제 #3
0
 public async Task TestMethod3()
 {
     RaportMaker maker = new RaportMaker();
     var test = await Task.Run(() => RaportMaker.getMonitoringFromMongo("07:12:20", "07:13:20", 14100071, "2015-03-10 ", "Gps/GpsAccuracyGyroBias"));
     var count = 0;
     foreach (BsonDocument oefen in test)
     {
         count++;
        Console.WriteLine(test);
     }
     Assert.AreEqual(1 , count);
 }