コード例 #1
0
ファイル: Program.cs プロジェクト: keyanmca/_Signage
 public Boolean ApplyLoopContentCollection(LoopContentCollection contentForZone)
 {
     InitDB();
     try
     {
         LoopContentCollection lcc = new LoopContentCollection();
         lcc.LoadAll();
         foreach (var item in lcc)
         {
             foreach (var zoneitem in contentForZone)
             {
                 if (zoneitem.Loopid == item.Loopid && zoneitem.Zoneid == item.Zoneid)
                 {
                     LoopContent lc = new LoopContent();
                     lc.LoadByPrimaryKey((Int32)item.Id);
                     lc.MarkAsDeleted();
                     lc.Save();
                 }
             }
         }
         foreach (LoopContent item in contentForZone)
         {
             Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"--> "+item.Medianame);
             LoopContent nlc = new LoopContent();
             nlc.Mediaid = item.Mediaid;
             nlc.Medianame = item.Medianame;
             nlc.Loopname = item.Loopname;
             nlc.Loopid = item.Loopid;
             nlc.Zoneid = item.Zoneid;
             nlc.Zonename = item.Zonename;
             nlc.Templateid = item.Templateid;
             nlc.Templatename = item.Templatename;
             nlc.Order = item.Order;
             nlc.Save();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+ex.Message);
     }
     //SerializeLoopContentCollection();
     AddUpdateDelta("loop");
     return true;
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: keyanmca/_Signage
        public LoopContentCollection CollectLoopContentForZoneByName(string zonename, string loopname)
        {
            InitDB();
            LoopContentCollection loopContent = new LoopContentCollection();
            //tempc.Query.Where(tempc.Query.Name.Equal(zone.Name));
            //tempc.Query.Load();
            try
            {
                loopContent.Query.Where(loopContent.Query.Zonename.Equal(zonename) && loopContent.Query.Loopname.Equal(loopname));
                loopContent.Query.Load();
                foreach (var item in loopContent)
                {
                    Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"<-- " + item.Medianame);
                }
            }
            catch (Exception ex)
            {
            }

            return loopContent;
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: keyanmca/_Signage
        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;
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: keyanmca/_Signage
 private void SerializeLoopContentCollection()
 {
     try
     {
         LoopContentCollection loopcc = new LoopContentCollection();
         loopcc.LoadAll();
         LoopContent[] arrOfLoopContent = loopcc.ToArray();
         string FileName = @"c:\content\media\xml\allloopcontent.xml";
         using (FileStream fs = new FileStream(FileName, FileMode.Create))
         {
             XmlSerializer ser = new XmlSerializer(typeof(LoopContent[]));
             ser.Serialize(fs, arrOfLoopContent);
             fs.Flush();
             fs.Close();
         }
     }
     catch (Exception ex)
     {
     }
 }