本文整理匯總了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;
}