/// <summary> /// 查找排序 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void searchTimeToolStripButton1_Click(object sender, EventArgs e) { if (startTxtToolStripTextBox1.Text == "" || endTxtToolStripTextBox2.Text == "") { MessageBox.Show("查询开始时间和结束时间不能为空!"); return; } expireDataSet.Tables[0].Rows.Clear(); for (int i = 0; i < showDataSet.Tables[0].Rows.Count; i++) { DataRow row = showDataSet.Tables[0].Rows[i]; Contract con = ContractUtil.getContractFromRow(row); DateTime cTime; try { cTime = DateTime.Parse(con.proExpireData); } catch { continue; } DateTime sTime = DateTime.Parse(startTxtToolStripTextBox1.Text); DateTime eTime = DateTime.Parse(endTxtToolStripTextBox2.Text); if ((cTime.CompareTo(sTime) >= 0) && (cTime.CompareTo(eTime) <= 0)) { DataRow nrow = expireDataSet.Tables[0].NewRow(); nrow = ContractUtil.getRowFromContract(nrow, con); expireDataSet.Tables[0].Rows.Add(nrow); } } expireDataGridView1.Sort(expireDataGridView1.Columns[16], ListSortDirection.Descending); }
/// <summary> /// 查看详细合同 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void showDataGridView_DoubleClick(object sender, EventArgs e) { DataGridView dgv = null; if (tabControl1.SelectedIndex == 0) { dgv = showDataGridView; } else if (tabControl1.SelectedIndex == 1) { dgv = searchDataGridView1; } if (dgv == null || dgv.SelectedRows.Count != 1) { statusLab.Text = "无法在选择多行时查看合同信息,请双击行头选择一行时查看相应信息!"; return; } int i = dgv.SelectedRows[0].Index; Contract con = ContractUtil.getContractFromRow(((DataSet)dgv.DataSource).Tables[0].Rows[i]); ContractEditForm cef = new ContractEditForm("show", "查看合同详细信息", "确定", con); cef.ShowDialog(); cef.Dispose(); }
/// <summary> /// 查看详细合同文本 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void showDeatilTxtBtn_Click(object sender, EventArgs e) { DataGridView dgv = null; if (tabControl1.SelectedIndex == 0) { dgv = showDataGridView; } else if (tabControl1.SelectedIndex == 1) { dgv = searchDataGridView1; } if (dgv == null || dgv.SelectedRows.Count != 1) { statusLab.Text = "无法在选择多行时查看合同文本,请双击行头选择一行时查看相应信息!"; return; } int i = dgv.SelectedRows[0].Index; Contract con = ContractUtil.getContractFromRow(((DataSet)dgv.DataSource).Tables[0].Rows[i]); TxtForm tf = new TxtForm("查看合同文本", con, true); tf.Show(); }
/// <summary> /// 搜索按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void searchStripBtn_Click(object sender, EventArgs e) { string clas = searchCombo.Text; string content = searchTxt.Text; if (clas == "" || content == "") { MessageBox.Show("搜索类型和搜索内容不能为空,请输入完整后再搜索!"); return; } clas = clas.Replace("按", "").Replace("查找", ""); List <DataRow> resRows = ContractUtil.findContract(showDataSet, clas, content); searchDataSet.Tables[0].Rows.Clear(); foreach (DataRow row in resRows) { Contract con = ContractUtil.getContractFromRow(row); DataRow nrow = searchDataSet.Tables[0].NewRow(); nrow = ContractUtil.getRowFromContract(nrow, con); searchDataSet.Tables[0].Rows.Add(nrow); } statusLab.Text = ContractUtil.statusLab; }