本文整理汇总了C#中umbraco.cms.businesslogic.web.Document.getProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Document.getProperty方法的具体用法?C# Document.getProperty怎么用?C# Document.getProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类umbraco.cms.businesslogic.web.Document
的用法示例。
在下文中一共展示了Document.getProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnInit
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (!(Page.Request.CurrentExecutionFilePath ?? string.Empty).Contains("editContent.aspx"))
return;
_lblOrderInfo = new Label();
var documentId = int.Parse(HttpContext.Current.Request.QueryString["id"]);
var orderDoc = new Document(documentId);
var orderGuidValue = orderDoc.getProperty("orderGuid").Value;
if (orderGuidValue != null && !string.IsNullOrEmpty(orderGuidValue.ToString()))
{
var orderGuid = Guid.Parse(orderDoc.getProperty("orderGuid").Value.ToString());
var orderInfoXml = OrderHelper.GetOrderXML(orderGuid);
var parameters = new Dictionary<string, object>(1) {{"uniqueOrderId", orderGuid.ToString()}};
var transformation = macro.GetXsltTransformResult(orderInfoXml, macro.getXslt("uwbsOrderInfo.xslt"), parameters);
_lblOrderInfo.Text = transformation ?? "uwbsOrderInfo.xslt render issue";
}
else
{
_lblOrderInfo.Text = "Unique Order ID not found. Republish might solve this issue";
}
if (ContentTemplateContainer != null) ContentTemplateContainer.Controls.Add(_lblOrderInfo);
}
示例2: Execute
public override TaskExecutionDetails Execute(string Value)
{
TaskExecutionDetails d = new TaskExecutionDetails();
if (HttpContext.Current != null && HttpContext.Current.Items["pageID"] != null)
{
string id = HttpContext.Current.Items["pageID"].ToString();
Document doc = new Document(Convert.ToInt32(id));
if (doc.getProperty(PropertyAlias) != null)
{
d.OriginalValue = doc.getProperty(PropertyAlias).Value.ToString();
doc.getProperty(PropertyAlias).Value = Value;
doc.Publish(new BusinessLogic.User(0));
d.NewValue = Value;
d.TaskExecutionStatus = TaskExecutionStatus.Completed;
}
else
d.TaskExecutionStatus = TaskExecutionStatus.Cancelled;
}
else
d.TaskExecutionStatus = TaskExecutionStatus.Cancelled;
return d;
}
示例3: OnInit
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (!(Page.Request.CurrentExecutionFilePath ?? string.Empty).Contains("editContent.aspx"))
return;
try
{
var documentId = HttpContext.Current.Request["id"];
int docId;
int.TryParse(documentId, out docId);
if (docId != 0)
{
var emailDoc = new Document(docId);
var property = emailDoc.getProperty("emailtemplate");
if(property.Value == null)
{
// fallback for old installations
property = emailDoc.getProperty("xslttemplate");
}
if (property.Value != null)
{
var value = property.Value.ToString();
if (!string.IsNullOrEmpty(value))
{
var fileLocation = string.Format("{0}/{1}", SystemDirectories.MacroScripts.TrimEnd('/'), value.TrimStart('/'));
_lblRenderRazorContent = new Literal {Text = RazorLibraryExtensions.RenderMacro(fileLocation, docId)};
if (ContentTemplateContainer != null) ContentTemplateContainer.Controls.Add(_lblRenderRazorContent);
}
}
else
{
_lblRenderRazorContent = new Literal {Text = "No template set or found, reload node?"};
if (ContentTemplateContainer != null) ContentTemplateContainer.Controls.Add(_lblRenderRazorContent);
}
}
}
catch
{
_lblRenderRazorContent = new Literal { Text = "Error rendering data" };
if (ContentTemplateContainer != null) ContentTemplateContainer.Controls.Add(_lblRenderRazorContent);
}
}
示例4: SetDocumentDate
public void SetDocumentDate(Document document)
{
if (!ItemDocumentTypes.Contains(document.ContentType.Alias))
return;
if (document.getProperty(ItemDateProperty) == null)
return;
document.getProperty(ItemDateProperty).Value = document.CreateDateTime.Date;
}
示例5: Document_New
/// <summary>
/// Document_s the new.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="umbraco.cms.businesslogic.NewEventArgs"/> instance containing the event data.</param>
void Document_New(Document sender, umbraco.cms.businesslogic.NewEventArgs e)
{
if (sender.ContentType.Alias == "BlogPost")
{
if (sender.getProperty("PostDate") != null)
{
sender.getProperty("PostDate").Value = sender.CreateDateTime.Date;
}
}
}
示例6: Document_BeforeSave
/// <summary> Document_BeforeSave(Document sender, umbraco.cms.businesslogic.SaveEventArgs e) umbraco Document BeforeSave event :Document prüfen
/// </summary>
void Document_BeforeSave(Document sender, umbraco.cms.businesslogic.SaveEventArgs e)
{
try
{
Config config = Config.GetConfig();
foreach (ConfigDatatype author in config.Datatypes)
{
foreach (Property pr in sender.GenericProperties)
{
if (author.Guid == pr.PropertyType.DataTypeDefinition.DataType.Id)
{
Property fileprop = sender.getProperty("" + pr.PropertyType.Alias + "");
e.Cancel = File_Scanner(fileprop);
}
}
}
}
catch (Exception ex)
{
}
if (html_msg.Length > 0)
{
HtmlContent(html_msg);
html_msg.Clear();
}
}
示例7: CopyProperties
private void CopyProperties(Document fromDoc, Document toDoc)
{
foreach (umbraco.cms.businesslogic.propertytype.PropertyType propertyType in ParentDocument.ContentType.PropertyTypes)
{
toDoc.getProperty(propertyType.Alias).Value = fromDoc.getProperty(propertyType.Alias).Value;
}
}
示例8: Save
/// <summary>
/// Saveses this instance.
/// </summary>
public void Save()
{
// get the data
Document document = new Document(NodeId.Value);
Property editProperty = document.getProperty(Field);
IDataType editDataType = null;
if (editProperty != null)
{
// save the property
PropertyType editPropertyType = editProperty.PropertyType;
editDataType = editPropertyType.DataTypeDefinition.DataType;
editDataType.Data.PropertyId = editProperty.Id;
editDataType.Data.Value = Data;
}
else
{
if (Field == "pageName")
{
document.Text = Data.ToString();
}
}
document.Save();
}
示例9: Run
// Implement the Run method of IRunnableWorkflowTask
public void Run(IWorkflowInstance workflowInstance, IWorkflowRuntime runtime)
{
// In Umbraco the workflowInstance should always be castable to an UmbracoWorkflowInstance
var wf = (UmbracoWorkflowInstance) workflowInstance;
// UmbracoWorkflowInstance has a list of node Ids that are associated with the workflow in the CmsNodes property
foreach(var nodeId in wf.CmsNodes)
{
// We'll assume that only documents are attached to this workflow
var doc = new Document(nodeId);
var property = doc.getProperty(DocumentTypeProperty);
if (!String.IsNullOrEmpty((string) property.Value)) continue;
var host = HttpContext.Current.Request.Url.Host;
var pageUrl = "http://" + host + umbraco.library.NiceUrl(nodeId);
var shortUrl = API.Bit(BitLyLogin, BitLyApiKey, pageUrl, "Shorten");
property.Value = shortUrl;
}
// The run method of a workflow task is responsible for informing the runtime of the outcome.
// The outcome should be one of the items in the AvailableTransitions list.
runtime.Transition(workflowInstance, this, "done");
}
示例10: Index
public override ActionResult Index(RenderModel model)
{
if (model.Content.TemplateId.Equals(Template.GetTemplateIdFromAlias("ProjectCreate")))
{
var member = Member.GetCurrentMember();
if (member != null)
{
if (Request.HttpMethod.Equals("GET"))
return CurrentTemplate(model);
var project = CreateProject(member);
if (project != null) return this.Redirect(umbraco.library.NiceUrl(project.Id));
}
return this.Redirect(Request.UrlReferrer.AbsoluteUri);
}
else
{
var id = Convert.ToInt32(Request.Params["id"]);
var project = new Document(id);
var member = Member.GetCurrentMember();
var authorId = project.getProperty("author").Value;
if (member != null && member.Id.Equals(authorId))
{
if (Request.HttpMethod.Equals("GET"))
return base.View(model);
SaveProject(project, member);
}
return this.Redirect(umbraco.library.NiceUrl(id));
}
}
示例11: MarkAsSolution
public static string MarkAsSolution(string pageId)
{
if (MembershipHelper.IsAuthenticated())
{
var m = Member.GetCurrentMember();
var forumPost = _mapper.MapForumPost(new Node(Convert.ToInt32(pageId)));
if (forumPost != null)
{
var forumTopic = _mapper.MapForumTopic(new Node(forumPost.ParentId.ToInt32()));
// If this current member id doesn't own the topic then ignore, also
// if the topic is already solved then ignore.
if (m.Id == forumTopic.Owner.MemberId && !forumTopic.IsSolved)
{
// Get a user to save both documents with
var usr = new User(0);
// First mark the post as the solution
var p = new Document(forumPost.Id);
p.getProperty("forumPostIsSolution").Value = 1;
p.Publish(usr);
library.UpdateDocumentCache(p.Id);
// Now update the topic
var t = new Document(forumTopic.Id);
t.getProperty("forumTopicSolved").Value = 1;
t.Publish(usr);
library.UpdateDocumentCache(t.Id);
return library.GetDictionaryItem("Updated");
}
}
}
return library.GetDictionaryItem("Error");
}
示例12: Save
public void Save()
{
string[] keys = Page.Request.Form.AllKeys;
foreach (string key in keys)
{
if (key.StartsWith("DictionaryHelper"))
{
string strDocId = key.Substring(key.IndexOf("docId_") + 6);
string property = key.Remove(key.IndexOf("docId_") - 1).Substring(17);
string value = Page.Request.Form[key];
Document doc = new Document(int.Parse(strDocId));
if (property == "Text" || property == "Default" || property == "Help")
{
Property prop = doc.getProperty(property);
if (prop != null)
{
prop.Value = value;
}
}
else if (property == "Key")
{
doc.Text = value;
}
}
}
}
示例13: BtnMoveClick
protected void BtnMoveClick(object sender, EventArgs e)
{
if (Category.Id != ddlCategories.SelectedValue.ToInt32())
{
// Get the document you will move by its ID
var doc = new Document(Topic.Id);
// Create a user we can use for both
var user = new User(0);
// The new parent ID
var newParentId = ddlCategories.SelectedValue.ToInt32();
// Now update the topic parent category ID
doc.getProperty("forumTopicParentCategoryID").Value = newParentId;
// publish application node
doc.Publish(user);
// Move the document the new parent
doc.Move(newParentId);
// update the document cache so its available in the XML
umbraco.library.UpdateDocumentCache(doc.Id);
// Redirect and show message
Response.Redirect(string.Concat(CurrentPageAbsoluteUrl, "?m=", library.GetDictionaryItem("TopicHasBeenMovedText")));
}
else
{
// Can't move as they have selected the category that the topic is already in
Response.Redirect(string.Concat(CurrentPageAbsoluteUrl, "?m=", library.GetDictionaryItem("TopicAlreadyInThisCategory")));
}
}
示例14: GetValueRecursively
private string GetValueRecursively(string alias, int nodeId) {
Document n = new Document(nodeId);
Property p = n.getProperty(alias);
if (p != null && !string.IsNullOrEmpty(p.Value.ToString())) return p.Value.ToString();
else if (n.Level > 1) return GetValueRecursively(alias, n.Parent.Id);
return string.Empty;
}
示例15: GetOrderByDocumentId
/// <summary>
/// Get the order document based on a given document/node Id
/// Needs property with the alias "orderGuid" filled with the orderGuid of the order
/// </summary>
/// <param name="documentId"></param>
/// <returns></returns>
public static OrderInfo GetOrderByDocumentId(int documentId)
{
var orderDoc = new Document(documentId);
if (orderDoc.getProperty("orderGuid") != null)
{
var orderGuidValue = orderDoc.getProperty("orderGuid").Value;
if (orderGuidValue != null && !string.IsNullOrEmpty(orderGuidValue.ToString()))
{
var orderGuid = Guid.Parse(orderDoc.getProperty("orderGuid").Value.ToString());
return OrderHelper.GetOrderInfo(orderGuid);
}
}
return null;
}