public static Template MakeNew(string name, BusinessLogic.User u) { // CMSNode MakeNew(int parentId, Guid objectType, int userId, int level, string text, Guid uniqueID) CMSNode n = CMSNode.MakeNew(-1, _objectType, u.Id, 1, name, Guid.NewGuid()); //ensure unique alias name = helpers.Casing.SafeAlias(name); if (GetByAlias(name) != null) { name = EnsureUniqueAlias(name, 1); } name = name.Replace("/", ".").Replace("\\", ""); if (name.Length > 100) { name = name.Substring(0, 95) + "..."; } SqlHelper.ExecuteNonQuery("INSERT INTO cmsTemplate (NodeId, Alias, design, master) VALUES (@nodeId, @alias, @design, @master)", SqlHelper.CreateParameter("@nodeId", n.Id), SqlHelper.CreateParameter("@alias", name), SqlHelper.CreateParameter("@design", ' '), SqlHelper.CreateParameter("@master", DBNull.Value)); Template t = new Template(n.Id); NewEventArgs e = new NewEventArgs(); t.OnNew(e); return(t); }
public static StylesheetProperty MakeNew(string Text, StyleSheet sheet, BusinessLogic.User user) { CMSNode newNode = CMSNode.MakeNew(sheet.Id, moduleObjectType, user.Id, 2, Text, Guid.NewGuid()); Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text, "Insert into cmsStylesheetProperty (nodeId,stylesheetPropertyAlias,stylesheetPropertyValue) values ('" + newNode.Id + "','" + Text + "','')"); return(new StylesheetProperty(newNode.Id)); }
public static CMSNode MakeNew( int parentId, int level, string text, Guid objectType) { return(CMSNode.MakeNew(parentId, objectType, 0, level, text, Guid.NewGuid())); }
/// <summary> /// Create a new MemberGroup /// </summary> /// <param Name="Name">The Name of the MemberGroup</param> /// <param Name="u">The creator of the MemberGroup</param> /// <returns>The new MemberGroup</returns> public static MemberGroup MakeNew(string Name, BusinessLogic.User u) { Guid newId = Guid.NewGuid(); CMSNode.MakeNew(-1, _objectType, u.Id, 1, Name, newId); return(new MemberGroup(newId)); }
public static StyleSheet MakeNew(BusinessLogic.User user, string Text, string FileName, string Content) { // Create the Umbraco node CMSNode newNode = CMSNode.MakeNew(-1, moduleObjectType, user.Id, 1, Text, Guid.NewGuid()); // Create the stylesheet data Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text, "insert into cmsStylesheet (nodeId, filename, content) values ('" + newNode.Id.ToString() + "','" + FileName + "',@content)", new SqlParameter("@content", Content)); return(new StyleSheet(newNode.UniqueId)); }
/// <summary> /// Creates a new datatypedefinition given its Name and the user which creates it. /// </summary> /// <param Name="u">The user who creates the datatypedefinition</param> /// <param Name="Text">The Name of the DataTypeDefinition</param> /// <returns></returns> public static DataTypeDefinition MakeNew(BusinessLogic.User u, string Text) { int newId = CMSNode.MakeNew(-1, _objectType, u.Id, 1, Text, Guid.NewGuid()).Id; Cms.BusinessLogic.datatype.controls.Factory f = new Cms.BusinessLogic.datatype.controls.Factory(); Guid FirstControlId = f.GetAll()[0].Id; Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text, "Insert into cmsDataType (nodeId, controlId, dbType) values (" + newId.ToString() + ",'" + FirstControlId.ToString() + "','Ntext')"); return(new DataTypeDefinition(newId)); }
/// <summary> /// Create a new MemberGroup /// </summary> /// <param name="Name">The name of the MemberGroup</param> /// <param name="u">The creator of the MemberGroup</param> /// <returns>The new MemberGroup</returns> public static MemberGroup MakeNew(string Name, BusinessLogic.User u) { Guid newId = Guid.NewGuid(); CMSNode.MakeNew(-1, _objectType, u.Id, 1, Name, newId); MemberGroup mg = new MemberGroup(newId); NewEventArgs e = new NewEventArgs(); mg.OnNew(e); return(mg); }
public static StylesheetProperty MakeNew(string Text, StyleSheet sheet, BusinessLogic.User user) { CMSNode newNode = CMSNode.MakeNew(sheet.Id, moduleObjectType, user.Id, 2, Text, Guid.NewGuid()); SqlHelper.ExecuteNonQuery("Insert into cmsStylesheetProperty (nodeId,stylesheetPropertyAlias,stylesheetPropertyValue) values ('" + newNode.Id + "','" + Text + "','')"); StylesheetProperty ssp = new StylesheetProperty(newNode.Id); NewEventArgs e = new NewEventArgs(); ssp.OnNew(e); return(ssp); }
private static Template MakeNew(string name, BusinessLogic.User u, Template master, string design) { // CMSNode MakeNew(int parentId, Guid objectType, int userId, int level, string text, Guid uniqueID) CMSNode n = CMSNode.MakeNew(-1, _objectType, u.Id, 1, name, Guid.NewGuid()); //ensure unique alias name = helpers.Casing.SafeAlias(name); if (GetByAlias(name) != null) { name = EnsureUniqueAlias(name, 1); } name = name.Replace("/", ".").Replace("\\", ""); if (name.Length > 100) { name = name.Substring(0, 95) + "..."; } SqlHelper.ExecuteNonQuery("INSERT INTO cmsTemplate (NodeId, Alias, design, master) VALUES (@nodeId, @alias, @design, @master)", SqlHelper.CreateParameter("@nodeId", n.Id), SqlHelper.CreateParameter("@alias", name), SqlHelper.CreateParameter("@design", ' '), SqlHelper.CreateParameter("@master", DBNull.Value)); Template t = new Template(n.Id); NewEventArgs e = new NewEventArgs(); t.OnNew(e); if (master != null) { t.MasterTemplate = master.Id; } switch (DetermineRenderingEngine(t, design)) { case RenderingEngine.Mvc: ViewHelper.CreateViewFile(t, true); break; case RenderingEngine.WebForms: MasterPageHelper.CreateMasterPage(t, true); break; } //if a design is supplied ensure it is updated. if (!design.IsNullOrWhiteSpace()) { t.ImportDesign(design); } return(t); }
/// <summary> /// Create a new MemberType /// </summary> /// <param Name="Text">The Name of the MemberType</param> /// <param Name="u">Creator of the MemberType</param> public static MemberType MakeNew(BusinessLogic.User u, string Text) { int ParentId = -1; int level = 1; Guid uniqueId = Guid.NewGuid(); CMSNode n = CMSNode.MakeNew(ParentId, _objectType, u.Id, level, Text, uniqueId); ContentType.Create(n.Id, Text, ""); return(new MemberType(n.Id)); }
public static StylesheetProperty MakeNew(string Text, StyleSheet sheet, BusinessLogic.User user) { var newNode = CMSNode.MakeNew(sheet.Id, ModuleObjectType, user.Id, 2, Text, Guid.NewGuid()); SqlHelper.ExecuteNonQuery(String.Format("Insert into cmsStylesheetProperty (nodeId,stylesheetPropertyAlias,stylesheetPropertyValue) values ('{0}','{1}','')", newNode.Id, Text)); var ssp = new StylesheetProperty(newNode.Id); var e = new NewEventArgs(); ssp.OnNew(e); return(ssp); }
public static Template MakeNew(string Name, BusinessLogic.User u) { // CMSNode MakeNew(int parentId, Guid objectType, int userId, int level, string text, Guid uniqueId) CMSNode n = CMSNode.MakeNew(-1, _objectType, u.Id, 1, Name, Guid.NewGuid()); if (Name.Length > 100) { Name = Name.Substring(0, 95) + "..."; } Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text, "Insert into cmsTemplate (NodeId, Alias, design,master) Values (" + n.Id + ",'" + SqlHelper.SafeString(Name) + "',' ',0)"); return(new Template(n.Id)); }
/// <summary> /// Creates a new Media /// </summary> /// <param Name="Name">The Name of the media</param> /// <param Name="dct">The type of the media</param> /// <param Name="u">The user creating the media</param> /// <param Name="ParentId">The id of the folder under which the media is created</param> /// <returns></returns> public static Media MakeNew(string Name, MediaType dct, BusinessLogic.User u, int ParentId) { Guid newId = Guid.NewGuid(); // Updated to match level from base node CMSNode n = new CMSNode(ParentId); int newLevel = n.Level; newLevel++; CMSNode.MakeNew(ParentId, _objectType, u.Id, newLevel, Name, newId); Media tmp = new Media(newId); tmp.CreateContent(dct); return(tmp); }
/// <summary> /// Create a new MemberType /// </summary> /// <param name="Text">The name of the MemberType</param> /// <param name="u">Creator of the MemberType</param> public static MemberType MakeNew(User u, string Text) { int ParentId = -1; int level = 1; Guid uniqueId = Guid.NewGuid(); CMSNode n = CMSNode.MakeNew(ParentId, _objectType, u.Id, level, Text, uniqueId); ContentType.Create(n.Id, Text, ""); MemberType mt = new MemberType(n.Id); NewEventArgs e = new NewEventArgs(); mt.OnNew(e); return(mt); }
public static StyleSheet MakeNew(BusinessLogic.User user, string Text, string FileName, string Content) { // Create the umbraco node var newNode = CMSNode.MakeNew(-1, ModuleObjectType, user.Id, 1, Text, Guid.NewGuid()); // Create the stylesheet data SqlHelper.ExecuteNonQuery(string.Format("insert into cmsStylesheet (nodeId, filename, content) values ('{0}','{1}',@content)", newNode.Id, FileName), SqlHelper.CreateParameter("@content", Content)); // save to file to avoid file coherency issues var newCss = new StyleSheet(newNode.Id, false, false); var e = new NewEventArgs(); newCss.OnNew(e); return(newCss); }
/// <summary> /// Creates a new datatypedefinition given its name and the user which creates it. /// </summary> /// <param name="u">The user who creates the datatypedefinition</param> /// <param name="Text">The name of the DataTypeDefinition</param> /// <param name="UniqueId">Overrides the CMSnodes uniqueID</param> /// <returns></returns> public static DataTypeDefinition MakeNew(BusinessLogic.User u, string Text, Guid UniqueId) { int newId = CMSNode.MakeNew(-1, _objectType, u.Id, 1, Text, UniqueId).Id; cms.businesslogic.datatype.controls.Factory f = new cms.businesslogic.datatype.controls.Factory(); // initial control id changed to empty to ensure that it'll always work no matter if 3rd party configurators fail // ref: http://umbraco.codeplex.com/workitem/29788 Guid FirstcontrolId = Guid.Empty; SqlHelper.ExecuteNonQuery("Insert into cmsDataType (nodeId, controlId, dbType) values (" + newId.ToString() + ",@controlId,'Ntext')", SqlHelper.CreateParameter("@controlId", FirstcontrolId)); DataTypeDefinition dtd = new DataTypeDefinition(newId); dtd.OnNew(EventArgs.Empty); return(dtd); }