void getThemeTree() { if (unitid != null) { selthem = TestThemeDao.getTestThemeByUnitid(unitid); } List <TestTheme> ttlist = TestThemeDao.getAllTestThemeByPersonname(System.Configuration.ConfigurationManager.AppSettings["username"]); this.treeView1.Nodes.Clear(); //List<TreeNode> maintreelist = new List<TreeNode>(); TreeNode main = new TreeNode(); //默认主题 TreeNode tmp = new TreeNode("默认主题"); TestTheme default_tt = new TestTheme(); default_tt.Id = 99999; default_tt.Personid = 0; default_tt.Personname = "朱新培"; tmp.Tag = default_tt; setTreeNodeCheck(tmp); main.Nodes.Add(tmp); foreach (var element in ttlist) { TreeNode tmp1 = null; tmp1 = new TreeNode(element.Favname); tmp1.Tag = element; if (element.Parentid == 0) { main.Nodes.Add(tmp1); setTreeNodeCheck(tmp1); } else { creatTree(tmp1, main); } } TreeNode[] tn = new TreeNode[main.Nodes.Count]; main.Nodes.CopyTo(tn, 0); this.treeView1.Nodes.AddRange(tn); this.treeView1.ExpandAll(); this.treeView1.SelectedNode = treeView1.Nodes[0]; }
/// <summary> /// 绑定数据到控件 /// </summary> void TestUnitBingData() { this.multiColumnFilterComboBox1.Items.Clear(); this.multiColumnFilterComboBox1.Items.Add(this.tu); this.multiColumnFilterComboBox1.DisplayMember = "Packagename"; this.multiColumnFilterComboBox1.ValueMember = "Packageid"; this.multiColumnFilterComboBox1.SelectedIndex = 0; this.multiColumnFilterComboBox1.Enabled = false; this.comboBox1.Text = tu.Adminname; this.comboBox2.Text = tu.Modulename; this.comboBox3.Text = tu.Projectname; this.comboBox4.Text = tu.Testorname; this.comboBox5.Text = tu.Buglevel; this.comboBox6.Text = tu.Bugtype; this.textBox9.Text = tu.Testtitle; this.textBox1.Text = tu.Unitno; this.textBox1.ReadOnly = true; MemoryStream stream = new MemoryStream(tu.Testcontent); this.richTextBox1.LoadFile(stream, RichTextBoxStreamType.RichText); if (!this.linkLabel1.IsDisposed) { if (TestThemeDao.getTestThemeByUnitid(tu.Id.ToString()).Count > 0) { this.linkLabel1.Text = "已被关注"; } else { this.linkLabel1.Text = "未被关注"; } } }
/// <summary> /// 绑定数据到控件_新建编辑 /// </summary> void TestUnitBingData_Edit() { this.multiColumnFilterComboBox1.Items.Clear(); this.multiColumnFilterComboBox1.Items.Add(this.tu); this.multiColumnFilterComboBox1.DisplayMember = "Packagename"; this.multiColumnFilterComboBox1.ValueMember = "Packageid"; this.multiColumnFilterComboBox1.SelectedIndex = 0; this.multiColumnFilterComboBox1.Enabled = false; //绑定主管 foreach (DataRow element in this.Source_Person.Rows) { string tempid = element["id"].ToString(); if (Int32.Parse(tempid) == tu.Adminid) { int sel = this.Source_Person.Rows.IndexOf(element); this.comboBox1.SelectedIndex = sel; break; } } //绑定模块(平台) foreach (DataRow element in this.Source_Module.Rows) { string tempid = element["id"].ToString(); if (Int32.Parse(tempid) == tu.Moduleid) { int sel = this.Source_Module.Rows.IndexOf(element); this.comboBox2.SelectedIndex = sel; break; } } //绑定项目 foreach (DataRow element in this.Source_Project.Rows) { string tempid = element["id"].ToString(); if (Int32.Parse(tempid) == tu.Projectid) { int sel = this.Source_Project.Rows.IndexOf(element); this.comboBox3.SelectedIndex = sel; break; } } //绑定测试者 foreach (DataRow element in this.Source_testor.Rows) { string tempid = element["id"].ToString(); if (Int32.Parse(tempid) == tu.Testorid) { int sel = this.Source_Project.Rows.IndexOf(element); this.comboBox4.SelectedIndex = sel; break; } } //绑定BUG等级 foreach (var element in CommonConst.BUGLEVEL) { if (element.Equals(tu.Buglevel)) { this.comboBox5.SelectedItem = element; break; } } //绑定BUG类型 foreach (var element in CommonConst.BUGTYPE) { if (element.Equals(tu.Bugtype)) { this.comboBox6.SelectedItem = element; break; } } this.textBox9.Text = tu.Testtitle; this.textBox1.Text = tu.Unitno; this.textBox1.ReadOnly = true; MemoryStream stream = new MemoryStream(tu.Testcontent); this.richTextBox1.LoadFile(stream, RichTextBoxStreamType.RichText); if (!this.linkLabel1.IsDisposed) { if (TestThemeDao.getTestThemeByUnitid(tu.Id.ToString()).Count > 0) { this.linkLabel1.Text = "已被关注"; } else { this.linkLabel1.Text = "未被关注"; } } }