public void GetPlanCollection(DateTime startDate, DateTime endDate, List <Controller_Event_Log> cycleEvents, SPM db) { var ds = new ControllerEventLogs(Approach.SignalID, startDate, endDate, new List <int> { 131 }, db); var row = new Controller_Event_Log(); row.Timestamp = startDate; row.SignalID = Approach.SignalID; row.EventCode = 131; try { row.EventParam = ControllerEventLogs.GetPreviousPlan(Approach.SignalID, startDate); ds.Events.Insert(0, row); } catch { row.EventParam = 0; ds.Events.Insert(0, row); } // remove duplicate plan entries ds.MergeEvents(ds); for (var i = 0; i < ds.Events.Count(); i++) { //if this is the last plan then we want the end of the plan //to cooincide with the end of the graph if (ds.Events.Count() - 1 == i) { if (ds.Events[i].Timestamp != endDate) { var plan = new RLMPlan(ds.Events[i].Timestamp, endDate, ds.Events[i].EventParam, cycleEvents, SRLVSeconds, Approach); AddItem(plan); } } //else we add the plan with the next plans' time stamp as the end of the plan else { if (ds.Events[i].Timestamp != ds.Events[i + 1].Timestamp) { var plan = new RLMPlan(ds.Events[i].Timestamp, ds.Events[i + 1].Timestamp, ds.Events[i].EventParam, cycleEvents, SRLVSeconds, Approach); AddItem(plan); } } } }
public void AddItem(RLMPlan item) { PlanList.Add(item); }