本文整理汇总了C#中umbraco.cms.businesslogic.template.Template.ImportDesign方法的典型用法代码示例。如果您正苦于以下问题:C# Template.ImportDesign方法的具体用法?C# Template.ImportDesign怎么用?C# Template.ImportDesign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类umbraco.cms.businesslogic.template.Template
的用法示例。
在下文中一共展示了Template.ImportDesign方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeNew
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);
break;
case RenderingEngine.WebForms:
MasterPageHelper.CreateMasterPage(t);
break;
}
//if a design is supplied ensure it is updated.
if (!design.IsNullOrWhiteSpace())
{
t.ImportDesign(design);
}
return t;
}