Example #1
0
        private void avgTest()
        {
            string cs      = @"server=localhost;userid=root;password=;database=traitement";
            string sqlAvg  = "SELECT AVG(note) FROM tripreviewsamst WHERE idplace =";
            int    idplace = 239469;
            TripDB trip    = new TripDB();
            double avgTest = trip.getAVG(cs, sqlAvg, idplace);

            textBlock.Text = avgTest.ToString();
        }
Example #2
0
        public HashSet <TableInfo> getTable(string db, string sqlPlace, string sqlAvg)
        {
            TripDB tripdb = new TripDB();

            HashSet <TableInfo> result   = new HashSet <TableInfo>();
            HashSet <Places>    placeSet = tripdb.getPlaces(db, sqlPlace);

            Parallel.ForEach(placeSet, place =>
            {
                double avg     = tripdb.getAVG(db, sqlAvg, place.Id);
                TableInfo temp = new TableInfo();
                temp.Note      = avg;
                temp.Latitude  = place.Latitude;
                temp.Longitude = place.Longitude;
                result.Add(temp);
            });
            return(result);
        }