public Boolean InsertScheduleItem(Schedule schedule) { InitDB(); Schedule newSchedule = new Schedule(); newSchedule.Loopid = schedule.Loopid; newSchedule.Loopname = schedule.Loopname; newSchedule.Screenid = schedule.Screenid; newSchedule.Screenname = schedule.Screenname; newSchedule.Groupid = schedule.Groupid; newSchedule.Groupname = schedule.Groupname; newSchedule.Loopstart = schedule.Loopstart; newSchedule.Loopend = schedule.Loopend; newSchedule.Createdon = schedule.Createdon; Boolean functionResult = false; try { newSchedule.Save(); functionResult = true; } catch (Exception ex) { functionResult = false; } //SerializeScheduleCollection(); AddUpdateDelta("schedule"); return functionResult; }
public Boolean UpdateScheduleForScreens(ScheduleCollection scheduleCollection) { InitDB(); try { ScheduleCollection currentSchedule = new ScheduleCollection(); ScheduleCollection newSchedule = new ScheduleCollection(); //currentSchedule.LoadAll(); currentSchedule.Query.Where(currentSchedule.Query.Screenname.NotEqual("")); currentSchedule.Query.Load(); if (scheduleCollection.Count > 0) currentSchedule.MarkAllAsDeleted(); currentSchedule.Save(); foreach (Schedule schedule in scheduleCollection) { Schedule newSch = new Schedule(); newSch.Loopname = schedule.Loopname; newSch.Screenname = schedule.Screenname; newSch.Groupname = schedule.Groupname; newSch.Loopstart = schedule.Loopstart; newSch.Loopend = schedule.Loopend; newSchedule.Add(newSch); } newSchedule.Save(); SerializeScheduleCollection(); SerializeLoopCollection(); SerializeLoopContentCollection(); SerializeContentCollection(); SerializeTemplateCollection(); AddUpdateDelta("schedule"); } catch (Exception ex) { } return true; }