Exemple #1
0
 private void AddAppointmentToListView(Event newapp)
 {
     string[] arr = new string[3];
     arr[0] = newapp.Date.ToShortDateString();
     arr[1] = newapp.Title;
     arr[2] = newapp.Description;
     var items = new ListViewItem(arr);
     listView1.Items.Add(items);
 }
Exemple #2
0
 bool IsTrueCriteria(Event ev, string criteria)
 {
     switch (criteria)
     {
         case "||":
             return ContainsAnyTag(ev, valueToCompare);
         case "&&":
             return ContainsAllTags(ev, valueToCompare);
         default: return false;
     }
 }
Exemple #3
0
 public bool IsTrueCriteria(Event ev, Event compare, string criteria)
 {
     switch (criteria)
     {
         case "=": return (ev.CompareTo(compare) == 0);
         case "!=": return !(ev.CompareTo(compare) == 0);
         case "<=": return (ev.CompareTo(compare) <= 0);
         case "<": return (ev.CompareTo(compare) < 0);
         case ">=": return (ev.CompareTo(compare) >= 0);
         case ">": return (ev.CompareTo(compare) > 0);
     }
     return false;
 }
Exemple #4
0
 public Events ApplyFilter(Events sourceList)
 {
     Events filteredList = new Events();
     Event compare = new Event(dateToCompare, "", "");
     foreach (Event ev in sourceList)
     {
         if (IsTrueCriteria(ev, compare, criteria))
         {
             filteredList.Add(ev);
         }
     }
     return filteredList;
 }
Exemple #5
0
 bool ContainsAnyTag(Event ev, string[] tagValues)
 {
     return tagValues.Any(elem => ev.Tags.Contains('#' + elem) || ev.Tags.Contains('@' + elem));
 }
Exemple #6
0
 bool ContainsAnyString(Event ev, string[] stringValues)
 {
     return stringValues.Any(elem => ev.Title.Contains(elem) || ev.Description.Contains(elem));
 }
Exemple #7
0
 private void SaveNewAppointment(Event newAppointment)
 {
     eventsList.Add(newAppointment);
     TXTFile file = new TXTFile();
     file.SaveEventsToFile(eventsList);
 }