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


C# APIClient.Asset类代码示例

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


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

示例1: AddMultiValueRelation

        protected void AddMultiValueRelation(IAssetType assetType, Asset asset, string TableName, 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;

                if (String.IsNullOrEmpty(value)) continue;

                string newAssetOID = GetNewAssetOIDFromDB(value, TableName);

                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);
                    }
            }
        }
开发者ID:mtbadgley,项目名称:DisneyMigration,代码行数:26,代码来源:IImportAssets.cs

示例2: Entity

 internal Entity(Asset asset, IEntityFieldTypeResolver typeResolver)
     : base(asset)
 {
     Id = asset.Oid.Momentless.ToString();
     TypeName = asset.AssetType.Token;
     TypeResolver = typeResolver;
 }
开发者ID:marcinczekaj,项目名称:v1-jira-integration,代码行数:7,代码来源:Entity.cs

示例3: ValidateAsset

 private void ValidateAsset(Asset asset, IDictionary<Asset, List<RequiredFieldsDto>> validationResults) {
     var fields = Validate(asset);
     
     if (fields.Count > 0) {
         validationResults.Add(asset, fields);
     }
 }
开发者ID:cagatayalkan,项目名称:VersionOne.Client.VisualStudio,代码行数:7,代码来源:RequiredFieldsValidator.cs

示例4: Project

        private Project(Asset asset) : base(asset, null) {
            // the following check is for unit tests
            if(asset == null || asset.Children == null) {
                return;
            }

            Children.AddRange(asset.Children.Select(item => WorkitemFactory.CreateProject(item, this)));
        }
开发者ID:cagatayalkan,项目名称:VersionOne.Client.VisualStudio,代码行数:8,代码来源:Project.cs

示例5: DeleteAsset

        private void DeleteAsset(Asset subject)
        {
            if(subject == null) {
                return;
            }

            var operation = subject.AssetType.GetOperation(VersionOneProcessor.DeleteOperation);
            services.ExecuteOperation(operation, subject.Oid);
        }
开发者ID:marcinczekaj,项目名称:v1-jira-integration,代码行数:9,代码来源:AssetDisposer.cs

示例6: Create

 internal static new PrimaryWorkitem Create(Asset asset, IDictionary<string, PropertyValues> listPropertyValues, IEntityFieldTypeResolver typeResolver, IList<Member> owners = null) {
     switch(asset.AssetType.Token) {
         case VersionOneProcessor.StoryType:
             return new Story(asset, listPropertyValues, typeResolver, owners);
         case VersionOneProcessor.DefectType:
             return new Defect(asset, listPropertyValues, typeResolver, owners);
         default:
             throw new NotSupportedException("Type " + asset.AssetType.Token + " is not supported in factory method");
     }
 }
开发者ID:dgruesso,项目名称:VersionOne.Integration.Bugzilla,代码行数:10,代码来源:PrimaryWorkitem.cs

示例7: SetAssetAttribute

 private static void SetAssetAttribute(Asset asset, string attrName, object value) {
     var type = asset.AssetType;
     var def = type.GetAttributeDefinition(attrName);
     
     if (value == null || (value is Oid && value.Equals(Oid.Null))) {
         asset.EnsureAttribute(def);
     } else {
         asset.SetAttributeValue(def, value);
     }
 }
开发者ID:cagatayalkan,项目名称:VersionOne.Client.VisualStudio,代码行数:10,代码来源:AssetFactory.cs

示例8: WriteAsset

        public void WriteAsset(Asset asset) {
            writer.WriteStartElement("Asset");

            if(!asset.Oid.IsNull) {
                writer.WriteAttributeString("id", asset.Oid.Token);
            }

            foreach(var attribute in asset.Attributes.Values) {
                WriteAttributeReference(attribute);
            }

            writer.WriteEndElement();
        }
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:13,代码来源:XmlApiWriter.cs

示例9: 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

示例10: CreateAssetForPrimaryWorkitem

        internal Asset CreateAssetForPrimaryWorkitem(string typeToken) {
            var type = ResolveAssetTypeFor(typeToken);

            try {
                var asset = new Asset(type);

                SetupAssetAttributes(asset, typeToken);
                LoadAssetAttribute(asset, "Scope.Name", currentProject.GetProperty(Entity.NameProperty));
                LoadAssetAttribute(asset, "Timebox.Name", currentProject.GetProperty("Schedule.EarliestActiveTimebox.Name"));
                SetAssetAttribute(asset, "Timebox", currentProject.GetProperty("Schedule.EarliestActiveTimebox"));
                SetAssetAttribute(asset, "Scope", currentProject.Asset.Oid);

                return asset;
            } catch(MetaException ex) {
                throw new DataLayerException("Cannot create new " + typeToken, ex);
            } catch(APIException ex) {
                throw new DataLayerException("Cannot create new " + typeToken, ex);
            }
        }
开发者ID:cagatayalkan,项目名称:VersionOne.Client.VisualStudio,代码行数:19,代码来源:AssetFactory.cs

示例11: AddLinkToWorkitem

		public void AddLinkToWorkitem()
		{
			const string url = "http://qqq.com";
			const string title = "Url title";
			var workitemAsset = new Asset(new TestOid(new TestAssetType("Workitem"), 100, null));
			var workitem = new TestWorkitem(workitemAsset, null);
			var link = new Link(url, title);
			var linkAsset = new TestAssetType("Link");
			var asset = new Asset(new TestOid(new TestAssetType("Link"), 10, null));

			Expect.Call(_mockMetaModel.GetAssetType(VersionOneProcessor.LinkType)).Return(linkAsset);
			Expect.Call(_mockQueryBuilder.Query(string.Empty, Filter.Empty())).IgnoreArguments().Return(new AssetList());
			Expect.Call(_mockServices.New(null, null)).IgnoreArguments().Return(asset);
			Expect.Call(() => _mockServices.Save(asset));

			_repository.ReplayAll();
			_processor.AddLinkToEntity(workitem, link);
			_repository.VerifyAll();
		}
