Beispiel #1
0
        public Location(Row row)
        {
            Id = int.Parse(row.Values["Id"].ToString());
            Name = row.Values["Nom"].ToString();
            Description = row.Values["Description"].ToString();
            Picture = GetResourceLink(row, "Photo");
            Address = row.Values["Adresse"].ToString();
            ZipCode = row.Values["Code postal"].ToString();
            Latitude = double.Parse(row.Values["Latitude"].ToString());
            Longitude = double.Parse(row.Values["Longitude"].ToString());
            IsValid = bool.Parse(row.Values["Validé"].ToString());
            if (row.Values["Foursquare"] != null)
                Foursquare = row.Values["Foursquare"].ToString();

            OpeningTimes = new List<OpeningTime>();
            OpeningTimes.Add(ExtractOpeningTime(row, DayOfWeek.Monday, "Lundi", DateTime.Today.DayOfWeek == DayOfWeek.Monday));
            OpeningTimes.Add(ExtractOpeningTime(row, DayOfWeek.Tuesday, "Mardi", DateTime.Today.DayOfWeek == DayOfWeek.Tuesday));
            OpeningTimes.Add(ExtractOpeningTime(row, DayOfWeek.Wednesday, "Mercredi", DateTime.Today.DayOfWeek == DayOfWeek.Wednesday));
            OpeningTimes.Add(ExtractOpeningTime(row, DayOfWeek.Thursday, "Jeudi", DateTime.Today.DayOfWeek == DayOfWeek.Thursday));
            OpeningTimes.Add(ExtractOpeningTime(row, DayOfWeek.Friday, "Vendredi", DateTime.Today.DayOfWeek == DayOfWeek.Friday));
            OpeningTimes.Add(ExtractOpeningTime(row, DayOfWeek.Saturday, "Samedi", DateTime.Today.DayOfWeek == DayOfWeek.Saturday));
            OpeningTimes.Add(ExtractOpeningTime(row, DayOfWeek.Sunday, "Dimanche", DateTime.Today.DayOfWeek == DayOfWeek.Sunday));
        }
Beispiel #2
0
        // 1 service => XX:XX - XX:XX
        // 2 services => XX:XX - XX:XX / XX:XX - XX:XX
        private List<TimeInterval> ExtractHours(string hours)
        {
            var intervals = new List<TimeInterval>();

            string formatedHours = hours.Replace(" ", "");
            string[] services = formatedHours.Split('/');

            foreach (string service in services)
            {
                var times = service.Split('-');
                if (times.Length == 2)
                    intervals.Add(new TimeInterval(times[0], times[1]));
            }

            return intervals;
        }