static public DataTable getRePortBugLevelAll(string begintime, string endtime) { DataTable numtable = new DataTable("numdt"); numtable.Columns.Add("", Type.GetType("System.String")); numtable.Columns.Add("轻微", Type.GetType("System.Int32")); numtable.Columns.Add("一般", Type.GetType("System.Int32")); numtable.Columns.Add("紧急", Type.GetType("System.Int32")); numtable.Columns.Add("严重", Type.GetType("System.Int32")); List <PersonInfo> personlist = PersonDao.getAllPersonInfo(); string sql = "SELECT count(*) from testunit where " + "cast(testtime as datetime)>=cast('" + begintime + "' as datetime) " + "and cast(testtime as datetime)<=cast('" + endtime + "' as datetime) " + "and buglevel='{0}'"; string sqltemp = string.Format(sql, CommonConst.BUGLEVEL_QinWei); int qinwei = SqlDBUtil.ExecuteScalar(sqltemp); sqltemp = string.Format(sql, CommonConst.BUGLEVEL_YiBan); int yiban = SqlDBUtil.ExecuteScalar(sqltemp); sqltemp = string.Format(sql, CommonConst.BUGLEVEL_YanZhong); int yanzhong = SqlDBUtil.ExecuteScalar(sqltemp); sqltemp = string.Format(sql, CommonConst.BUGLEVEL_JinJI); int jinji = SqlDBUtil.ExecuteScalar(sqltemp); numtable.Rows.Add(null, qinwei, yiban, jinji, yanzhong); return(numtable); }
static public List <PackageInfo> queryPackageInfo(string moduleid, string managerid, string state, string begintime, string endtime) { string sql = "select * from packageinfo where " + "(0=" + moduleid + " or moduleid=" + moduleid + ")" + " and (0=" + managerid + " or managerid=" + managerid + ")" + " and ('全部'='" + state + "' or state='" + state + "')"; if (begintime != null) { sql += " and cast(packtime as datetime)>=cast('" + begintime + "' as datetime)"; } if (endtime != null) { sql += " and cast(packtime as datetime)<=cast('" + endtime + "' as datetime)"; } sql += " order by cast(packtime as datetime) desc"; DataSet data = SqlDBUtil.ExecuteQuery(sql, null); List <PackageInfo> ls = new List <PackageInfo>(); foreach (DataRow row in data.Tables["ds"].Rows) { ls.Add(Row2PackageInfo(row)); } return(ls); }
//新增 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 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 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 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 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 = "未被关注"; } } } }
/// <summary> /// 根据关联的unitid获取主题 /// </summary> /// <param name="unitid"></param> /// <returns></returns> static public List <TestTheme> getTestThemeByUnitid(string unitid) { List <TestTheme> ls = new List <TestTheme>(); string sql1 = "select count(*) from testunittheme where themeid = 99999 and unitid=" + unitid; int count = SqlDBUtil.ExecuteScalar(sql1); if (count > 0) { string personid = System.Configuration.ConfigurationManager.AppSettings["UserId"]; //string personname = System.Configuration.ConfigurationManager.AppSettings["Username"]; TestTheme default_tt = new TestTheme(); default_tt.Id = 99999; default_tt.Personid = ((personid == null)?0:Int32.Parse(personid)); default_tt.Personname = System.Configuration.ConfigurationManager.AppSettings["Username"]; ls.Add(default_tt); } string sql = "SELECT * FROM TestTheme " + "where id in (select themeid from testunittheme where unitid=" + unitid + ")"; DataSet data = SqlDBUtil.ExecuteQuery(sql); foreach (DataRow row in data.Tables["ds"].Rows) { ls.Add(Row2TestTheme(row)); } return(ls); }
static public List <UIcheckinfo> QueryUIcheckinfo(string moduleid, string managerid, string state, string begintime, string endtime, int startnum, int pagesize) { string sql = "select * from uicheckinfo where " + "(0=" + moduleid + " or moduleid=" + moduleid + ")" + " and (0=" + managerid + " or adminid=" + managerid + ")" + " and ('全部状态'='" + state + "' or state='" + state + "')"; if (begintime != null) { sql += " and cast(createtime as datetime)>=cast('" + begintime + "' as datetime)"; } if (endtime != null) { sql += " and cast(createtime as datetime)<=cast('" + endtime + "' as datetime)"; } sql += " order by cast(createtime as datetime) desc"; DataSet data = SqlDBUtil.ExecuteQuery(sql, startnum, pagesize); List <UIcheckinfo> ls = new List <UIcheckinfo>(); foreach (DataRow row in data.Tables["ds"].Rows) { ls.Add(Row2UIcheckinfo(row)); } return(ls); }
/// <summary> /// 删除主题测试单元关联表 /// </summary> /// <param name="unitid">测试单元ID数组,如果传入NULL则删除全部关联</param> /// <param name="themeid">主题ID</param> /// <returns></returns> public static bool DelGuanLianUnit(string[] unitid, string themeid) { string sql = "delete from testunittheme where 1 = 1 "; if (themeid != null) { sql += "and themeid='" + themeid + "'"; } string unitstr = ""; if (unitid == null) { unitstr = "0"; } else { for (int i = 0; i < unitid.Length; i++) { unitstr = "'" + unitid[i] + "'," + unitstr; } unitstr = unitstr.Substring(0, unitstr.Length - 1); sql += " and unitid in (" + unitstr + ") "; } try { SqlDBUtil.ExecuteNonQuery(sql); return(true); } catch (Exception) { throw new Exception("删除id数据出现异常"); return(false); } }
void Button1Click(object sender, EventArgs e) { string username = this.textBox6.Text; string password = this.textBox7.Text; Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine; Microsoft.Win32.RegistryKey reg = key.CreateSubKey("software\\WisoftWatchClient"); reg.SetValue("Version", this.textBox1.Text); reg.SetValue("SqlDB", this.textBox1.Text); reg.SetValue("UnitDocPath", this.textBox2.Text); reg.SetValue("UnitHtmlPath", this.textBox3.Text); reg.SetValue("HtmlUrl", this.textBox4.Text); reg.SetValue("WisofServiceHost", this.textBox5.Text); if (PersonDao.getAllPersonInfo(username).Count == 1) { PersonInfo ps = PersonDao.getAllPersonInfo(username)[0]; ps.Fullname = username; password = MD5Common.GetMd5Hash(password); ps.Password = password; GlobalParams.User = ps; reg.SetValue("Username", username); reg.SetValue("Password", password); reg.SetValue("UserId", ps.Id); FunctionUtils.UpdateAppConfig("Username", username); FunctionUtils.UpdateAppConfig("Password", password); FunctionUtils.UpdateAppConfig("UserId", ps.Id.ToString()); SqlDBUtil.update(ps); } else { MessageBox.Show("数据库没有该用户!,请联系管理员"); } }
static public List <TestUnit> QueryTestUnit(string moduleid, string managerid, string level, string state, string begintime, string endtime, int startnum, int pagesize) { string sql = "select Unitno,Packagename,Buglevel,Testtitle,Testtime,Adminname,State,Id from testunit where " + "(0=" + moduleid + " or moduleid=" + moduleid + ")" + " and (0=" + managerid + " or adminid=" + managerid + ")" + " and ('全部等级'='" + level + "' or buglevel='" + level + "')" + " and ('全部'='" + state + "' or state='" + state + "')"; if (begintime != null) { sql += " and cast(testtime as datetime)>=cast('" + begintime + "' as datetime)"; } if (endtime != null) { sql += " and cast(testtime as datetime)<=cast('" + endtime + "' as datetime)"; } sql += " order by cast(testtime as datetime) desc"; DataSet data = SqlDBUtil.ExecuteQuery(sql, startnum, pagesize); List <TestUnit> ls = new List <TestUnit>(); foreach (DataRow row in data.Tables["ds"].Rows) { ls.Add(Row2Tu(row)); } return(ls); }
/// <summary> /// 所有没有测试的更新包除了已发布,已废止的。 /// </summary> /// <returns></returns> static public DataTable getAllUnTestPack() { string sql = "SELECT packageInfo.*,moduleInfo.id as realmoduleid, moduleInfo.code FROM moduleInfo right JOIN packageInfo ON moduleInfo.ID = packageInfo.moduleid order by cast(packageInfo.packtime as datetime) desc"; DataSet data = SqlDBUtil.ExecuteQuery(sql); return(data.Tables["ds"]); }
//保存描述的方法 void Button5Click(object sender, EventArgs e) { TestTheme theme = this.treeView1.SelectedNode.Tag as TestTheme; theme.Favcontent = this.textBox1.Text; SqlDBUtil.update(theme); MessageBox.Show("保存成功", "提示"); }
static public DataTable getRePortTest(string begintime, string endtime) { string sql = "SELECT unitno,buglevel,packagename,testtitle FROM testunit " + "where cast(testtime as datetime)>=cast('" + begintime + "' as datetime) and cast(testtime as datetime)<=cast('" + endtime + "' as datetime) order by unitno asc"; DataSet data = SqlDBUtil.ExecuteQuery(sql); return(data.Tables["ds"]); }
static public DataTable getRePortPack(string begintime, string endtime) { string sql = "SELECT packageInfo.packagename, packageInfo.packtime,personinfo.fullname FROM personinfo right JOIN packageInfo ON personinfo.ID = packageInfo.managerid " + "where cast(packageInfo.packtime as datetime) >=cast('" + begintime + "' as datetime)" + " and cast(packageInfo.packtime as datetime) <=cast('" + endtime + "' as datetime)" + " order by cast(packageInfo.packtime as datetime) asc"; DataSet data = SqlDBUtil.ExecuteQuery(sql); return(data.Tables["ds"]); }
static public DataTable getAllModuleTable() { string sql = "select * from ModuleInfo order by fullname"; DataSet data = SqlDBUtil.ExecuteQuery(sql, null); DataRow dr = data.Tables["ds"].NewRow(); dr["fullname"] = "全部平台"; dr["id"] = 0; data.Tables["ds"].Rows.InsertAt(dr, 0); return(data.Tables["ds"]); }
static public DataTable getAllProjectTable() { string sql = "select * from projectinfo order by projectname"; DataSet data = SqlDBUtil.ExecuteQuery(sql, null); DataRow dr = data.Tables["ds"].NewRow(); dr["projectname"] = "全部项目"; dr["id"] = 0; data.Tables["ds"].Rows.InsertAt(dr, 0); return(data.Tables["ds"]); }
static public DataTable getPersonTable() { string sql = "select * from PersonInfo where role like '%1;%' or role like '%1'"; DataSet data = SqlDBUtil.ExecuteQuery(sql); DataRow dr = data.Tables["ds"].NewRow(); dr["fullname"] = "全部责任人"; dr["id"] = 0; data.Tables["ds"].Rows.InsertAt(dr, 0); return(data.Tables["ds"]); }
static public List <TestUnit> getAlltestUnit() { DataSet data = SqlDBUtil.ExecuteQuery("select Unitno,Packagename,Buglevel,Testtitle,Testtime,Adminname,State,Id from testunit order by Unitno desc"); List <TestUnit> ls = new List <TestUnit>(); foreach (DataRow row in data.Tables["ds"].Rows) { ls.Add(Row2Tu(row)); } return(ls); }
static public List <UICheckView> getUICheckViewByNO(string checkno) { DataSet data = SqlDBUtil.ExecuteQuery("select * from UICheckView where checkno='" + checkno + "'"); List <UICheckView> ls = new List <UICheckView>(); foreach (DataRow row in data.Tables["ds"].Rows) { ls.Add(Row2UICheckview(row)); } return(ls); }
static public PersonInfo getPersonInfoByModuleid(int id) { string sql = "select PersonInfo.* from PersonInfo,moduleInfo where PersonInfo.id = moduleInfo.managerid and moduleInfo.id=" + id.ToString(); DataSet data = SqlDBUtil.ExecuteQuery(sql); PersonInfo ls = new PersonInfo(); if (data.Tables["ds"].Rows.Count > 0) { ls = Row2PersonInfo(data.Tables["ds"].Rows[0]); } return(ls); }
public static bool DeleteTheme(string themeid) { string sql = "delete from testtheme where id='" + themeid + "' or parentid ='" + themeid + "'"; try { SqlDBUtil.ExecuteNonQuery(sql); return(true); } catch (Exception) { throw new Exception("删除出现异常"); return(false); } }
static public List <ModuleProject> getAllMPByPrjIDAndMdlID(string pid, string mid) { string sql = "SELECT * from ModuleProject where moduleid=" + mid + " and projectid=" + pid; DataSet data = SqlDBUtil.ExecuteQuery(sql); List <ModuleProject> ls = new List <ModuleProject>(); foreach (DataRow row in data.Tables["ds"].Rows) { ls.Add(Row2ModuleProject(row)); } return(ls); }
static public List <ProjectInfo> getAllProjectInfo() { string sql = "select * from projectinfo order by projectname"; DataSet data = SqlDBUtil.ExecuteQuery(sql, null); List <ProjectInfo> ls = new List <ProjectInfo>(); foreach (DataRow row in data.Tables["ds"].Rows) { ls.Add(Row2ProjectInfo(row)); } return(ls); }
static public bool DelUICheckViewByNO(string checkno) { string sql = "delete from UICheckView where checkno='" + checkno + "'"; try { SqlDBUtil.ExecuteNonQuery(sql); return(true); } catch (Exception) { throw new Exception("删除出现异常"); return(false); } }
//删除 void Button3Click(object sender, EventArgs e) { if (this.listView1.SelectedItems.Count != 1) { MessageBox.Show("请选择一条记录", "提示"); return; } ModuleInfo module = ListView1_Select(this.listView1.SelectedItems[0]); SqlDBUtil.delete(module); this.getAllModuleInfo(); }
void Button8Click(object sender, EventArgs e) { if (this.listView2.SelectedItems.Count != 1) { MessageBox.Show("请选择一条记录", "提示"); return; } ProjectInfo project = ListView2_Select(this.listView2.SelectedItems[0]); SqlDBUtil.delete(project); this.getAllProjectInfo(); }
static public List <ModuleInfo> getAllModuleInfoByProjectID(string id) { string sql = "SELECT * from moduleInfo where id in (select moduleid from moduleproject where projectid=" + id + ")"; DataSet data = SqlDBUtil.ExecuteQuery(sql); List <ModuleInfo> ls = new List <ModuleInfo>(); foreach (DataRow row in data.Tables["ds"].Rows) { ls.Add(Row2ModuleInfo(row)); } return(ls); }
void Button11Click(object sender, EventArgs e) { if (this.listView3.SelectedItems.Count != 1) { MessageBox.Show("请选择一条记录", "提示"); return; } PersonInfo person = ListView3_Select(this.listView3.SelectedItems[0]); SqlDBUtil.delete(person); this.getAllPersonInfo(); }