Beispiel #1
0
        public Boolean InsertTemplate(Template template)
        {
            InitDB();
            Template newTemplate = new Template();
            newTemplate.Name = template.Name;
            newTemplate.Description = template.Description;
            newTemplate.Created = DateTime.Now;
            newTemplate.Zonename = template.Zonename;
            newTemplate.Zonedescription = template.Zonedescription;
            newTemplate.Opacity = template.Opacity;
            newTemplate.X = template.X;
            newTemplate.Y = template.Y;
            newTemplate.Width = template.Width;
            newTemplate.Height = template.Height;

            if (template.Zonename == "_template")
            {
                Template newZone = new Template();
                newZone.Name = template.Name;
                newZone.X = 0;
                newZone.Y = 0;
                newZone.Width = 1024;
                newZone.Height = 768;
                newZone.Opacity = 1;
                newZone.Zonename = "Background";
                newZone.Zonedescription = "Template Background";
                newZone.Save();
            }
            Boolean functionResult = false;
            try
            {
                newTemplate.Save();
                //SerializeTemplateCollection();
                functionResult = true;
            }
            catch (Exception ex)
            {
                functionResult = false;
            }
            return functionResult;
        }
Beispiel #2
0
 public TemplateCollection CollectZonesForTemplate(Template zone)
 {
     InitDB();
     TemplateCollection tempc = new TemplateCollection();
     TemplateCollection collectionToReturn = new TemplateCollection();
     try
     {
         tempc.Query.Where(tempc.Query.Name.Equal(zone.Name));
         tempc.Query.Load();
         foreach (var item in tempc)
         {
             if (item.Zonename != "_template")
                 collectionToReturn.Add(item);
         }
     }
     catch (Exception ex)
     {
     }
     return collectionToReturn;
 }
Beispiel #3
0
        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;
        }
Beispiel #4
0
 public Boolean ChangeTemplate(Template templateName)
 {
     InitDB();
     Template newTemplate = new Template();
     newTemplate.LoadByPrimaryKey((long)templateName.Id);
     newTemplate.Name = templateName.Name;
     newTemplate.Description = templateName.Description;
     newTemplate.Zonename = templateName.Zonename;
     newTemplate.Zonedescription = templateName.Zonedescription;
     newTemplate.X = templateName.X;
     newTemplate.Y = templateName.Y;
     newTemplate.Width = templateName.Width;
     newTemplate.Height = templateName.Height;
     newTemplate.Opacity = templateName.Opacity;
     Boolean functionResult = false;
     try
     {
         newTemplate.Save();
         functionResult = true;
     }
     catch (Exception ex)
     {
         functionResult = false;
     }
     return functionResult;
 }
Beispiel #5
0
        public Boolean RemoveTemplate(Template templateName)
        {
            InitDB();
            TemplateCollection tempCollection = new TemplateCollection();
            if (templateName.Zonename == "_template")
            {
                tempCollection.Query.Where(tempCollection.Query.Name.Equal(templateName.Name));
                tempCollection.Query.Load();
                tempCollection.MarkAllAsDeleted();
                tempCollection.Save();
                //SerializeTemplateCollection();
            }
            else
            {
                Template newTemplate = new Template();
                newTemplate.LoadByPrimaryKey((long)templateName.Id);
                newTemplate.MarkAsDeleted();
                newTemplate.Save();
                //SerializeTemplateCollection();
            }

            return true;
        }
Beispiel #6
0
        public long ChangeMedia(Content mediaName)
        {
            InitDB();

            Template newTemplate = new Template();
            Content newMedia = new Content();
            newMedia.LoadByPrimaryKey((long)mediaName.Id);
            newMedia.Contenttype = mediaName.Contenttype;
            newMedia.Metadata1 = mediaName.Metadata1;
            newMedia.Metadata2 = mediaName.Metadata2;
            newMedia.Metadata3 = mediaName.Metadata3;
            newMedia.Metadata4 = mediaName.Metadata4;
            newMedia.Metadata5 = mediaName.Metadata5;
            newMedia.Metadata6 = mediaName.Metadata6;
            newMedia.Metadata7 = mediaName.Metadata7;
            newMedia.Metadata8 = mediaName.Metadata8;
            newMedia.Metadata9 = mediaName.Metadata9;
            newMedia.Importdate = mediaName.Importdate;
            newMedia.Filesize = mediaName.Filesize;
            newMedia.Filelocation = mediaName.Filelocation;
            newMedia.Description = mediaName.Description;
            newMedia.Name = mediaName.Name;
            newMedia.Snapshot = mediaName.Snapshot;
            newMedia.Uploadstatus = mediaName.Uploadstatus;
            long functionResult = 0;
            try
            {
                newMedia.Save();
                //SerializeContentCollection();
                functionResult = (long)newMedia.Id;
            }
            catch (Exception ex)
            {
                functionResult = 0;
            }

            AddUpdateDelta("content");
            return functionResult;
        }