public Boolean InsertLoop(Loop loop) { InitDB(); Loop newLoop = new Loop(); newLoop.Name = loop.Name; newLoop.Description = loop.Description; newLoop.Templateid = loop.Templateid; newLoop.Templatename = loop.Templatename; Boolean functionResult = false; try { newLoop.Save(); functionResult = true; } catch (Exception ex) { functionResult = false; } return functionResult; }
public LoopContentCollection CollectLoopContentForZone(Template zone, Loop loop) { InitDB(); LoopContentCollection loopContent = new LoopContentCollection(); try { loopContent.Query.Where(loopContent.Query.Zoneid.Equal(zone.Id) && loopContent.Query.Loopid.Equal(loop.Id)); loopContent.Query.Load(); foreach (var item in loopContent) { Console.WriteLine(DateTime.Now.ToShortTimeString()+" "+"<-- " + item.Medianame); } } catch (Exception ex) { } return loopContent; }
public Loop CollectThisLoop(string loopName) { try { InitDB(); Loop lc = new Loop(); LoopCollection lcollection = new LoopCollection(); lcollection.Query.Where(lcollection.Query.Name.Equal(loopName)); lcollection.Query.Load(); foreach (Loop item in lcollection) { Console.WriteLine(DateTime.Now.ToShortTimeString()+" "+"Collecting Loop:" + item.Name); lc = item; break; } return lc; } catch (Exception ex) { Console.WriteLine(DateTime.Now.ToShortTimeString()+" "+"COLLECTING LOOP:"+ex.Message); return null; } }
public Boolean RemoveLoop(Loop loop) { InitDB(); try { Loop deleteLoop = new Loop(); deleteLoop.LoadByPrimaryKey((long)loop.Id); deleteLoop.MarkAsDeleted(); deleteLoop.Save(); } catch (Exception ex) { return false; } AddUpdateDelta("loop"); return true; }