Exemple #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;
 }
Exemple #2
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;
        }