Exemple #1
0
 //check if there is any clash in terms of time and venue
 public bool ifClash(Event eventObj)
 {
     string str1 = eventName;
     string str2 = eventObj.getEventName();
     str1 = str1.ToLower();
     str2 = str2.ToLower();
     
     if (str1 == str2)
         return true;
     else if (startDate == eventObj.getStartDate() && endDate == eventObj.getEndDate())
     {
         if (startTime <= eventObj.getEndTime() || endTime >= eventObj.getStartTime())
         {
             //store two venues in two strings then transform them into lower cases
             string str3 = venue;
             string str4 = eventObj.getVenue();
             str3 = str3.ToLower();
             str4 = str4.ToLower();
             if (String.Compare(str3, str4) == 0)
                 return true;
             else
                 return false;
         }
         else
             return false;
     }
     else
         return false;
 }
 public void readFromFile()
 {
     using (StreamReader reader = new StreamReader(myEventsPath))
     {
         myHistoryEventList.Clear();
         string line;
         while ((line = reader.ReadLine()) != null)
         {
             string[] parts = line.Split('|');
             int id = Convert.ToInt32(parts[0]);
             string name = parts[1];
             int sDate = Convert.ToInt32(parts[2]);
             int eDate = Convert.ToInt32(parts[3]);
             int sTime = Convert.ToInt32(parts[4]);
             int eTime = Convert.ToInt32(parts[5]);
             string v = parts[6];
             string des = parts[7];
             Event tempEvent = new Event(id, name, sDate, eDate, sTime, eTime, v, des);
             myHistoryEventList.Add(tempEvent);
         }
     }
 }
 public bool compareEvents(Event a, Event b)
 {
     if (a.getEventName() != b.getEventName())
         return false;
     if (a.getStartDate() != b.getStartDate())
         return false;
     if (a.getEndDate() != b.getEndDate())
         return false;
     if (a.getStartTime() != b.getStartTime())
         return false;
     if (a.getEndTime() != b.getEndTime())
         return false;
     if (a.getVenue() != b.getVenue())
         return false;
     if (a.getDescription() != b.getDescription())
         return false;
     else return true;
 }