无法使用C#代码获取HP ALM发行版中的周期 [英] Unable to fetch the cycles with-in the release for HP ALM using C# code
本文介绍了无法使用C#代码获取HP ALM发行版中的周期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当用户选择Release Combobox中的特定版本时,此代码的目标是获取周期名称。
代码在HP ALM中获取项目的所有周期,而不是选择它应该获取特定于发布的周期的版本。
我试过以下代码。你能帮我解一下HP ALM中选择的Release特定周期吗?
我尝试了什么:
The Objective of this code is fetch the Cycle name when user select the specific Releases in Release Combobox.
The code is fetching all the Cycles for a Project in HP ALM rather than on selecting the Release it should fetch the cycle specific to release.
I have tried the below code . Could you please help me fetch the cycle specific to Release selected in HP ALM?
What I have tried:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MetroFramework.Forms;
using MetroFramework;
using TDAPIOLELib;
namespace ALM___Utilities
{
public partial class Main : MetroForm
{
public BugFactory BugF;
public TDFilter BugFFilter;
public List BugL;
public Release rl;
public Cycle Cyc;
public CycleFactory CyF;
public ReleaseFactory rel;
public List listRel;
public List listcycle;
public Main(ITDConnection2 qctd)
{
InitializeComponent();
}
//private void Export_Defects_Button_Click(object sender, EventArgs e)
//{
// BugF = LoginForm.qctd.BugFactory;
// BugL = (List)BugF.NewList(BugF.Filter.Text);
//foreach (Bug thisBug in BugL)
//{
// string x = thisBug["BG_DETECTED_IN_REL"].Value;
// }
private void Main_Load(object sender, EventArgs e)
{
Export_Defects_Button.Enabled = false;
rel = LoginForm.qctd.ReleaseFactory;
listRel = (List)rel.NewList(rel.Filter.Text);
Release.Items.Clear();
foreach (Release rl in listRel)
{
Release.Items.Add(rl.Name);
}
// CyF = LoginForm.qctd.CycleFactory;
}
private void Release_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
string releasename = Release.Text;
listRel = (List)rel.NewList(rel.Filter.Text);
foreach (Release rl in listRel)
{
CyF = rl.CycleFactory;
listcycle = (List)CyF.NewList("");
Defect_Cycle.Items.Clear();
foreach (TDAPIOLELib.Cycle Cyc in listcycle)
{
Defect_Cycle.Items.Add(Cyc.Name);
}
}
Export_Defects_Button.Enabled = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
推荐答案
你正在创建两个列出
类中两个方法的本地对象,因此其他方法都不可见。将列表
放入类变量中,使其在程序的生命周期内存在。
You are creating twoList
objects local to the two methods in your class, so neither is visible to the other. Make yourList
into a class variable so it exists for the life of the program.
这篇关于无法使用C#代码获取HP ALM发行版中的周期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文