private void ListViewBing(PackageInfo pack) { ListViewItem lvi = new ListViewItem(); lvi.Text = pack.Packagename; lvi.Checked = false; lvi.SubItems.Add(pack.Packagepath); lvi.SubItems.Add(pack.Packtime); lvi.SubItems.Add(pack.Testtime); lvi.SubItems.Add(pack.Publishtime); lvi.SubItems.Add(pack.State); UIcheckinfo ui = UICheckDao.getUIcheckInfoByPackId(pack.Id); if (ui.State == null) { lvi.SubItems.Add("未生成检查"); } else { lvi.SubItems.Add(ui.State); } lvi.SubItems.Add(pack.Moduleid.ToString()); lvi.SubItems.Add(pack.Managerid.ToString()); lvi.SubItems.Add(pack.Id.ToString()); lvi.SubItems.Add(pack.TestRate.ToString()); this.listView1.Items.Add(lvi); }
private void DelImage() { if (Checkviewlist.Count == 0) { return; } Checkviewlist.RemoveAt(this.curImageno - 1); UICheckDao.DelUICheckViewByImageno(this.uiinfo.Checkno, (this.curImageno - 1).ToString()); int i = Checkviewlist.Count; MemoryStream ms = null; if (this.curImageno < i) { //this.curImageno = this.curImageno +1; ms = new MemoryStream(Checkviewlist[this.curImageno - 1].Srcimage); this.pictureBox1.Image = Image.FromStream(ms); } else if (this.curImageno >= i && i != 0) { this.curImageno = i; ms = new MemoryStream(Checkviewlist[this.curImageno - 1].Srcimage); this.pictureBox1.Image = Image.FromStream(ms); } else { this.curImageno = 0; this.pictureBox1.Image = null; } this.totalImageno = Checkviewlist.Count; ValidateUPDOWN(); }
/// <summary> /// 获取检查列表 /// </summary> void getUIcheckList() { string moduleid = this.comboBox1.SelectedValue.ToString(); string manageid = this.comboBox2.SelectedValue.ToString(); string state = this.comboBox3.Text; string begin = this.dateTimePicker1.Value.ToShortDateString() + " 00:00:00"; string end = this.dateTimePicker2.Value.ToShortDateString() + " 23:59:59"; if (this.dateTimePicker1.IsDisposed && this.dateTimePicker2.IsDisposed) { begin = null; end = null; } this.count = UICheckDao.QueryUIcheckCount(moduleid, manageid, state, begin, end); int countpage = (count % pagesize == 0)?count / pagesize:count / pagesize + 1; if (this.currentpage > countpage) { this.currentpage = 1; } this.label3.Text = string.Format(currentstr, this.currentpage); this.label5.Text = string.Format(pagestr, this.pagesize); this.label4.Text = string.Format(countstr, countpage, this.count); this.listView1.Items.Clear(); List <UIcheckinfo> allui = UICheckDao.QueryUIcheckinfo(moduleid, manageid, state, begin, end, (currentpage > 1)?((this.currentpage - 1) * pagesize):0 , pagesize); foreach (UIcheckinfo tu in allui) { ListViewBing(tu); } }
//新建 public UICheck() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); this.KeyPreview = true; //先响应控件的ctrl+V的keydown事件。 this.comboBox1.DataSource = Source_Person; this.comboBox1.DisplayMember = "fullname"; this.comboBox1.ValueMember = "id"; this.comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems; this.comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; this.textBox2.Text = UICheckDao.getNewCheckNO(); this.comboBox2.DataSource = Source_Module; this.comboBox2.DisplayMember = "fullname"; this.comboBox2.ValueMember = "id"; this.comboBox2.AutoCompleteSource = AutoCompleteSource.ListItems; this.comboBox2.AutoCompleteMode = AutoCompleteMode.SuggestAppend; this.comboBox3.DataSource = Source_Project; this.comboBox3.DisplayMember = "projectname"; this.comboBox3.ValueMember = "id"; this.comboBox3.AutoCompleteSource = AutoCompleteSource.ListItems; this.comboBox3.AutoCompleteMode = AutoCompleteMode.SuggestAppend; this.multiColumnFilterComboBox1.DataSource = PackageDao.getAllUnTestPack(); this.multiColumnFilterComboBox1.ViewColList.Add(new MComboColumn("packagename", 200, true)); this.multiColumnFilterComboBox1.ViewColList.Add(new MComboColumn("packtime", 60, true)); this.multiColumnFilterComboBox1.ViewColList.Add(new MComboColumn("code", 60, true)); this.multiColumnFilterComboBox1.DisplayMember = "packagename"; this.multiColumnFilterComboBox1.ValueMember = "id"; this.multiColumnFilterComboBox1.Validated += new EventHandler(Package_SelectedValueChanged); this.textBox1.Enabled = false; //新建时禁止评论图片 this.KeyDown += new KeyEventHandler(pictureBox1_KeyDown); this.pictureBox1.Click += new EventHandler(pictureBox1_Click); this.drawToolsControl.Visible = false; this.colorSelector.Visible = false; this.textBox.Visible = false; this.CenterToParent(); uiinfo = new UIcheckinfo(); this.button3.Visible = false; this.button6.Visible = false; ValidateUPDOWN(); // // TODO: Add constructor code after the InitializeComponent() call. // }
//设置未检查,未通过,选择性通过,通过 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 Button3Click(object sender, EventArgs e) { if (this.listView1.CheckedItems.Count > 0) { foreach (ListViewItem lvi in this.listView1.CheckedItems) { UIcheckinfo tu = ListViewSelect(lvi); SqlDBUtil.delete(tu); UICheckDao.DelUICheckViewByNO(tu.Checkno); } MessageBox.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); getUIcheckList(); } else { MessageBox.Show("请至少选择一条记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
//检查基本信息 bool UICheckInfoSave() { //责任人赋值 if (this.comboBox1.SelectedItem != null && this.comboBox1.SelectedIndex != 0) { uiinfo.Adminname = this.comboBox1.Text; uiinfo.Adminid = (int)this.comboBox1.SelectedValue; } else { MessageBox.Show("请选择责任人", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } //模块赋值 if (this.comboBox2.SelectedItem != null && this.comboBox2.SelectedIndex != 0) { uiinfo.Modulename = this.comboBox2.Text; uiinfo.Moduleid = (int)this.comboBox2.SelectedValue; } else { MessageBox.Show("请选择模块", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } //项目赋值 if (this.comboBox3.SelectedItem != null && this.comboBox3.SelectedIndex != 0) { uiinfo.Projectname = this.comboBox3.Text; uiinfo.Projectid = (int)this.comboBox3.SelectedValue; } else { MessageBox.Show("请选择项目", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } //更新包赋值 uiinfo.Packagename = this.multiColumnFilterComboBox1.Text; if (this.multiColumnFilterComboBox1.SelectedValue != null) { uiinfo.Packageid = (int)this.multiColumnFilterComboBox1.SelectedValue; } //判断insert和update if (uiinfo.Id == 0) { if (!UICheckDao.getNewCheckNO().Equals(this.textBox2.Text)) { uiinfo.Checkno = UICheckDao.getNewCheckNO(); MessageBox.Show("检查编号被占用,系统重新分配的编号为:" + uiinfo.Checkno, "提示"); } else { uiinfo.Checkno = this.textBox2.Text; } } else { uiinfo.Checkno = this.textBox2.Text; } //状态赋值 uiinfo.State = Enum.GetName(typeof(CommonConst.CheckState), CommonConst.CheckState.未检查); if (string.IsNullOrEmpty(uiinfo.Createtime)) { uiinfo.Createtime = System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); } return(true); }
/// <summary> /// 绑定数据到控件 /// </summary> void TestUnitBingData() { this.multiColumnFilterComboBox1.Items.Clear(); this.multiColumnFilterComboBox1.Items.Add(this.uiinfo); 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) == uiinfo.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) == uiinfo.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) == uiinfo.Projectid) { int sel = this.Source_Project.Rows.IndexOf(element); this.comboBox3.SelectedIndex = sel; break; } } this.textBox2.Text = uiinfo.Checkno; //从数据库中查出图片,赋值到picturebox Checkviewlist = UICheckDao.getUICheckViewByNO(this.uiinfo.Checkno); if (Checkviewlist.Count > 0) { this.curImageno = 1; MemoryStream ms = null; if (Checkviewlist[this.curImageno - 1].Checkedimage == null) { ms = new MemoryStream(Checkviewlist[this.curImageno - 1].Srcimage); } else { ms = new MemoryStream(Checkviewlist[this.curImageno - 1].Checkedimage); } this.pictureBox1.Image = Image.FromStream(ms); this.textBox1.Text = Checkviewlist[this.curImageno - 1].Checkmark; } OperateList = new OperateManager[Checkviewlist.Count]; ValidateUPDOWN(); }
//修改查看 public UICheck(int id, bool isedit) { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); _isedit = isedit; uiinfo = UICheckDao.getUIcheckInfoById(id); this.comboBox1.DataSource = Source_Person; this.comboBox1.DisplayMember = "fullname"; this.comboBox1.ValueMember = "id"; this.comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems; this.comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; this.textBox2.Text = UICheckDao.getNewCheckNO(); this.comboBox2.DataSource = Source_Module; this.comboBox2.DisplayMember = "fullname"; this.comboBox2.ValueMember = "id"; this.comboBox2.AutoCompleteSource = AutoCompleteSource.ListItems; this.comboBox2.AutoCompleteMode = AutoCompleteMode.SuggestAppend; this.comboBox3.DataSource = Source_Project; this.comboBox3.DisplayMember = "projectname"; this.comboBox3.ValueMember = "id"; this.comboBox3.AutoCompleteSource = AutoCompleteSource.ListItems; this.comboBox3.AutoCompleteMode = AutoCompleteMode.SuggestAppend; //this.multiColumnFilterComboBox1.DataSource = PackageDao.getAllUnTestPack(); this.multiColumnFilterComboBox1.ViewColList.Add(new MComboColumn("packagename", 200, true)); this.multiColumnFilterComboBox1.ViewColList.Add(new MComboColumn("packtime", 60, true)); this.multiColumnFilterComboBox1.ViewColList.Add(new MComboColumn("code", 60, true)); this.multiColumnFilterComboBox1.DisplayMember = "packagename"; this.multiColumnFilterComboBox1.ValueMember = "id"; this.multiColumnFilterComboBox1.Validated += new EventHandler(Package_SelectedValueChanged); this.textBox2.ReadOnly = true; TestUnitBingData(); if (isedit) { this.checkBox1.Checked = false; this.pictureBox1.SelectColor = Color.Red; this.textBox.Visible = false; this.colorSelector.Visible = false; drawToolsControl.ButtonRedoClick += new EventHandler( DrawToolsControlButtonRedoClick); drawToolsControl.ButtonDrawStyleClick += new EventHandler( DrawToolsControlButtonDrawStyleClick); colorSelector.ColorChanged += new EventHandler(colorSelector_ColorChanged); colorSelector.FontSizeChanged += new EventHandler(colorSelector_FontSizeChanged); this.pictureBox1.TextBoxHide += new EventHandler(TextBoxExLostFocus); this.pictureBox1.TextBoxShow += new EventHandler(pictureBox1_TextBoxShow); } else { this.checkBox1.Checked = true; this.textBox1.ReadOnly = true; this.drawToolsControl.Visible = false; this.colorSelector.Visible = false; this.textBox.Visible = false; this.button4.Visible = false; this.button3.Visible = false; this.button6.Visible = false; } this.CenterToParent(); // // TODO: Add constructor code after the InitializeComponent() call. // }