本文整理汇总了C#中VersionOne.SDK.APIClient.Asset.AddAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:C# Asset.AddAttributeValue方法的具体用法?C# Asset.AddAttributeValue怎么用?C# Asset.AddAttributeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VersionOne.SDK.APIClient.Asset
的用法示例。
在下文中一共展示了Asset.AddAttributeValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddMultiValueRelation
protected void AddMultiValueRelation(IAssetType assetType, Asset asset, string attributeName, string valueList)
{
IAttributeDefinition customerAttribute = assetType.GetAttributeDefinition(attributeName);
string[] values = valueList.Split(';');
foreach (string value in values)
{
//SPECIAL CASE: Skip "Member:20" for Scope.Members attribute.
if (assetType.Token == "Scope" && attributeName == "Members" && value == "Member:20") continue;
string newAssetOID = GetNewAssetOIDFromDB(value, attributeName);
if (String.IsNullOrEmpty(newAssetOID) == false)
//SPECIAL CASE: Epic conversion issue. If setting story dependants or dependencies, ensure that we do not set for Epic values.
if ((attributeName == "Dependants" || attributeName == "Dependencies") && newAssetOID.Contains("Epic"))
{
continue;
}
else
{
asset.AddAttributeValue(customerAttribute, newAssetOID);
}
}
}
示例2: AddRallyMentionsValue
protected void AddRallyMentionsValue(IAssetType assetType, Asset asset, string baseAssetType, string assetOID)
{
IAttributeDefinition mentionsAttribute = assetType.GetAttributeDefinition("Mentions");
string newAssetOID = String.Empty;
if (baseAssetType == "Story")
{
//First try stories table.
newAssetOID = GetNewAssetOIDFromDB(assetOID, "Stories");
//If not found, try epics table.
if (String.IsNullOrEmpty(newAssetOID) == true)
{
newAssetOID = GetNewAssetOIDFromDB(assetOID, "Epics");
}
}
else if (baseAssetType == "Defect")
{
newAssetOID = GetNewAssetOIDFromDB(assetOID, "Defects");
}
else if (baseAssetType == "Task")
{
newAssetOID = GetNewAssetOIDFromDB(assetOID, "Tasks");
}
else if (baseAssetType == "Test")
{
//First try tests table.
newAssetOID = GetNewAssetOIDFromDB(assetOID, "Tests");
//If not found, try regression tests table.
if (String.IsNullOrEmpty(newAssetOID) == true)
{
newAssetOID = GetNewAssetOIDFromDB(assetOID, "RegressionTests");
}
}
if (String.IsNullOrEmpty(newAssetOID) == false)
asset.AddAttributeValue(mentionsAttribute, newAssetOID);
}
示例3: AddMultiValueRelation
protected void AddMultiValueRelation(IAssetType assetType, Asset asset, string attributeName, string valueList)
{
//_logger.Info("Multi Value AttributeName is {0} ", attributeName);
IAttributeDefinition customerAttribute = assetType.GetAttributeDefinition(attributeName);
string[] values = valueList.Split(';');
foreach (string value in values)
{
//SPECIAL CASE: Skip "Member:20" for Scope.Members attribute.
if (assetType.Token == "Scope" && attributeName == "Members" && value == "Member:20") continue;
//SPECIAL CASE: Change the Attribute name to match the correct table for lookup in V1 Staging
if (attributeName == "Owners")
{
attributeName = "Members";
}
else if(attributeName == "BlockingIssues")
{
attributeName = "Issues";
}
string newAssetOID = GetNewAssetOIDFromDB(value);
if (String.IsNullOrEmpty(newAssetOID) == false)
{
//SPECIAL CASE: Epic conversion issue. If setting story dependants or dependencies, ensure that we do not set for Epic values.
if ((attributeName == "Dependants" || attributeName == "Dependencies") && newAssetOID.Contains("Epic"))
{
continue;
}
else
{
asset.AddAttributeValue(customerAttribute, newAssetOID);
//_logger.Info("Adding {0} ", newAssetOID);
}
}
else
{
if (attributeName == "Mentions" || attributeName == "BaseAssets")
asset.AddAttributeValue(customerAttribute, "Member:20");
//_logger.Info("Adding {0} ", "Admin");
}
}
}
示例4: ParseAttributeNode
private static void ParseAttributeNode(Asset asset, IAttributeDefinition attribdef, XmlElement element) {
var type = element.LocalName;
asset.EnsureAttribute(attribdef);
if (type == "Relation") {
if (attribdef.IsMultiValue) {
foreach (XmlElement child in element.ChildNodes) {
var add = child.HasAttribute("act") && child.GetAttribute("act") == "add";
var token = child.GetAttribute("idref");
if(add) {
asset.AddAttributeValue(attribdef, token);
} else {
asset.LoadAttributeValue(attribdef, token);
}
}
} else {
var token = Oid.Null.Token;
if(element.HasChildNodes) {
token = ((XmlElement) element.ChildNodes.Item(0)).GetAttribute("idref");
}
var force = element.HasAttribute("act") && element.GetAttribute("act") == "set";
if(force) {
asset.ForceAttributeValue(attribdef, token);
} else {
asset.LoadAttributeValue(attribdef, token);
}
}
} else {
if (attribdef.IsMultiValue) {
foreach (XmlElement child in element.ChildNodes) {
var add = child.HasAttribute("act") && child.GetAttribute("act") == "add";
if(add) {
asset.AddAttributeValue(attribdef, child.InnerText);
} else {
asset.LoadAttributeValue(attribdef, child.InnerText);
}
}
} else {
object v = null;
if(!string.IsNullOrEmpty(element.InnerText)) {
v = element.InnerText;
}
var force = element.HasAttribute("act") && element.GetAttribute("act") == "set";
if(force) {
asset.ForceAttributeValue(attribdef, v);
} else {
asset.LoadAttributeValue(attribdef, v);
}
}
}
}
示例5: SaveChangeSetAsset
private Asset SaveChangeSetAsset(Asset changeSet, ChangeSetInfo info, IEnumerable<Oid> primaryworkitems)
{
changeSet.SetAttributeValue(ChangeSetNameDef, string.Format("'{0}' on '{1}'", info.Author, GetFormattedTime(info.ChangeDate)));
changeSet.SetAttributeValue(ChangeSetDescriptionDef, info.Message);
foreach(Oid oid in primaryworkitems)
{
changeSet.AddAttributeValue(ChangeSetPrimaryWorkitemsDef, oid);
}
V1Connection.Data.Save(changeSet, changecomment);
return changeSet;
}