开发者ID:versionone,项目名称:VersionOne.Integration.TFS.ServerConnector,代码行数:19,代码来源:VersionOneProcessorTester.cs

示例12: Workitem

        internal Workitem(Asset asset, Workitem parent, IEntityContainer entityContainer) : base(asset, entityContainer) {
            Parent = parent;

            //TODO maybe make one more constructor for tests instead of this?
            // the following check is for unit tests            
            if(asset == null || asset.Children == null) {
                return;
            }

            if(!SupportedTypes.Contains(asset.AssetType.Token)) {
                throw new ArgumentException(string.Format("Illegal asset type, '{0}' is not supported.", asset.AssetType.Token));
            }

            foreach (var childAsset in asset.Children.Where(childAsset => DataLayer.ShowAllTasks || DataLayer.AssetPassesShowMyTasksFilter(childAsset))) {
                Children.Add(WorkitemFactory.CreateWorkitem(childAsset, this, entityContainer));
                Children.Sort(new WorkitemComparer(TestType, TaskType));
            }

            Children.TrimExcess();
        }
开发者ID:ubailey,项目名称:VersionOne.Client.VisualStudio,代码行数:20,代码来源:Workitem.cs

示例13: CreateAssetForSecondaryWorkitem

        internal Asset CreateAssetForSecondaryWorkitem(string typeToken, Workitem parent) {
            var type = ResolveAssetTypeFor(typeToken);

            try {
                var asset = new Asset(type);

                SetupAssetAttributes(asset, typeToken);
                SetAssetAttribute(asset, "Parent", parent.Asset.Oid);
                LoadAssetAttribute(asset, "Scope.Name", currentProject.GetProperty(Entity.NameProperty));
                LoadAssetAttribute(asset, "Parent.Name", parent.GetProperty(Entity.NameProperty));
                LoadAssetAttribute(asset, "Timebox.Name", parent.GetProperty("Timebox.Name"));

                parent.Asset.Children.Add(asset);

                return asset;
            } catch(MetaException ex) {
                throw new DataLayerException("Cannot create new " + typeToken, ex);
            } catch(APIException ex) {
                throw new DataLayerException("Cannot create new " + typeToken, ex);
            }
        }
开发者ID:cagatayalkan,项目名称:VersionOne.Client.VisualStudio,代码行数:21,代码来源:AssetFactory.cs

示例14: CreateTeamRoom

        public static Asset CreateTeamRoom(Project project, Asset schedule)
        {
            IAssetType assetType = Program.MetaModel.GetAssetType("TeamRoom");
            IAttributeDefinition nameAttribute = assetType.GetAttributeDefinition("Name");
            IAttributeDefinition scheduleAttribute = assetType.GetAttributeDefinition("Schedule");
            IAttributeDefinition scopeAttribute = assetType.GetAttributeDefinition("Scope");
            IAttributeDefinition participantAttribute = assetType.GetAttributeDefinition("Participants");
            
            Asset newTeamRoom = Program.Services.New(assetType, null);
            newTeamRoom.SetAttributeValue(nameAttribute, project.Name + " TeamRoom");
            newTeamRoom.SetAttributeValue(scheduleAttribute, schedule.Oid);
            newTeamRoom.SetAttributeValue(scopeAttribute, project.Id);

            foreach (Member member in project.Members)
            {
                newTeamRoom.AddAttributeValue(participantAttribute, member.Id);
            }

            Program.Services.Save(newTeamRoom);
            return newTeamRoom;
        }
开发者ID:versionone,项目名称:VersionOne.Data.Generator,代码行数:21,代码来源:TeamRoom.cs

示例15: AddLinkToWorkitemWithExistingLink

		public void AddLinkToWorkitemWithExistingLink()
		{
			const string type = "Link";
			const string url = "http://qqq.com";
			const string title = "Url title";
			var workitemAsset = new Asset(new TestOid(new TestAssetType("Workitem"), 100, null));
			var workitem = new TestWorkitem(workitemAsset, null);
			var link = new Link(url, title);
			var linkAsset = new TestAssetType(type);
			var definitions = new Dictionary<string, IAttributeDefinition> {
                {Entity.NameProperty, new TestAttributeDefinition(linkAsset)},
                {Link.OnMenuProperty, new TestAttributeDefinition(linkAsset)},
                {Link.UrlProperty, new TestAttributeDefinition(linkAsset)},
            };
			var linkOid = new TestOid(new TestAssetType(type, definitions), 10, null);
			var existedLink = new Asset(linkOid);

			Expect.Call(_mockMetaModel.GetAssetType(VersionOneProcessor.LinkType)).Return(linkAsset);
			Expect.Call(_mockQueryBuilder.Query(string.Empty, Filter.Empty())).IgnoreArguments().Return(new AssetList { existedLink });

			_repository.ReplayAll();
			_processor.AddLinkToEntity(workitem, link);
			_repository.VerifyAll();
		}
开发者ID:versionone,项目名称:VersionOne.Integration.TFS.ServerConnector,代码行数:24,代码来源:VersionOneProcessorTester.cs


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