private Storage.Theme duptheme(int themeId) { Storage.Theme theme = sto.getEntityByID <Storage.Theme>(themeId); if (theme == null) { return(null); } Storage.Theme result = sto.addTheme(userId, theme.themeTitle, theme.CSS, Image.FromStream(new MemoryStream(theme.logo.ToArray()))); Storage.Model mod = sto.getEntityByID <Storage.Model>(modelId); if (result != null && mod != null) { this.themeId = result.themeID; mod.themeID = result.themeID; if (sto.commit()) { return(result); } else { return(null); } } else { return(null); } }
private bool fillReference() { StorageManager sto = new StorageManager(); Storage.Model mod = sto.getEntityByID <Storage.Model>(modelId); if (mod == null) { return(false); } this.themeId = mod.themeID; if (themeId == defaultthemeid) { isDefTheme = true; } else { isDefTheme = false; } this.complete = true; return(true); }
/// <summary> /// Private method, used to retrieve wf from db and put into the object cache /// </summary /// <returns><value>true</value>on success,<value>false</value> otherwise</returns> private bool _RetrieveWf() { if (wf_cache == null) { // Must retrieve it from db StorageManager sto = new StorageManager(); Storage.Model mod = sto.getEntityByID <Model>(modelId); if (mod == null) { return(false); } wf_cache = (Workflow)sto.byteArray2Object(mod.xml.ToArray()); if (wf_cache == null) { return(false); } wf_cache.WorkflowName = mod.nameModel; return(true); } else { return(false); } }