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


C# APIClient.Query类代码示例

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


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

示例1: Build

        public BuildResult Build(Query query, BuildResult result) {
            foreach (var builder in Builders) {
                builder.Build(query, result);
            }

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

示例2: GetMostRecentChangeDateTime

        public DateTime? GetMostRecentChangeDateTime()
        {
            var defectType = _meta.GetAssetType("Defect");
            var query = new Query(defectType);
            var projectAttribute = defectType.GetAttributeDefinition("Scope");
            var projectTerm = new FilterTerm(projectAttribute);
            projectTerm.Equal(MonitoredProjects.Select(project => project.ScopeId).Cast<Object>().ToArray());

            var changeAttribute = defectType.GetAttributeDefinition("ChangeDateUTC");
            query.Selection.Add(changeAttribute);
            if (_mostRecentChangeDateTime.HasValue)
            {
                var changeTerm = new FilterTerm(changeAttribute);
                changeTerm.Greater(_mostRecentChangeDateTime.Value.ToString("yyyy-MM-ddTHH:mm:ss.fff", CultureInfo.InvariantCulture));
                query.Filter = new AndFilterTerm(changeTerm, projectTerm);
            } else
            {
                query.Filter = projectTerm;
            }

            var result = _services.Retrieve(query);

            if (result.TotalAvaliable > 0)
            {
                foreach (var asset in result.Assets)
                {
                    var projectChangeDateTime = DB.DateTime(asset.GetAttribute(changeAttribute).Value);
                    if ((!_mostRecentChangeDateTime.HasValue) || (projectChangeDateTime > _mostRecentChangeDateTime))
                    {
                        _mostRecentChangeDateTime = projectChangeDateTime;
                    }
                }
            }
            return _mostRecentChangeDateTime;
        }
开发者ID:ibuchanan,项目名称:VersionOne.ProjectHelper,代码行数:35,代码来源:DefectMonitor.cs

示例3: GetAssetOid

        public static string GetAssetOid(string jiraId, string assetTypeStr)
        {
            var config = (JiraConnectionConfiguration)ConfigurationManager.GetSection("jiraAttachments");

            var metaconnector = new VersionOneAPIConnector(config.V1Connection.ServerUrl + "/meta.v1/");
            var dataconnector =
                new VersionOneAPIConnector(config.V1Connection.ServerUrl + "/rest-1.v1/")
                    .WithVersionOneUsernameAndPassword(config.V1Connection.Username, config.V1Connection.Password);

            MetaModel metaModel = new MetaModel(metaconnector);
            Services services = new Services(metaModel, dataconnector);

            var assetType = metaModel.GetAssetType(assetTypeStr);
            var query = new Query(assetType);
            var jiraIdAttribute = assetType.GetAttributeDefinition(GetV1IdCustomFieldName(assetTypeStr));
            query.Selection.Add(jiraIdAttribute);
            var jiraIdTerm = new FilterTerm(jiraIdAttribute);
            jiraIdTerm.Equal(jiraId);
            query.Filter = jiraIdTerm;

            var result = services.Retrieve(query);

            if (result.Assets.Count == 0)
            {
                return String.Empty;
            }
            return result.Assets[0].Oid.ToString();
        }
开发者ID:mtbadgley,项目名称:DisneyMigration,代码行数:28,代码来源:UploadToVersionOne.cs

示例4: DoBuild

 protected override void DoBuild(Query query, BuildResult result)
 {
     if (query.AsOf.CompareTo(DateTime.MinValue) > 0)
     {
         result.QuerystringParts.Add("asof=" + query.AsOf.ToString("yyyy-MM-ddTHH:mm:ss"));
     }
 }
开发者ID:xtremeRacer,项目名称:VersionOne.SDK.NET.APIClient,代码行数:7,代码来源:AsOfBuilder.cs

示例5: QueryForNameAndStatus

        public void QueryForNameAndStatus()
        {
            Oid defectId = Oid.FromToken("Defect:2258150", metaModel);

            Query query = new Query(defectId);
            IAssetType defectType = metaModel.GetAssetType("Defect");
            IAttributeDefinition nameAttribute = defectType.GetAttributeDefinition("Name");
            IAttributeDefinition statusAttribute = defectType.GetAttributeDefinition(Entity.StatusProperty);
            IAttributeDefinition statusNameAttribute = defectType.GetAttributeDefinition(Entity.StatusNameProperty);
            query.Selection.Add(nameAttribute);
            query.Selection.Add(statusAttribute);
            query.Selection.Add(statusNameAttribute);

            QueryResult result = services.Retrieve(query);

            Asset defect = result.Assets[0];
            string name = defect.GetAttribute(nameAttribute).Value.ToString();
            string status = defect.GetAttribute(statusAttribute).Value.ToString();
            string statusName = defect.GetAttribute(statusNameAttribute).Value.ToString();

            defect.SetAttributeValue(statusAttribute, "StoryStatus:135");
            services.Save(defect);
            string newStatusName = defect.GetAttribute(statusAttribute).Value.ToString();

            Console.WriteLine(string.Format("{0} - {1} ", statusName, newStatusName));
        }
开发者ID:marcinczekaj,项目名称:v1-jira-integration,代码行数:26,代码来源:VersionOneQueryBuilderTest.cs

示例6: GetSingleListValue

        protected Object GetSingleListValue(VersionOne.SDK.APIClient.Attribute attribute)
        {
            if (attribute.Value != null && attribute.Value.ToString() != "NULL")
            {
                IAssetType assetType = _metaAPI.GetAssetType("List");
                Query query = new Query(assetType);

                IAttributeDefinition assetIDAttribute = assetType.GetAttributeDefinition("ID");
                query.Selection.Add(assetIDAttribute);

                IAttributeDefinition nameAttribute = assetType.GetAttributeDefinition("Name");
                query.Selection.Add(nameAttribute);

                FilterTerm assetName = new FilterTerm(assetIDAttribute);
                assetName.Equal(attribute.Value.ToString());
                query.Filter = assetName;

                QueryResult result = _dataAPI.Retrieve(query);
                return result.Assets[0].GetAttribute(nameAttribute).Value.ToString();
            }
            else
            {
                return DBNull.Value;
            }
        }
开发者ID:mtbadgley,项目名称:DataMigrationService.V1toV1,代码行数:25,代码来源:IExportAssets.cs

示例7: SaveItemAssociations

        public static void SaveItemAssociations(Project project)
        {
            if (project.BuildRuns.Count > 0)
            {
                // There is no direct association between workitems and affected/included build runs.
                // The indirect association occurs by relationship to ChangeSets.

                string defectId = project.Defects.First(x => x.Name.Equals("Fix performance SLA on load")).Id;

                IAssetType defectType = Program.MetaModel.GetAssetType("Defect");
                Query query = new Query(Oid.FromToken(defectId, Program.MetaModel));

                IAttributeDefinition foundDefectsDef = defectType.GetAttributeDefinition("FoundInBuildRuns");
                IAttributeDefinition completedDef = defectType.GetAttributeDefinition("CompletedInBuildRuns");
                IAttributeDefinition changeSetsDef = defectType.GetAttributeDefinition("ChangeSets");

                QueryResult result = Program.Services.Retrieve(query);
                Asset asset = result.Assets[0];

                // Found in first build run and completed in last build run
                // Included in build runs 2 and 3 (via ChangeSets)
                asset.AddAttributeValue(foundDefectsDef, Oid.FromToken(project.BuildRuns[0].Id, Program.MetaModel));
                asset.AddAttributeValue(completedDef, Oid.FromToken(project.BuildRuns[2].Id, Program.MetaModel));
                asset.AddAttributeValue(changeSetsDef, Oid.FromToken(project.ChangeSets[1].Id, Program.MetaModel));
                asset.AddAttributeValue(changeSetsDef, Oid.FromToken(project.ChangeSets[2].Id, Program.MetaModel));
                Program.Services.Save(asset);

                string storyId = project.Stories.First(x => x.Name.Equals("List of Books by Author")).Id;

                IAssetType storyType = Program.MetaModel.GetAssetType("Story");
                query = new Query(Oid.FromToken(storyId, Program.MetaModel));

                IAttributeDefinition completedStoryDef = storyType.GetAttributeDefinition("CompletedInBuildRuns");
                IAttributeDefinition changeSetsStoryDef = storyType.GetAttributeDefinition("ChangeSets");

                result = Program.Services.Retrieve(query);
                asset = result.Assets[0];

                // Completed in last build run
                // Included in build runs 2 and 3 (via ChangeSets)
                asset.AddAttributeValue(completedStoryDef, Oid.FromToken(project.BuildRuns[2].Id, Program.MetaModel));
                asset.AddAttributeValue(changeSetsStoryDef, Oid.FromToken(project.ChangeSets[1].Id, Program.MetaModel));
                asset.AddAttributeValue(changeSetsStoryDef, Oid.FromToken(project.ChangeSets[2].Id, Program.MetaModel));
                Program.Services.Save(asset);

                storyId = project.Stories.First(x => x.Name.Equals("View Book Details")).Id;
                query = new Query(Oid.FromToken(storyId, Program.MetaModel));

                result = Program.Services.Retrieve(query);
                asset = result.Assets[0];

                // Included in all 3 build runs (via ChangeSets)
                // Not completed yet
                asset.AddAttributeValue(changeSetsStoryDef, Oid.FromToken(project.ChangeSets[0].Id, Program.MetaModel));                
                asset.AddAttributeValue(changeSetsStoryDef, Oid.FromToken(project.ChangeSets[1].Id, Program.MetaModel));
                asset.AddAttributeValue(changeSetsStoryDef, Oid.FromToken(project.ChangeSets[2].Id, Program.MetaModel));
                Program.Services.Save( asset );
            }
        }
开发者ID:versionone,项目名称:VersionOne.Data.Generator,代码行数:59,代码来源:BuildRun.cs

示例8: GetLoggedInMemberRole

        private string GetLoggedInMemberRole()
        {
            var query = new Query(Services.LoggedIn);
            var defaultRoleAttribute = Services.Meta.GetAssetType(MemberType).GetAttributeDefinition(DefaultRoleNameProperty);
            query.Selection.Add(defaultRoleAttribute);

            return Services.Localization(defaultRoleAttribute);
        }
开发者ID:versionone,项目名称:VersionOne.Integration.JIRA,代码行数:8,代码来源:V1WriterServiceBase.cs

示例9: FluentQuery

        public FluentQuery(
            string assetTypeName)
        {
            RawQuery = new Query(MetaModelProvider.Meta.GetAssetType(assetTypeName));
            AssetTypeName = assetTypeName;

            WhereCriteria = new List<Tuple<string, object, FilterTerm.Operator>>();
            SelectFields = new List<object>();
        }
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:9,代码来源:FluentQuery.cs

示例10: GetLoggedInMemberRole

        private string GetLoggedInMemberRole() {
            var query = new Query(Central.Services.LoggedIn);
            var defaultRoleAttribute = Central.MetaModel.GetAssetType(MemberType).GetAttributeDefinition(DefaultRoleNameProperty);
            query.Selection.Add(defaultRoleAttribute);

            var asset = Central.Services.Retrieve(query).Assets[0];
            var role = asset.GetAttribute(defaultRoleAttribute);
            return Central.Loc.Resolve(role.Value.ToString());
        }
开发者ID:dgruesso,项目名称:VersionOne.Integration.Bugzilla,代码行数:9,代码来源:V1WriterServiceBase.cs

示例11: FilterExist

        public void FilterExist() {
            var assetType = Instance.ApiClient.MetaModel.GetAssetType("Story");

            var customFilter = new FilterTerm(assetType.GetAttributeDefinition("Timebox"));
            customFilter.Exists();

            var query = new Query(assetType) {Filter = customFilter};
            Instance.ApiClient.Services.Retrieve(query);
        }
开发者ID:bigjonroberts,项目名称:VersionOne.SDK.NET.ObjectModel,代码行数:9,代码来源:StoryFilterTester.cs

示例12: GetDefaultSchedule

 public static Asset GetDefaultSchedule()
 {
     IAssetType assetType = Program.MetaModel.GetAssetType("Schedule");
     Query query = new Query(assetType);
     IAttributeDefinition nameAttribute = assetType.GetAttributeDefinition("Name");
     query.Selection.Add(nameAttribute);
     query.Find = new QueryFind("Default Schedule", new AttributeSelection(nameAttribute));
     QueryResult result = Program.Services.Retrieve(query);
     return result.Assets[0];
 }
开发者ID:versionone,项目名称:VersionOne.Data.Generator,代码行数:10,代码来源:IterationSchedule.cs

示例13: Run

        public void Run()
        {
            Log("Get some meta stuff");
            IAssetType memberType = Meta.GetAssetType("Member");
            Log(memberType.DisplayName);

            Log("Perform a query");
            var query = new Query(memberType);
            QueryResult result = Services.Retrieve(query);

            Log(string.Format("Server returned {0} members", result.TotalAvaliable));
        }
开发者ID:versionone,项目名称:APIClientSSOExtensions,代码行数:12,代码来源:SsoExample.cs

示例14: CreateUserToDeactivate

 public User CreateUserToDeactivate(string username) {
     User user = CreateTestUser(username);
     user.Deactivate = true;
     IAssetType member = model.GetAssetType("Member");
     Query query = new Query(member);
     FilterTerm term = new FilterTerm(member.GetAttributeDefinition("Username"));
     term.Equal(username);
     query.Filter = term;
     QueryResult result = services.Retrieve(query);
     user.V1MemberAsset = result.Assets[0];
     return user;
 }
开发者ID:raynard-delosreyes,项目名称:VersionOne.Provisioning.LDAP,代码行数:12,代码来源:TestUserFactory.cs

示例15: Query

        public AssetList Query(string workitemTypeName, IFilterTerm filter)
        {
            try {
                var workitemType = metaModel.GetAssetType(workitemTypeName);
                var query = new Query(workitemType) { Filter = filter};

                AddSelection(query, workitemTypeName, workitemType);
                return services.Retrieve(query).Assets;
            } catch (Exception ex) {
                throw new VersionOneException(ex.Message);
            }
        }
开发者ID:marcinczekaj,项目名称:v1-jira-integration,代码行数:12,代码来源:QueryBuilder.cs


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