private void toolStripButton2_Click(object sender, EventArgs e) { if (frmQuery == null || frmQuery.IsDisposed) { frmQuery = new FrmQuery(); //将主窗体对象传递过去 frmQuery.Show(this); //显示窗体二 this.Hide(); } else { frmQuery.Activate(); } }
private void btnConfirm_Click(object sender, EventArgs e) { if (validQueryName.IsValid && validBatch.IsValid && validClient.IsValid && validType.IsValid) { BLL.query_list bll = new BLL.query_list(); Model.query_list model = new Model.query_list(); model.query_title = tbQueryName.Text; model.batch = tbBatch.Text; model.client = tbClient.Text; model.query_type = cmbType.SelectedValue.ToString(); model.entrust_date = dtpEntrustDate.Value.Date; model.add_user = "******"; model.add_time = DateTime.Now; if (bll.Add(model) > 0) { MessageBox.Show("添加成功!", "添加比对任务", MessageBoxButtons.OK, MessageBoxIcon.Information); FrmQuery frm = (FrmQuery)this.Owner; this.Close(); this.refresh(); } } else { if (!validQueryName.IsValid) { validQueryName.Validate(); } if (!validBatch.IsValid) { validBatch.Validate(); } if (!validClient.IsValid) { validClient.Validate(); } if (!validType.IsValid) { validType.Validate(); } } }