Beispiel #1
0
        public void AddDataFromConsole(string date, string title, string description)
        {
            TXTFile file = new TXTFile();

            eventsList = file.LoadEventsFromFile();
            eventsList.Add(date, title, description);
            file.SaveEventsToFile(eventsList);
        }
Beispiel #2
0
        public static void SearchAndExportEvents(string field, string op, string[] val, string path)
        {
            TXTFile files        = new TXTFile();
            Events  eventsList   = files.LoadEventsFromFile();
            Events  filteredList = SearchEvents(eventsList, field, op, val);

            if (path != "")
            {
                ExportToHTMLFile(path, filteredList);
            }
        }
Beispiel #3
0
        public static void ExportEvents(string[] args)
        {
            TXTFile files      = new TXTFile();
            Events  eventsList = files.LoadEventsFromFile();

            eventsList.Sort();
            if (args.Length == 2)
            {
                ExportToHTMLFile(@args[1], eventsList);
            }
            else
            {
                IOConsole evTools        = new IOConsole();
                string    criteria       = Utils.ParseFilteringCriteria(args[1]);
                Events    eventsToExport = SimpleDateFiltering(eventsList, criteria, DateTime.Today.ToShortDateString());
                ExportToHTMLFile(@args[2], eventsToExport);
            }
        }
Beispiel #4
0
        public static void DisplayEvents(string parameter)
        {
            TXTFile   files      = new TXTFile();
            Events    eventsList = files.LoadEventsFromFile();
            IOConsole display    = new IOConsole(eventsList);

            if (parameter == "all")
            {
                display.DisplayEventsToConsole();
            }
            else
            {
                string    criteria        = Utils.ParseFilteringCriteria(parameter);
                Events    eventsToDisplay = SimpleDateFiltering(eventsList, criteria, DateTime.Today.ToShortDateString());
                IOConsole toDisplay       = new IOConsole(eventsToDisplay);
                toDisplay.DisplayEventsToConsole();
            }
        }
Beispiel #5
0
        public static void ListAllTags(string sort)
        {
            TXTFile     files      = new TXTFile();
            Events      eventsList = files.LoadEventsFromFile();
            TagsCounter tags       = new TagsCounter(eventsList);

            switch (sort)
            {
            case "byCount":
            {
                tags.SortTagsDescByCount();
                break;
            }

            case "byName":
            {
                tags.SortTagsAscByName();
                break;
            }
            }
            Tag[] listTodispaly = tags.TagList.ToArray();
            new IOConsole().DisplayTagsAndCountersToConsole(listTodispaly);
        }