public CalEvent(ICalEvent results) { this.EmployeeName = results.EmployeeName; this.EndTime = results.EndTime; this.Id = results.Id; this.StartTime = results.StartTime; this.WorkType = results.WorkType; this.TeamName = results.TeamName; this.AllDay = results.AllDay; this.Notes = results.Notes; }
private void WriteEvent(ICalEvent evnt) { writer.WriteLine("BEGIN:VEVENT"); writer.WriteLine("DTSTART;"+CreateIcalTime(evnt.StartDate, evnt.StartTime)); writer.WriteLine("DTEND;"+CreateIcalTime(evnt.StartDate, evnt.EndTime)); writer.WriteLine("RRULE:FREQ=WEEKLY;BYDAY="+ evnt.Day); writer.WriteLine("DESCRIPTION:"+evnt.Description); writer.WriteLine("LOCATION:"+evnt.Location); writer.WriteLine("SEQUENCE:0"); writer.WriteLine("STATUS:CONFIRMED"); writer.WriteLine("SUMMARY:"+evnt.Description); writer.WriteLine("END:VEVENT"); }
public void ExportToGoogleCalendar(string url, IEnumerable events) { object obj1 = (object)null; List <ICalEvent> icalEventList = new List <ICalEvent>(); foreach (object obj2 in events) { if (obj2 is ICalEvent) { icalEventList.Add(obj2 as ICalEvent); } else { obj1 = obj2; break; } } if (obj1 == null) { return; } PropertyInfo[] properties = obj1.GetType().GetProperties(); PropertyInfo propertyInfo1 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "text")); PropertyInfo propertyInfo2 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "start_date")); PropertyInfo propertyInfo3 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "end_date")); PropertyInfo propertyInfo4 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "description")); if (propertyInfo2 == null && propertyInfo1 == null) { return; } foreach (object obj2 in events) { ICalEvent icalEvent = new ICalEvent(); icalEvent.Summary = (string)propertyInfo1.GetValue(obj2, (object[])null); icalEvent.SDate = (DateTime)propertyInfo2.GetValue(obj2, (object[])null); if (propertyInfo3 != null) { icalEvent.EDate = (DateTime)propertyInfo3.GetValue(obj2, (object[])null); } if (propertyInfo4 != null) { icalEvent.Description = (string)propertyInfo4.GetValue(obj2, (object[])null); } icalEventList.Add(icalEvent); } this.ExportToGoogleCalendar(url, (IEnumerable <ICalEvent>)icalEventList); }
public static CalendarEvent FromDatabase(ICalEvent shift) { var data = new CalendarEvent { start = shift.StartTime, end = shift.EndTime, className = new[] { shift.WorkType.ToString() }, description = shift.TeamName, title = shift.EmployeeName, id = shift.Id, allDay = shift.AllDay, note = shift.Notes }; return(data); }
public void GetTimeTable() { string timetable = WebUtilities.HttpGet(GetTimetableUrl(),cookieJar); CQ timetablePage = timetable; foreach (var row in timetablePage["tr[bgcolor=#eeeeee]"]) { CQ dataRow = row.InnerHTML; int columnNumber = 0; ICalEvent allocateEvent = new ICalEvent(); foreach (var column in dataRow["td"]) { switch (columnNumber) { case 0: allocateEvent.Description = column.InnerText.Split('\n')[1]; break; case 2: allocateEvent.Description += " - "+ column.InnerText; break; case 4: allocateEvent.Day = column.InnerText.Substring(0,2).ToUpper(); break; case 5: allocateEvent.StartTime = ParseTime(column.InnerText); break; case 7: allocateEvent.Location = column.InnerText; break; case 9: allocateEvent.Duration = int.Parse(column.InnerText); break; case 10: allocateEvent.StartDate = ParseWeeks(column.InnerText); break; } columnNumber++; } events.Add(allocateEvent); } }
public object ParseGoogleEvent(ICalEvent ev) { return((object)SchedulerEvent.Convert(ev)); }