//新建 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. // }
//检查基本信息 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); }
//修改查看 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. // }