• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# APIClient.Query类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: DoBuild

        protected override void DoBuild(Query query, BuildResult result)
        {

            if (query == null || query.Find == null || string.IsNullOrEmpty(query.Find.Text)) return;

            var part = string.Concat("find=", HttpUtility.UrlEncode(query.Find.Text));
            result.QuerystringParts.Add(part);

            if (query.Find.Attributes == null || query.Find.Attributes.Count == 0 || string.IsNullOrEmpty(query.Find.Attributes.Token)) return;
            part = string.Concat("findin=", HttpUtility.UrlEncode(query.Find.Attributes.Token));
            result.QuerystringParts.Add(part);

        }
开发者ID:xtremeRacer,项目名称:VersionOne.SDK.NET.APIClient,代码行数:13,代码来源:FindBuilder.cs


示例17: Export

        public override int Export()
        {
            IAssetType assetType = _metaAPI.GetAssetType("AttributeDefinition");
            Query query = new Query(assetType);

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

            IAttributeDefinition isBasicAttribute = assetType.GetAttributeDefinition("IsBasic");
            query.Selection.Add(isBasicAttribute);

            IAttributeDefinition nativeValueAttribute = assetType.GetAttributeDefinition("NativeValue");
            query.Selection.Add(nativeValueAttribute);

            IAttributeDefinition isCustomAttribute = assetType.GetAttributeDefinition("IsCustom");
            query.Selection.Add(isCustomAttribute);

            IAttributeDefinition isReadOnlyAttribute = assetType.GetAttributeDefinition("IsReadOnly");
            query.Selection.Add(isReadOnlyAttribute);

            IAttributeDefinition isRequiredAttribute = assetType.GetAttributeDefinition("IsRequired");
            query.Selection.Add(isRequiredAttribute);

            IAttributeDefinition attributeTypeAttribute = assetType.GetAttributeDefinition("AttributeType");
            query.Selection.Add(attributeTypeAttribute);

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

            //Filter on asset type and if attribute definition is custom.
            FilterTerm assetName = new FilterTerm(assetNameAttribute);
            assetName.Equal(_InternalAssetType);
            FilterTerm isCustom = new FilterTerm(isCustomAttribute);
            isCustom.Equal("true");
            query.Filter = new AndFilterTerm(assetName, isCustom);

            QueryResult result = _dataAPI.Retrieve(query);

            int customFieldCount = 0;
            foreach (Asset asset in result.Assets)
            {
                string attributeName = GetScalerValue(asset.GetAttribute(nameAttribute)).ToString();
                string attributeType = GetScalerValue(asset.GetAttribute(attributeTypeAttribute)).ToString();
                if (attributeName.StartsWith("Custom_"))
                {
                    _logger.Info("The CustomField is {0} and Type is {1}", attributeName, attributeType);
                    customFieldCount += GetCustomFields(attributeName, attributeType);
                }
            }
            return customFieldCount;
        }
开发者ID:mtbadgley,项目名称:DataMigrationService.V1toV1,代码行数:51,代码来源:ExportCustomFields.cs


示例18: BlockDefectWithIssue

        public static void BlockDefectWithIssue(Project project)
        {
            if (project.Issues.Count > 0)
            {
                Query query = new Query(Oid.FromToken(project.Issues[0].Id, Program.MetaModel));
                IAttributeDefinition workitemsDef = Program.MetaModel.GetAttributeDefinition("Issue.BlockedPrimaryWorkitems");
                QueryResult result = Program.Services.Retrieve(query);
                Asset issue = result.Assets[0];

                string defectId = project.Defects.First(x => x.Name.Equals("Fix performance SLA on load")).Id;
                issue.AddAttributeValue(workitemsDef, Oid.FromToken(defectId, Program.MetaModel));
                Program.Services.Save(issue);
            }
        }
开发者ID:versionone,项目名称:VersionOne.Data.Generator,代码行数:14,代码来源:Issue.cs


示例19: GetV1IdCustomFieldName

        public static string GetV1IdCustomFieldName(string internalAssetTypeName)
        {
            var config = (JiraConnectionConfiguration)ConfigurationManager.GetSection("jiraAttachments");

            if (!String.IsNullOrEmpty(config.V1Connection.CustomField))
            {
                string customFieldName = String.Empty;

                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 metaApi = new MetaModel(metaconnector);
                Services dataApi = new Services(metaApi,dataconnector);

                IAssetType assetType = metaApi.GetAssetType("AttributeDefinition");
                Query query = new Query(assetType);

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

                IAttributeDefinition isCustomAttribute = assetType.GetAttributeDefinition("IsCustom");
                query.Selection.Add(isCustomAttribute);

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

                FilterTerm assetName = new FilterTerm(assetNameAttribute);
                assetName.Equal(internalAssetTypeName);
                FilterTerm isCustom = new FilterTerm(isCustomAttribute);
                isCustom.Equal("true");
                query.Filter = new AndFilterTerm(assetName, isCustom);

                QueryResult result = dataApi.Retrieve(query);

                foreach (Asset asset in result.Assets)
                {
                    string attributeValue = asset.GetAttribute(nameAttribute).Value.ToString();
                    if (attributeValue.StartsWith(config.V1Connection.CustomField))
                    {
                        customFieldName = attributeValue;
                        break;
                    }
                }
                return customFieldName;
            }
            return null;
        }
开发者ID:mtbadgley,项目名称:DisneyMigration,代码行数:49,代码来源:UploadToVersionOne.cs


示例20: AddStoriesToEpic

        // 8/7/2012 AJB Commented out to replace with new version of method based on API changes for Epics.
        //public static void SaveEpics(Project project, IList<Member> owners)
        //{
        //    IAssetType storyType = Program.MetaModel.GetAssetType("Story");
        //    IAttributeDefinition nameDef = storyType.GetAttributeDefinition("Name");
        //    IAttributeDefinition ownersDef = storyType.GetAttributeDefinition("Owners");
        //    Utils.Logger.Info("ABOUT TO SAVE EPICS FOR: " + project.Name);

        //    foreach (Epic epic in project.Epics)
        //    {
        //        Asset asset = Program.Services.New(storyType, Oid.FromToken(project.Id, Program.MetaModel));
        //        asset.SetAttributeValue(nameDef, epic.Name);
        //        asset.AddAttributeValue(ownersDef, Oid.FromToken(owners[0].Id, Program.MetaModel));

        //        Program.Services.Save(asset);
        //        epic.Id = asset.Oid.Momentless.Token;

        //        IOperation storyToEpic = storyType.GetOperation("StoryToEpic");
        //        Program.Services.ExecuteOperation(storyToEpic, asset.Oid);
        //    }
        //}

        public static void AddStoriesToEpic(Project project)
        {
            var stories = project.Stories.Where(x => x.Name.StartsWith("Search by"));

            foreach (Story item in stories)
            {
                Query query = new Query(Oid.FromToken(item.Id, Program.MetaModel));
                IAssetType storyType = Program.MetaModel.GetAssetType("Story");
                IAttributeDefinition superDef = storyType.GetAttributeDefinition("Super");
                QueryResult result = Program.Services.Retrieve(query);
                Asset story = result.Assets[0];
                story.SetAttributeValue(superDef, project.Epics[0].Id);
                Program.Services.Save(story);
            }
        }
开发者ID:versionone,项目名称:VersionOne.Data.Generator,代码行数:37,代码来源:Epic.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Parser.TokenPosition类代码示例发布时间:2022-05-26
下一篇:
C# APIClient.Asset类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap