Esempio n. 1
0
 public string EditEvent(int index, string newEventName, DateTime newStartDate, DateTime newEndDate, DateTime newStartTime, DateTime newEndTime, bool newalarmStatus, bool newUrgent, DateTime newAlarmTime)
 {
     Debug.Assert(index >= 0 && index < ForTempUse.Count);
     if (index >= 0 && index < ForTempUse.Count)
     {
         AddToUndoList();
         int flag = 0;
         if (BinSearchEventcode(ForTempUse.ElementAt(index).EventCode, ref flag))
         {
             Event e = QStorage.RetrieveEvent(flag);
             if (newEventName != null)
             {
                 e.EventName = newEventName;
             }
             if (newStartDate != empty)
             {
                 e.StartDate = newStartDate;
             }
             if (newEndDate != empty)
             {
                 e.EndDate = newEndDate;
             }
             if (newStartTime != empty)
             {
                 e.StartTime = newStartTime;
             }
             if (newEndTime != empty)
             {
                 e.EndTime = newEndTime;
             }
             e.AlarmStatus = newalarmStatus;
             if (newAlarmTime != empty)
             {
                 e.AlarmTime = newAlarmTime;
             }
             else
             {
                 e.AlarmTime = e.StartTime;
             }
             e.Importance = newUrgent;
             if (e.AlarmStatus)
             {
                 e.AlarmTime = e.AlarmTime.AddDays(e.EndDate.Day - 1);
                 e.AlarmTime = e.AlarmTime.AddMonths(e.EndDate.Month - 1);
                 e.AlarmTime = e.AlarmTime.AddYears(e.EndDate.Year - 1);
             }
             WriteQWIKFile();
             return(e.EventName + ' ' + e.GetDeadline().ToShortDateString() + ' ' + e.GetDeadline().ToShortTimeString());
         }
         else
         {
             return(null);
         }
     }
     else
     {
         throw new System.IndexOutOfRangeException();
     }
 }
Esempio n. 2
0
        public string[] ConvertTypetoString(Event eventObject)
        {
            Debug.Assert(eventObject != null);
            string eventname, enddate, starttime = null, endtime, remark, urgent;

            eventname = eventObject.EventName;
            enddate   = eventObject.EndDate.ToShortDateString();
            endtime   = eventObject.EndTime.ToShortTimeString();
            if (endtime != "11:59 PM")
            {
                starttime = eventObject.StartTime.ToShortTimeString();
            }

            if (eventObject.Importance)
            {
                urgent = "Urgent";
            }
            else
            {
                urgent = null;
            }
            if (eventObject.AlarmStatus)
            {
                remark = "Alarm " + eventObject.AlarmTime.ToShortTimeString();
            }
            else
            {
                remark = null;
            }
            if (eventObject.GetDeadline().CompareTo(DateTime.Now) < 0 && !eventObject.EventStatus)
            {
                remark = "Missed Deadline";
            }
            if (eventObject.EventStatus)
            {
                remark = "Done";
            }
            string[] finalstring = { eventname, enddate + ' ' + starttime, remark, urgent };
            return(finalstring);
        }
Esempio n. 3
0
        public string[] ConvertTypetoString(Event eventObject)
        {
            Debug.Assert(eventObject != null);
            string eventname, enddate, starttime = null, endtime, remark, urgent;
            eventname = eventObject.EventName;
            enddate = eventObject.EndDate.ToShortDateString();
            endtime = eventObject.EndTime.ToShortTimeString();
            if (endtime != "11:59 PM")
                starttime = eventObject.StartTime.ToShortTimeString();

            if (eventObject.Importance)
                urgent = "Urgent";
            else urgent = null;
            if (eventObject.AlarmStatus)
                remark = "Alarm " + eventObject.AlarmTime.ToShortTimeString();
            else remark = null;
            if (eventObject.GetDeadline().CompareTo(DateTime.Now) < 0 && !eventObject.EventStatus)
                remark = "Missed Deadline";
            if (eventObject.EventStatus)
                remark = "Done";
            string[] finalstring = { eventname, enddate + ' ' + starttime, remark, urgent };
            return finalstring;
        }