Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
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;
        }