public int create(templateCarrier carrier, string username, string password) { Authenticate(username, password); if (carrier.Id != 0) { throw new Exception("ID may not be specified when creating"); } if (carrier == null) { throw new Exception("No carrier specified"); } // Get the user umbraco.BusinessLogic.User user = GetUser(username, password); // Create template cms.businesslogic.template.Template template = cms.businesslogic.template.Template.MakeNew(carrier.Name, user); template.MasterTemplate = carrier.MastertemplateId; template.Alias = carrier.Alias; template.Text = carrier.Name; template.Design = carrier.Design; template.Save(); clearCachedTemplate(template); return(template.Id); }
public void update(templateCarrier carrier, string username, string password) { if (carrier.Id == 0) { throw new Exception("ID must be specifed when updating"); } if (carrier == null) { throw new Exception("No carrier specified"); } cms.businesslogic.template.Template template; try { template = new cms.businesslogic.template.Template(carrier.Id); } catch (Exception) { throw new Exception("Template with ID " + carrier.Id + " not found"); } template.MasterTemplate = carrier.MastertemplateId; template.Alias = carrier.Alias; template.Text = carrier.Name; template.Design = carrier.Design; template.Save(); clearCachedTemplate(template); }
private static string SaveTemplate(string templateName, string templateAlias, string templateContents, int templateID, int masterTemplateID) { var tp = new cms.businesslogic.template.Template(templateID); var retVal = "false"; tp.Text = templateName; tp.Alias = templateAlias; tp.MasterTemplate = masterTemplateID; tp.Design = templateContents; tp.Save(); retVal = "true"; return(retVal); }
public bool UpdateTemplate(int Id, int Master, string Design, string Login, string Password) { if (ValidateCredentials(Login, Password) && UserHasAppAccess(DefaultApps.settings.ToString(), Login)) { try { var t = new cms.businesslogic.template.Template(Id) { MasterTemplate = Master, Design = Design }; //ensure events are raised t.Save(); return(true); } catch (ArgumentException) { return(false); } } return(false); }
public bool UpdateTemplate(int Id, int Master, string Design, string Login, string Password) { if (ValidateCredentials(Login, Password) && UserHasAppAccess(DefaultApps.settings.ToString(), Login)) { try { var t = new cms.businesslogic.template.Template(Id) { MasterTemplate = Master, Design = Design }; //ensure events are raised t.Save(); return true; } catch (ArgumentException) { return false; } } return false; }
public void update(templateCarrier carrier, string username, string password) { if (carrier.Id == 0) throw new Exception("ID must be specifed when updating"); if (carrier == null) throw new Exception("No carrier specified"); cms.businesslogic.template.Template template; try { template = new cms.businesslogic.template.Template(carrier.Id); } catch (Exception) { throw new Exception("Template with ID " + carrier.Id + " not found"); } template.MasterTemplate = carrier.MastertemplateId; template.Alias = carrier.Alias; template.Text = carrier.Name; template.Design = carrier.Design; template.Save(); clearCachedTemplate(template); }
private static string SaveTemplate(string templateName, string templateAlias, string templateContents, int templateID, int masterTemplateID) { var tp = new cms.businesslogic.template.Template(templateID); var retVal = "false"; tp.Text = templateName; tp.Alias = templateAlias; tp.MasterTemplate = masterTemplateID; tp.Design = templateContents; tp.Save(); retVal = "true"; return retVal; }