本文整理汇总了C#中IEditableRoot.ReadValueByPropertyName方法的典型用法代码示例。如果您正苦于以下问题:C# IEditableRoot.ReadValueByPropertyName方法的具体用法?C# IEditableRoot.ReadValueByPropertyName怎么用?C# IEditableRoot.ReadValueByPropertyName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEditableRoot
的用法示例。
在下文中一共展示了IEditableRoot.ReadValueByPropertyName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// Executes the specified item.
/// </summary>
/// <param name="item">The target item.</param>
/// <param name="oldItem">The old item.</param>
public override void Execute(IEditableRoot item, IEditableRoot oldItem)
{
if (item == null)
throw new ArgumentNullException("item");
var approval = item.ReadValueByPropertyName<IApprovalEdit>(ApprovalFieldName);
if (approval == null)
throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Approval field \"{0}\" not found in item \"{1}\" or you don't have access. Action will not run.", ApprovalFieldName, item.GetType()), "item");
var membersFound = new HashSet<int>();
foreach (var member in approval.MemberResults.Where(am => am.ApprovalLevel == approval.CurrentLevel))
{
if (member.GetApprovalMemberResult() != ApprovalMemberResults.Undecided)
continue;
if (!member.Person.HasValue || !member.OriginalApprover.HasValue || membersFound.Contains(member.OriginalApprover.Value))
continue;
membersFound.Add(member.OriginalApprover.Value);
var person = PersonManager.GetPerson(member.Person.Value);
if (person == null)
continue;
var basePersonId = member.OriginalApprover.Value;
var actionItem = DynamicTypeManager.NewActionItem();
actionItem.ActionGuid = Guid.ToString();
actionItem.Process = item.ProcessName;
actionItem.PersonId = person.Id;
actionItem.BasePersonId = basePersonId;
actionItem.ItemId = item.Id;
actionItem.IsActionNew = true;
var supportStates = item as ISupportStates;
if (supportStates != null)
actionItem.ItemStateId = supportStates.CurrentState;
actionItem.Save();
CommunicationService.NotifyActionsChanged(person.Id);
if (SendEmail && !string.IsNullOrWhiteSpace(person.Email))
{
SendMessage(item, person);
}
}
if (SendEmail && !string.IsNullOrWhiteSpace(EmailFieldName))
{
var email = item.ReadValueByPropertyName<string>(EmailFieldName);
if (!string.IsNullOrWhiteSpace(email))
{
SendMessage(item, email);
}
}
base.Execute(item, oldItem);
}
示例2: Execute
/// <summary>
/// Executes the specified item.
/// </summary>
/// <param name="item">The source item.</param>
/// <param name="oldItem">The old item.</param>
public override void Execute(IEditableRoot item, IEditableRoot oldItem)
{
if (item == null)
throw new ArgumentNullException("item");
foreach (var originalAssignee in DataContext.GetNewAssignees(item).DistinctBy(p => p.Id))
{
var assignee = originalAssignee;
if (originalAssignee.OutOfOffice == true && originalAssignee.DelegateApproverId != null)
{
assignee = PersonManager.GetFirstActivePerson(originalAssignee.Id) ?? originalAssignee;
}
var actionItem = DynamicTypeManager.NewActionItem();
actionItem.ActionGuid = Guid.ToString();
actionItem.Process = item.ProcessName;
actionItem.PersonId = assignee.Id;
actionItem.BasePersonId = originalAssignee.Id;
actionItem.ItemId = item.Id;
actionItem.IsActionNew = true;
var states = item as ISupportStates;
if (states != null)
{
actionItem.ItemStateId = states.CurrentState;
}
actionItem.Save();
CommunicationService.NotifyActionsChanged(assignee.Id);
if (SendEmail && !string.IsNullOrWhiteSpace(assignee.Email))
{
SendMessage(item, assignee);
}
}
if (SendEmail && !string.IsNullOrWhiteSpace(EmailFieldName))
{
var email = item.ReadValueByPropertyName<string>(EmailFieldName);
if (!string.IsNullOrWhiteSpace(email))
{
SendMessage(item, email);
}
}
base.Execute(item, oldItem);
}