public TemplateCollection CollectZonesForThisTemplateName(String templateName) { InitDB(); TemplateCollection tempc = new TemplateCollection(); TemplateCollection collectionToReturn = new TemplateCollection(); try { tempc.Query.Where(tempc.Query.Name.Equal(templateName)); tempc.Query.Load(); foreach (var item in tempc) { if (item.Zonename != "_template") collectionToReturn.Add(item); } } catch (Exception ex) { } return collectionToReturn; }
private void SerializeTemplateCollection() { try { string FileName = @"c:\content\media\xml\template.xml"; TemplateCollection templateCollection = new TemplateCollection(); templateCollection.LoadAll(); Template[] arrayOfTemplate = templateCollection.ToArray(); using (FileStream fs = new FileStream(FileName, FileMode.Create)) { XmlSerializer ser = new XmlSerializer(typeof(Template[])); ser.Serialize(fs, arrayOfTemplate); fs.Flush(); fs.Close(); } } catch (Exception ex) { } }
public TemplateCollection CollectTemplates() { InitDB(); TemplateCollection tempc = new TemplateCollection(); //coll.Query.Where(coll.Query.LastName.Like("Smi%") tempc.Query.Where(tempc.Query.Zonename.Equal("_template")); tempc.Query.Load(); return tempc; }
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; }