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("数据库没有该用户!,请联系管理员"); } }
//保存描述的方法 void Button5Click(object sender, EventArgs e) { TestTheme theme = this.treeView1.SelectedNode.Tag as TestTheme; theme.Favcontent = this.textBox1.Text; SqlDBUtil.update(theme); MessageBox.Show("保存成功", "提示"); }
//设置未检查,未通过,选择性通过,通过 void Button5Click(object sender, EventArgs e) { if (this.listView1.CheckedItems.Count > 0) { string state = ""; string bt = ((Button)sender).Text; string checkedtime = ""; string msgcontent = "{0},您好!\n您发布的{1}版本,"; if ("待检查".Equals(bt)) { state = Enum.GetName(typeof(CommonConst.CheckState), CommonConst.CheckState.未检查); } if ("未通过".Equals(bt)) { state = Enum.GetName(typeof(CommonConst.CheckState), CommonConst.CheckState.未通过); checkedtime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); msgcontent += "未通过界面检查。请登录以下网址查看界面检查详细:\n http://192.10.110.206:9001/CmdCtrlService/jsp/UIcheckView.jsp?checkno={2}"; } if ("选择性通过".Equals(bt)) { state = Enum.GetName(typeof(CommonConst.CheckState), CommonConst.CheckState.择性通过); checkedtime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); msgcontent += "选择性通过界面检查。请登录以下网址查看界面检查详细:\n http://192.10.110.206:9001/CmdCtrlService/jsp/UIcheckView.jsp?checkno={2}"; } if ("已通过".Equals(bt)) { state = Enum.GetName(typeof(CommonConst.CheckState), CommonConst.CheckState.已通过); checkedtime = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); msgcontent += "检查单号为{2},已通过界面检查。"; } foreach (ListViewItem lvi in this.listView1.CheckedItems) { string id = lvi.SubItems[6].Text; UIcheckinfo uiinfo = UICheckDao.getUIcheckInfoById(Int32.Parse(id)); uiinfo.Checkedtime = checkedtime; uiinfo.State = state; uiinfo.Checkername = WatchCilent.GlobalParams.User.Fullname; uiinfo.Checkerid = WatchCilent.GlobalParams.User.Id; SqlDBUtil.update(uiinfo); SendMessageToManager(string.Format(msgcontent, uiinfo.Adminname, uiinfo.Packagename, uiinfo.Checkno), uiinfo.Adminid); } getUIcheckList(); } else { MessageBox.Show("请至少选择一条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
void Button9Click(object sender, EventArgs e) { if (this.listView3.SelectedItems.Count != 1) { MessageBox.Show("请选择一条记录", "提示"); return; } if (ValidatePersonEdit()) { PersonInfo person = ListView3_Select(this.listView3.SelectedItems[0]); person.Fullname = this.textBox6.Text; person.Ip = this.textBox5.Text; person.Password = textBox10.Text; person.Role = textBox11.Text; SqlDBUtil.update(person); this.getAllPersonInfo(); } }
void Button6Click(object sender, EventArgs e) { if (this.listView2.SelectedItems.Count != 1) { MessageBox.Show("请选择一条记录", "提示"); return; } if (ValidateProjectEdit()) { ProjectInfo project = ListView2_Select(this.listView2.SelectedItems[0]); project.Projectname = this.textBox4.Text; project.Projectpath = this.textBox3.Text; project.Url = this.textBox7.Text; project.Ftppath = this.textBox8.Text; SqlDBUtil.update(project); this.getAllProjectInfo(); } }
void Button1Click(object sender, System.EventArgs e) { if (TestuiSave()) { bool isSave = false; if (tu.Id != 0) { isSave = SqlDBUtil.update(tu); } else { tu.Id = SqlDBUtil.insertReturnID(tu); isSave = true; } if (isSave) { //创建文档 if (unitDOCpath == null) { unitDOCpath = this.defaultpath; } this.richTextBox1.SaveFile(temppath + @"\" + tu.Unitno + ".doc"); CreateTestUnit(defaultpath + @"\temp\TestUnit.doc", temppath + @"\" + tu.Unitno + ".doc", unitDOCpath + @"\" + tu.Unitno + ".doc"); // //创建HTML // if(unitHTMLpath!=null) // { // var fullHtmlPath =unitHTMLpath+@"\"+tu.Unitno+".html"; // WordDocumentMerger.WordToHtmlFile(unitDOCpath+@"\"+tu.Unitno+".doc",fullHtmlPath); // } //勾选自动发送 if (this.checkBox1.Checked) { SendMessageToManager("", true); } MessageBox.Show("保存成功!"); } else { MessageBox.Show("保存失败!"); } } }
//修改 void Button2Click(object sender, EventArgs e) { if (this.listView1.SelectedItems.Count != 1) { MessageBox.Show("请选择一条记录", "提示"); return; } if (ValidateModuleEdit()) { ModuleInfo module = ListView1_Select(this.listView1.SelectedItems[0]); module.Fullname = this.textBox1.Text; module.Code = this.textBox2.Text; module.Managerid = Int32.Parse(this.comboBox1.SelectedValue.ToString()); module.Managername = this.comboBox1.Text; module.Lastversion = this.textBox9.Text; SqlDBUtil.update(module); this.getAllModuleInfo(); } }
//按钮 已发布 void Button9Click(object sender, EventArgs e) { if (listView1.CheckedItems.Count != 0) { foreach (ListViewItem lt in listView1.CheckedItems) { PackageInfo pack = new PackageInfo(); pack = ListViewSelect(lt); if (pack.State == CommonConst.PACKSTATE_YiJieShou) { MessageBox.Show(pack.Packagename + "尚未处理,不能标记为已发布", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); continue; } pack.State = CommonConst.PACKSTATE_YiFaBu; pack.Publishtime = System.DateTime.Now.ToLocalTime().ToString(); SqlDBUtil.update(pack); } } getAllPackInList(); }
/// <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("已保存", "提示"); }
//保存按钮 void Button4Click(object sender, System.EventArgs e) { if (UICheckInfoSave()) { string msgstr = "保存成功!"; //更新 if (uiinfo.Id != null && uiinfo.Id != 0) { uiinfo.Checkerid = Int32.Parse(GlobalParams.UserId); uiinfo.Checkername = GlobalParams.Username; SqlDBUtil.update(uiinfo); msgstr = "更新成功!"; } //插入 else { uiinfo.Id = SqlDBUtil.insertReturnID(uiinfo); SendMessageToManager(); } if (_isedit) //是否编辑图片 { //判断是否有当前未保存的编辑操作,如果有,则给操作数组赋值。 if (this.pictureBox1.OperateManager != null) { OperateList[this.curImageno - 1] = this.pictureBox1.OperateManager; } //将当前的文字说明保存给对象。因为有可能编辑过。 Checkviewlist[this.curImageno - 1].Checkmark = this.textBox1.Text; } //循环保存图片信息 for (int i = 0; i < Checkviewlist.Count; i++) { //设置图片编号为循环顺序 Checkviewlist[i].Imageno = i.ToString(); UICheckView uc = Checkviewlist[i]; //保存图片到对象中 MemoryStream ms = null; if (uc.Checkedimage != null) { ms = new MemoryStream(Checkviewlist[i].Checkedimage); } else { ms = new MemoryStream(Checkviewlist[i].Srcimage); } //先将基础图片赋值到控件 this.pictureBox1.Image = Image.FromStream(ms); //判断有无编辑操作 if (OperateList != null && OperateList[i] != null) { this.pictureBox1.OperateManager = OperateList[i]; } else { this.pictureBox1.OperateManager = null; } //从控件中抓取编辑过的图片,保存到对象中 MemoryStream ms1 = new MemoryStream(); this.pictureBox1.GetImg().Save(ms1, ImageFormat.Jpeg); Byte[] bytBLOBData = new Byte[ms1.Length]; ms1.Position = 0; ms1.Read(bytBLOBData, 0, Convert.ToInt32(ms1.Length)); uc.Checkedimage = bytBLOBData; uc.Checkmark = Checkviewlist[i].Checkmark; if (uc.Id != null && uc.Id != 0) { SqlDBUtil.update(uc); } else { Checkviewlist[i].Id = SqlDBUtil.insertReturnID(uc); } } //还原到当前的图片上 MemoryStream ms2 = null; if (Checkviewlist[this.curImageno - 1].Checkedimage != null) { ms2 = new MemoryStream(Checkviewlist[this.curImageno - 1].Checkedimage); } else { ms2 = new MemoryStream(Checkviewlist[this.curImageno - 1].Srcimage); } this.pictureBox1.Image = Image.FromStream(ms2); if (OperateList != null && OperateList[this.curImageno - 1] != null) { this.pictureBox1.OperateManager = OperateList[this.curImageno - 1]; } else { this.pictureBox1.OperateManager = null; } MessageBox.Show(msgstr, "提示"); } }