当前位置: 首页>>代码示例>>C#>>正文


C# Asset.GetAttribute方法代码示例

本文整理汇总了C#中VersionOne.SDK.APIClient.Asset.GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# Asset.GetAttribute方法的具体用法?C# Asset.GetAttribute怎么用?C# Asset.GetAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VersionOne.SDK.APIClient.Asset的用法示例。


在下文中一共展示了Asset.GetAttribute方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Validate

        /// <summary>
        /// Validate single Asset attribute. If attribute is not loaded, it is just considered invalid.
        /// </summary>
        /// <param name="asset">Asset to validate</param>
        /// <param name="attributeDefinition">Attribute definition of validated attribute</param>
        /// <returns>Validation result</returns>
        // TODO create separate private method to avoid excessive GetRequiredFields() calls
        public bool Validate(Asset asset, IAttributeDefinition attributeDefinition)
        {
            GetRequiredFields(asset.AssetType);
            asset.EnsureAttribute(attributeDefinition);
            Attribute attribute = asset.GetAttribute(attributeDefinition);
            bool result = attribute != null && !(IsMultiValueAndUnfilled(attribute) || IsSingleValueAndUnfilled(attribute));

            if (!result && attribute != null)
            {
                result = !attribute.HasChanged && !isAttributeUnfilledOnServer(asset, attributeDefinition);
            }

            return result;
        }
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:21,代码来源:RequiredFieldValidator.cs

示例2: GetAttributeValue

 private static string GetAttributeValue(Asset asset, IAttributeDefinition attributeDef)
 {
     var value = asset.GetAttribute(attributeDef).Value;
     return (null != value) ? value.ToString() : "";
 }
开发者ID:versionone,项目名称:VersionOne.Integration.HPALM,代码行数:5,代码来源:TestReaderService.cs

示例3: AssertMultiValueAttribute

 private void AssertMultiValueAttribute(object expected, Asset subject, string attributeToken)
 {
     IAttributeDefinition def = _svc.StubCentral.MetaModel.GetAttributeDefinition(attributeToken);
     IList values = subject.GetAttribute(def).ValuesList;
     Assert.IsNotNull(values);
     Assert.IsTrue(values.Contains(expected), "Attribute: {0}\n Values: {1}\n Expected: {2}", attributeToken, EnumerateValues(values), expected);
 }
开发者ID:marcinczekaj,项目名称:v1-jira-integration,代码行数:7,代码来源:TestWriterServiceTester.cs

示例4: AssertSingleValueAttribute

 private void AssertSingleValueAttribute(object expected, Asset subject, string attributeToken)
 {
     IAttributeDefinition def = _svc.StubCentral.MetaModel.GetAttributeDefinition(attributeToken);
     object actual = subject.GetAttribute(def).Value;
     Assert.AreEqual(expected, actual, attributeToken);
 }
开发者ID:marcinczekaj,项目名称:v1-jira-integration,代码行数:6,代码来源:TestWriterServiceTester.cs

示例5: FindTimebox

        private Oid FindTimebox(Asset test) {
            if(createDefect == CreateDefect.CurrentIteration) {
                return test.GetAttribute(TestTimeboxDef).Value as Oid;
            }

            return FindTimebox(test.GetAttribute(TestScheduleDef).Value as Oid);
        }
开发者ID:versionone,项目名称:VersionOne.Integration.HPALM,代码行数:7,代码来源:TestWriterService.cs

示例6: GetProjectWrapperList

        private IEnumerable<ProjectWrapper> GetProjectWrapperList(Asset asset, IAttributeDefinition attrName, int depth) {
            var list = new List<ProjectWrapper>{new ProjectWrapper(asset, asset.GetAttribute(attrName).Value.ToString(), depth)};

            foreach (var child in asset.Children) {
                list.AddRange(GetProjectWrapperList(child, attrName, depth + 1));
            }
            
            return list;
        }
开发者ID:versionone,项目名称:VersionOne.Integration.HPALM,代码行数:9,代码来源:V1Connector.cs

示例7: CreateRelatedDefect

        private Asset CreateRelatedDefect(string newDescription, Asset test) {
            var defect = Services.New(DefectType, Oid.Null);
            defect.AddAttributeValue(DefectAffectedWorkitemsDef, test.GetAttribute(TestParentDef).Value);
            defect.SetAttributeValue(DefectScopeDef, test.GetAttribute(TestScopeDef).Value);

            var parent = (Oid)test.GetAttribute(TestParentDef).Value;
            
            defect.SetAttributeValue(DefectType.GetAttributeDefinition("Name"),
                string.Format(
                    "{0} \"{1}\" has failing Acceptance Test(s)",
                    Services.Localization(parent.AssetType.DisplayName),
                    test.GetAttribute(TestParentNumberDef).Value));

            defect.SetAttributeValue(DefectType.GetAttributeDefinition("Description"), newDescription);

            var timeboxOid = FindTimebox(test);

            if(!timeboxOid.IsNull) {
                defect.SetAttributeValue(DefectTimeboxDef, timeboxOid);
            }

            return defect;
        }
开发者ID:versionone,项目名称:VersionOne.Integration.HPALM,代码行数:23,代码来源:TestWriterService.cs

