Exemple #1
0
        public List <RestaurantInformationAverage> getTopList()
        {
            ReadingFromFile <RestaurantInformation> listFile        = new ReadingFromFile <RestaurantInformation>();
            RestaurantInformationPecentageAverage   restaurant      = new RestaurantInformationPecentageAverage();
            List <RestaurantInformationAverage>     listRestaurants = restaurant.GetListWithPercentageAverage(listFile.Read());

            listRestaurants.Sort();
            return(listRestaurants);
        }
Exemple #2
0
        public void Write(RestaurantInformation glassInformation)
        {
            ReadingFromFile <RestaurantInformation> readingFromFile = new ReadingFromFile <RestaurantInformation>();
            List <RestaurantInformation>            listofGlass     = readingFromFile.Read();
            BinaryFormatter binaryFormatter = new BinaryFormatter();
            FileStream      fileStream      = new FileStream("C:\\data.bin", FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);

            listofGlass.Add(glassInformation);
            binaryFormatter.Serialize(fileStream, listofGlass);
            fileStream.Flush();
            fileStream.Close();
        }
Exemple #3
0
        public static string getAverageOfLiquid(RestaurantInformation restaurantInformation)
        {
            ReadingFromFile <RestaurantInformation> listFile        = new ReadingFromFile <RestaurantInformation>();
            RestaurantInformationPecentageAverage   restaurant      = new RestaurantInformationPecentageAverage();
            List <RestaurantInformationAverage>     listRestaurants = restaurant.GetListWithPercentageAverage(listFile.Read());

            foreach (RestaurantInformationAverage restaurantsInformation in listRestaurants)
            {
                if (restaurantsInformation.Name.Equals(restaurantInformation.Name) && restaurantsInformation.Address.Equals(restaurantInformation.Address))
                {
                    return(restaurantsInformation.AverageOfPercentage.ToString());
                }
            }
            return("-");
        }
Exemple #4
0
        public List <RestaurantInformationAverage> GetLastDaysData(int days)
        {
            ReadingFromFile <RestaurantInformation> readingFromFile = new ReadingFromFile <RestaurantInformation>();
            List <RestaurantInformation>            dataList        = readingFromFile.Read();
            List <RestaurantInformation>            dataListRange   = new List <RestaurantInformation>();

            foreach (RestaurantInformation restaurantData in dataList)
            {
                if (restaurantData.Date.AddDays(days) >= DateTime.Today)
                {
                    dataListRange.Add(restaurantData);
                    Console.WriteLine(restaurantData.Date);
                }
            }
            RestaurantInformationPecentageAverage restaurant      = new RestaurantInformationPecentageAverage();
            List <RestaurantInformationAverage>   listRestaurants = restaurant.GetListWithPercentageAverage(dataListRange);

            return(listRestaurants);
        }