//新增主题 void Button1Click(object sender, EventArgs e) { if (this.treeView1.SelectedNode == null) { MessageBox.Show("请选择主题"); return; } TestTheme theme1 = this.treeView1.SelectedNode.Tag as TestTheme; CreateThemeDialog ct = new CreateThemeDialog(); ct.StartPosition = FormStartPosition.CenterParent; DialogResult dr = ct.ShowDialog(); if (dr == DialogResult.OK) { TestTheme theme2 = new TestTheme(); //theme2.Id=theme1.Id; if (ct.isTreeRoot) { theme2.Parentid = 0; theme2.Personid = 0; } else { theme2.Parentid = theme1.Id; theme2.Personid = theme1.Personid; } theme2.Personname = theme1.Personname; theme2.Favname = ct.fname; SqlDBUtil.insert(theme2); MessageBox.Show("创建成功", "提示"); getThemeTree(); } }
void LinkLabel1LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Theme.ChoseThemeDialog cd = new WatchCilent.UI.Theme.ChoseThemeDialog(this.tu.Id.ToString()); cd.StartPosition = FormStartPosition.CenterParent; DialogResult a = cd.ShowDialog(); if (DialogResult.OK == a) { if (cd.selthem.Count > 0) { TestunitthemeDao.DelGuanLianUnit(new string[] { this.tu.Id.ToString() }, null); for (int i = 0; i < cd.selthem.Count; i++) { Testunittheme tt = new Testunittheme(); tt.Themeid = cd.selthem[i].Id; tt.Unitid = this.tu.Id; SqlDBUtil.insert(tt); } this.linkLabel1.Text = "已被关注"; } else { DialogResult b = MessageBox.Show("您一个主题都不关注?", "提示", MessageBoxButtons.OKCancel); if (DialogResult.OK == b) { TestunitthemeDao.DelGuanLianUnit(new string[] { this.tu.Id.ToString() }, null); this.linkLabel1.Text = "未被关注"; } } } }
//新增 void Button1Click(object sender, EventArgs e) { if (ValidateModuleEdit()) { ModuleInfo newmodule = new ModuleInfo(); newmodule.Code = textBox2.Text; newmodule.Createtime = DateTime.Now.ToLocalTime().ToString(); newmodule.Fullname = textBox1.Text; newmodule.Managerid = Int32.Parse(comboBox1.SelectedValue.ToString()); newmodule.Managername = comboBox1.Text; newmodule.Lastversion = textBox9.Text; newmodule.Id = 0; if (ModuleDao.getModuleByCode(newmodule.Code)) { MessageBox.Show("模块代码已存在,不能重复!", "提示:"); return; } else { bool isinsert = SqlDBUtil.insert(newmodule); if (isinsert) { getAllModuleInfo(); } } } }
//选择 void Button13Click(object sender, EventArgs e) { if (null != comboBox3.SelectedValue) { int count = this.listBox4.SelectedItems.Count; if (count > 0 && (int)comboBox3.SelectedValue != 0) { int i; for (i = 0; i < count; i++) { ModuleProject mp = new ModuleProject(); mp.Projectid = ((ProjectInfo)this.listBox4.SelectedItems[i]).Id; //mp.Moduleid = (int)comboBox3.SelectedValue; mp.Moduleid = Int32.Parse(comboBox3.SelectedValue.ToString()); SqlDBUtil.insert(mp); } } else { MessageBox.Show("请选择相应的模块或项目", "提示"); } getlistboxdata2(); } else { MessageBox.Show("请选择相应的模块或项目", "提示"); } }
// // void comboBox2SelectedIndexChanged(object sender, EventArgs e) // { // if(comboBox2.SelectedValue!=null) // { // getlistboxdata(); // } // } //选择 void Button4Click(object sender, EventArgs e) { if (null != comboBox2.SelectedValue) { int count = this.listBox1.SelectedItems.Count; if (count > 0 && (int)comboBox2.SelectedValue != 0) { int i; for (i = 0; i < count; i++) { ModuleProject mp = new ModuleProject(); mp.Moduleid = ((ModuleInfo)this.listBox1.SelectedItems[i]).Id; mp.Projectid = (int)comboBox2.SelectedValue; SqlDBUtil.insert(mp); } } else { MessageBox.Show("请选择相应的模块或项目", "提示"); } getlistboxdata(); } else { MessageBox.Show("请选择相应的模块或项目", "提示"); } }
//新增 void Button10Click(object sender, EventArgs e) { if (ValidatePersonEdit()) { PersonInfo person = new PersonInfo(); person.Fullname = textBox6.Text; person.Ip = textBox5.Text; person.Password = textBox10.Text; person.Role = string.IsNullOrEmpty(textBox11.Text.Trim())?"0":textBox11.Text.Trim(); SqlDBUtil.insert(person); getAllPersonInfo(); } }
//新增 void Button7Click(object sender, EventArgs e) { if (ValidateProjectEdit()) { ProjectInfo project = new ProjectInfo(); project.Projectname = textBox4.Text; project.Projectpath = textBox3.Text; project.Url = textBox7.Text; project.Ftppath = textBox8.Text; SqlDBUtil.insert(project); getAllProjectInfo(); } }
static void OnFileCreated(Object source, FileSystemEventArgs e) { //将更新包设成只读 FileInfo fInfo = new FileInfo(e.FullPath); if (!fInfo.IsReadOnly) { fInfo.IsReadOnly = true; } WriteToLog((DateTime.Now).ToString() + " 创建文件:" + e.FullPath); //更新包写入到数据库 PackageInfo pack = new PackageInfo(); string[] temp = e.FullPath.Split('\\'); string temps = temp[temp.Length - 1]; String curpath = e.FullPath.Replace(temp[temp.Length - 1], ""); pack.Packagepath = e.FullPath; pack.Packagename = temps.Replace(@".rar", ""); pack.Packtime = DateTime.Now.ToLocalTime().ToString(); pack.State = "已接收"; try { SqlDBUtil.insert(pack); } catch (Exception) { WriteToLog("数据库插入更新包失败:" + pack.Packagepath); } //通知客户端watchclient try { WatchCore.Common.Communication.UDPManage.Broadcast(e.FullPath, 1020); } catch (Exception) { WriteToLog("通知客户端消息失败!"); } //发布飞秋消息 try { String context = @"更新包提醒:" + "\n在目录:" + curpath + "\n创建了更新包:" + temps; msgToFQ(context); } catch (Exception) { WriteToLog("发送飞秋消息失败!"); } }
//新增缺陷关联 void Button3Click(object sender, EventArgs e) { SelectUnit su = new SelectUnit(); su.StartPosition = FormStartPosition.CenterParent; DialogResult dr = su.ShowDialog(); if (dr == DialogResult.OK) { TestTheme theme = this.treeView1.SelectedNode.Tag as TestTheme; foreach (var element in su.select_tu) { Testunittheme tt = new Testunittheme(); tt.Themeid = theme.Id; tt.Unitid = element.Id; SqlDBUtil.insert(tt); } getGuanlianUnitList(); } }
/// <summary> /// 保存方法 /// </summary> void SavePackage() { if (this.comboBox1.SelectedIndex != 0 || this.comboBox2.SelectedIndex != 0) { packageinfo.Managerid = Int32.Parse(this.comboBox2.SelectedValue.ToString()); packageinfo.Moduleid = Int32.Parse(this.comboBox1.SelectedValue.ToString()); packageinfo.TestRate = Int32.Parse(this.comboBox3.SelectedValue.ToString()); } else { MessageBox.Show("请关联责任人和平台", "提示"); return; } packageinfo.Packagepath = this.textBox1.Text; if (packageinfo.State == CommonConst.PACKSTATE_YiJieShou) { if (!CheckVersion()) { this.Close(); this.Dispose(); return; } } packageinfo.State = CommonConst.PACKSTATE_YiChuLi; if (packageinfo.Id > 0) { SqlDBUtil.update(packageinfo); } else { SqlDBUtil.insert(packageinfo); } MessageBox.Show("已保存", "提示"); }