示例8: UpdateOpenTest

        private void UpdateOpenTest(Oid newStatus, Asset test) {
            var statusAttribute = test.GetAttribute(TestStatusDef);
            var statusOid = (Oid)statusAttribute.Value;

            if(newStatus != statusOid) {
                test.SetAttributeValue(TestStatusDef, newStatus);
                Services.Save(test, changeComment);
                Logger.Log(string.Format("Updating status of Acceptance Test \"{0}\".", test.Oid.Token));
            }
        }
开发者ID:versionone,项目名称:VersionOne.Integration.HPALM,代码行数:10,代码来源:TestWriterService.cs

示例9: RelatedDefectExists

        private bool RelatedDefectExists(Asset test) {
            var primaryWorkitemQuery = new Query(PrimaryWorkitem);

            var affectedTerm = new FilterTerm(DefectAffectedWorkitemsDef);
            affectedTerm.Equal(test.GetAttribute(TestParentDef).Value);
            var statusTerm = new FilterTerm(DefectAssetStateDef);
            statusTerm.Equal(AssetState.Active);
            primaryWorkitemQuery.Filter = new AndFilterTerm(affectedTerm, statusTerm);

            return Services.Retrieve(primaryWorkitemQuery).Assets.Count > 0;
        }
开发者ID:versionone,项目名称:VersionOne.Integration.HPALM,代码行数:11,代码来源:TestWriterService.cs

示例10: TimeboxIsCurrent

        private bool TimeboxIsCurrent(Asset test) {
            var timeboxOid = test.GetAttribute(TestTimeboxDef).Value as Oid;

            if((timeboxOid == null) || timeboxOid.IsNull) {
                return false;
            }

            var timeboxStateQuery = new Query(TimeboxType);
            timeboxStateQuery.Selection.Add(TimeboxAssetStateDef);
            var term = new FilterTerm(TimeboxType.GetAttributeDefinition("ID"));
            term.Equal(timeboxOid.Token);
            timeboxStateQuery.Filter = term;

            var result = Services.Retrieve(timeboxStateQuery);

            if(result.Assets.Count == 0) {
                return false;
            }

            var timebox = result.Assets[0];

            return ((AssetState)timebox.GetAttribute(TimeboxAssetStateDef).Value == AssetState.Active);
        }
开发者ID:versionone,项目名称:VersionOne.Integration.HPALM,代码行数:23,代码来源:TestWriterService.cs

示例11: Link

 internal Link(Asset asset) {
     Title = asset.GetAttribute(asset.AssetType.GetAttributeDefinition(Entity.NameProperty)).Value.ToString();
     Url = asset.GetAttribute(asset.AssetType.GetAttributeDefinition(UrlProperty)).Value.ToString();
     OnMenu = (bool)asset.GetAttribute(asset.AssetType.GetAttributeDefinition(OnMenuProperty)).Value;
 }
开发者ID:versionone,项目名称:VersionOne.Integration.TFS.ServerConnector,代码行数:5,代码来源:Link.cs

示例12: AssetPassesShowMyTasksFilter

        /// <summary>
        /// Check if asset should be used when Show My Tasks filter is on
        /// </summary>
        /// <param name="asset">Story, Task, Defect or Test</param>
        /// <returns>true if current user is owner of asset, false - otherwise</returns>
        public bool AssetPassesShowMyTasksFilter(Asset asset) {
            if(asset.HasChanged || asset.Oid.IsNull) {
                return true;
            }

            var definition = workitemType.GetAttributeDefinition(Entity.OwnersProperty);
            var attribute = asset.GetAttribute(definition);
            var owners = attribute.Values;
            
            if(owners.Cast<Oid>().Any(oid => oid == MemberOid)) {
                return true;
            }

            return asset.Children != null && asset.Children.Any(AssetPassesShowMyTasksFilter);
        }
开发者ID:JogoShugh,项目名称:VersionOne.Client.VisualStudio,代码行数:20,代码来源:ApiDataLayer.cs

示例13: SaveChangeSetLink

        private void SaveChangeSetLink(ChangeSetInfo info, Asset savedAsset) 
        {
            var name = string.Format(info.Link.Name, info.Revision);
            var url = string.Format(info.Link.Url, info.Revision);
            var linkUrlAttribute = savedAsset.GetAttribute(ChangeSetType.GetAttributeDefinition("Links.URL"));

            if(linkUrlAttribute != null) 
            {
                foreach(string value in linkUrlAttribute.Values) 
                {
                    if(value.Equals(url, StringComparison.InvariantCultureIgnoreCase)) 
                    {
                        return;
                    }
                }
            }

            var newlink = V1Connection.Data.New(LinkType, savedAsset.Oid.Momentless);
            newlink.SetAttributeValue(LinkNameDef, name);
            newlink.SetAttributeValue(LinkUrlDef, url);
            newlink.SetAttributeValue(LinkOnMenuDef, info.Link.OnMenu);

            V1Connection.Data.Save(newlink, changecomment);
        }
开发者ID:njmyi,项目名称:VersionOne.Integration.Subversion,代码行数:24,代码来源:ChangeSetWriterService.cs


注:本文中的VersionOne.SDK.APIClient.Asset.GetAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。