Exemple #1
0
        /// <summary>
        /// Metoda creata pt cautarea unui eveniment dupa nume
        /// </summary>
        /// <param name="ledger"></param>
        private void SearchEventsByName(Ledger ledger)
        {
            Console.WriteLine("Search Events for " + "`Birthday Party`");
            List <CalendarEvent> matchEvents = ledger.GetEvents("Birthday Party");

            Console.WriteLine("Found [" + matchEvents.Count() + "] events");
            foreach (CalendarEvent ce in matchEvents)
            {
                Console.WriteLine(ce);
            }
            Console.WriteLine();
        }
Exemple #2
0
        /// <summary>
        /// Metroda creata pt obtinerea evenimentelor unei persoane dintr-un anumit interval de timp
        /// </summary>
        /// <param name="ledger"></param>
        private void RetrievingEvents(Ledger ledger)
        {
            Console.Write("Retrieving Events for person with id `3` - method #1 (match found) - ");
            Calendar c3    = ledger.getCalendar("3");
            DateTime from1 = DateTime.ParseExact("15/04/2020 08:00", "d/M/yyyy HH:mm", CultureInfo.InvariantCulture);
            DateTime to1   = DateTime.ParseExact("15/04/2020 17:00", "d/M/yyyy HH:mm", CultureInfo.InvariantCulture);

            Console.WriteLine("from/to: " + from1 + " - " + to1);
            List <CalendarEvent> windowEvents1 = ledger.GetEvents(c3.GetPerson(), from1, to1);

            foreach (CalendarEvent ce in windowEvents1)
            {
                Console.WriteLine(ce);
            }
            Console.WriteLine();
            ////////////////////////////////////////////////////////////////////////

            Console.Write("Retrieving Events for person with id `3` - method #2 (match found) - ");
            Calendar c4    = ledger.getCalendar("3");
            DateTime from2 = DateTime.ParseExact("15/04/2020 08:00", "d/M/yyyy HH:mm", CultureInfo.InvariantCulture);
            DateTime to2   = DateTime.ParseExact("15/04/2020 11:00", "d/M/yyyy HH:mm", CultureInfo.InvariantCulture);

            Console.WriteLine("from/to: " + from2 + " - " + to2);
            List <CalendarEvent> windowEvents2 = c4.GetEvents(from2, to2);

            foreach (CalendarEvent ce in windowEvents2)
            {
                Console.WriteLine(ce);
            }
            Console.WriteLine();

            Console.Write("Retrieving Events for person with id `3` - method #2 (NO match found) - ");
            Calendar c5    = ledger.getCalendar("3");
            DateTime from3 = DateTime.ParseExact("15/04/2020 12:01", "d/M/yyyy HH:mm", CultureInfo.InvariantCulture);
            DateTime to3   = DateTime.ParseExact("15/04/2020 20:00", "d/M/yyyy HH:mm", CultureInfo.InvariantCulture);

            Console.WriteLine("from/to: " + from3 + " - " + to3);
            List <CalendarEvent> windowEvents3 = c4.GetEvents(from3, to3);

            foreach (CalendarEvent ce in windowEvents3)
            {
                Console.WriteLine(ce);
            }
            Console.WriteLine();
        }