//筛选 void tssx_Click(object sender, EventArgs e) { if (dgvYj.CurrentCell != null) { if (dgvYj.Rows.Count > 0) { dgvYj.CancelEdit(); dgvYj.EndEdit(); string dgvColumnName = dgvYj.Columns[dgvYj.CurrentCell.ColumnIndex].Name.ToString(); string ValueName = dgvYj.CurrentCell.Value.ToString(); if (dgvColumnName == "序号") { MessageBox.Show("“按部分值选择内容筛选”只支持含字符型数据的字段"); return; } if (ValueName == string.Empty) { return; } DataView dv = table.DefaultView; dv.RowFilter = string.Format(dgvColumnName + " = '" + ValueName + "'"); table = dv.Table; dgvYj.DataSource = table; lbldgvNum.Text = "共有纪录数:" + Convert.ToString(dgvYj.Rows.Count - 1); } } }
//列表式 void tsShowSingLe_Click(object sender, EventArgs e) { if (CardAndTable == 1) { dgvContent.CancelEdit(); dgvContent.EndEdit(); UI.Input_OldCJ.Input_CJOld.tsbtnSX.Enabled = true; UI.Input_OldCJ.Input_CJOld.tsbtnQXSX.Enabled = true; UI.Input_OldCJ.Input_CJOld.tsmiSX.Enabled = true; UI.Input_OldCJ.Input_CJOld.tsmiQXSX.Enabled = true; //UI.Input_OldCJ.Input_CJOld.tsbtnList2.Checked = true; //UI.Input_OldCJ.Input_CJOld.tsbtnCard2.Checked = false; UI.Input_OldCJ.Input_CJOld.tsmiShowSingle.Checked = true; UI.Input_OldCJ.Input_CJOld.tsmiCard.Checked = false; panelDgvContent.Visible = true; panelContent.Visible = false; //panelDgvContent.Dock = DockStyle.Fill; //panelContent.Dock = DockStyle.Fill; ds = typeNum.getThirdTypeNumData(TopClassID, node.Text, ShowType); dgvContent.DataSource = ds.Tables[0]; table = ds.Tables[0]; lbldgvNum.Text = "共有纪录数:" + Convert.ToString(dgvContent.Rows.Count); dgvContent.ClearSelection(); txt行号dgv.Text = txt行号Card.Text; CardAndTable = 0; } }
//列表式 void tsShowSingLe_Click(object sender, EventArgs e) { if (CardAndTable == 1) { dgvDoc.CancelEdit(); dgvDoc.EndEdit(); UI.Input_OldCJ.Input_CJOld.tsbtnSX.Enabled = true; UI.Input_OldCJ.Input_CJOld.tsbtnQXSX.Enabled = true; UI.Input_OldCJ.Input_CJOld.tsmiSX.Enabled = true; UI.Input_OldCJ.Input_CJOld.tsmiQXSX.Enabled = true; //UI.Input_OldCJ.Input_CJOld.tsbtnList2.Checked = true; //UI.Input_OldCJ.Input_CJOld.tsbtnCard2.Checked = false; UI.Input_OldCJ.Input_CJOld.tsmiShowSingle.Checked = true; UI.Input_OldCJ.Input_CJOld.tsmiCard.Checked = false; this.Visible = false; panelDgvDoc.Visible = true; panelDoc.Visible = false; panelDgvDoc.Dock = DockStyle.Fill; panelDoc.Dock = DockStyle.Fill; this.Visible = true; ds = OldCJ_doc.getData(FileID); dgvDoc.DataSource = ds.Tables[0]; table = ds.Tables[0]; lbldgvNum.Text = "共有纪录数:" + Convert.ToString(dgvDoc.Rows.Count - 1); dgvDoc.ClearSelection(); txt行号dgv.Text = txt行号Card.Text; CardAndTable = 0; } }
//列表式 void tsShowSingLe_Click(object sender, EventArgs e) { if (CardAndTable == 1) { dgvDoc.CancelEdit(); dgvDoc.EndEdit(); InputMain.tsbtnSX.Enabled = true; InputMain.tsbtnQXSX.Enabled = true; InputMain.tsmiSX.Enabled = true; InputMain.tsmiQXSX.Enabled = true; //InputMain.tsbtnList2.Checked = true; //InputMain.tsbtnCard2.Checked = false; InputMain.tsmiShowSingle.Checked = true; InputMain.tsmiCard.Checked = false; panelDgvDoc.Visible = true; panelDoc.Visible = false; panelDgvDoc.Dock = DockStyle.Fill; panelDoc.Dock = DockStyle.Fill; ds = CJ_doc.GetData(FileID, ShowType); dgvDoc.DataSource = ds.Tables[0]; table = ds.Tables[0]; lbldgvNum.Text = "共有纪录数:" + Convert.ToString(dgvDoc.Rows.Count - 1); dgvDoc.ClearSelection(); txtDocIndex.Text = txtIndex.Text; int num = Convert.ToInt32(txtDocIndex.Text); publicDgv.DataGridView导航(dgvDoc, num); CardAndTable = 0; } }
//列表式 private void tsShowSingLe_Click(object sender, EventArgs e) { if (CardAndTable == 1) { dgvContent.CancelEdit(); dgvContent.EndEdit(); InputMain.tsbtnSX.Enabled = true; InputMain.tsbtnQXSX.Enabled = true; InputMain.tsmiSX.Enabled = true; InputMain.tsmiQXSX.Enabled = true; //InputMain.tsbtnList2.Checked = true; //InputMain.tsbtnCard2.Checked = false; InputMain.tsmiShowSingle.Checked = true; InputMain.tsmiCard.Checked = false; panelDgvContent.Visible = true; panelContent.Visible = false; ds = typeNum.getSecondTypeNumData(TopClassID, node.Text, ShowType); dgvContent.DataSource = ds.Tables[0]; table = ds.Tables[0]; lbldgvNum.Text = "共有纪录数:" + Convert.ToString(dgvContent.Rows.Count - 1); dgvContent.ClearSelection(); txtDgvIndex.Text = txtIndex.Text; CardAndTable = 0; } }
//删除行 void tsdelete_Click(object sender, EventArgs e) { dgvYj.CancelEdit(); dgvYj.EndEdit(); if (dgvYj.SelectedRows.Count > 0) { DialogResult result = MessageBox.Show("确实要删除原件吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result == DialogResult.OK) { for (int i = 0; i < dgvYj.SelectedRows.Count; i++) { object YjID = dgvYj.Rows[dgvYj.SelectedRows[i].Index].Cells["原件ID"].Value; object path = dgvYj.Rows[dgvYj.SelectedRows[i].Index].Cells["路径"].Value; object fileName = dgvYj.Rows[dgvYj.SelectedRows[i].Index].Cells["保存名称"].Value; if (Object.Equals(YjID, "") || Object.Equals(YjID, null) || Object.Equals(YjID, DBNull.Value)) { continue; } else { if (!Object.Equals(path, string.Empty) && !Object.Equals(path, null) && !Object.Equals(path, DBNull.Value)) { if (!Object.Equals(fileName, string.Empty) && !Object.Equals(fileName, null) && !Object.Equals(fileName, DBNull.Value)) { UpLoadDownLoad.DeleteFile(path.ToString(), fileName.ToString()); } } CJ_yj.DeleteYj(Convert.ToInt32(YjID)); } } //MessageBox.Show("删除成功!"); ds = CJ_yj.getData(DocID); dgvYj.DataSource = ds.Tables[0]; table = ds.Tables[0]; lbldgvNum.Text = "共有纪录数:" + Convert.ToString(dgvYj.Rows.Count - 1); if (dgvYj.Rows.Count == 1) { txtYjIndex.Text = "1"; } else { txtYjIndex.Text = Convert.ToString(dgvYj.CurrentCell.RowIndex + 1); } int num = dgvYj.Rows.Count; publicDgv.DataGridView导航(dgvYj, num); } } else { MessageBox.Show("请选择要删除的行!"); return; } }
//列表式 private void tsShowSingLe_Click(object sender, EventArgs e) { if (CardAndTable == 1) { dgvContent.CancelEdit(); dgvContent.EndEdit(); UI.Input.BZ_Input.tsbtnSX.Enabled = true; UI.Input.BZ_Input.tsbtnQXSX.Enabled = true; UI.Input.BZ_Input.tsmiSX.Enabled = true; UI.Input.BZ_Input.tsmiQXSX.Enabled = true; //UI.Input.BZ_Input.tsbtnList2.Checked = true; //UI.Input.BZ_Input.tsbtnCard2.Checked = false; UI.Input.BZ_Input.tsmiShowSingle.Checked = true; UI.Input.BZ_Input.tsmiCard.Checked = false; this.Visible = false; panelDgvContent.Visible = true; panelContent.Visible = false; panelDgvContent.Dock = DockStyle.Fill; panelContent.Dock = DockStyle.Fill; this.Visible = true; ds = bz_content.getData(TopClassID); dgvContent.DataSource = ds.Tables[0]; table = ds.Tables[0]; lbldgvNum.Text = Convert.ToString(dgvContent.Rows.Count - 1); dgvContent.ClearSelection(); txt行号dgv.Text = txt行号Card.Text; CardAndTable = 0; } }
private void tsSX_Click(object sender, EventArgs e) { if (dgvBorrow.CurrentCell != null) { if (ds.Tables[0].Rows.Count != 0) { dgvBorrow.CancelEdit(); dgvBorrow.EndEdit(); string dgvColumnName = dgvBorrow.Columns[dgvBorrow.CurrentCell.ColumnIndex].Name.ToString(); string ValueName = dgvBorrow.CurrentCell.Value.ToString(); DataView dv = table.DefaultView; dv.RowFilter = string.Format(dgvColumnName + " = '" + ValueName + "'"); table = dv.Table; dgvBorrow.DataSource = table; lbldgvNum.Text = "共有纪录数:" + Convert.ToString(dgvBorrow.Rows.Count); } } }
//取消筛选委托事件 private void TsQXSX_Click(object sender, EventArgs e) { dgvClass.CancelEdit(); dgvClass.EndEdit(); try { string limit = yNode.Parent.Text; string year = yNode.Text; ds = Gd_class.getClassList(TopClassID, limit, year); dgvClass.DataSource = ds.Tables[0]; table = ds.Tables[0]; lbldgvRowCount.Text = Convert.ToString(dgvClass.Rows.Count - 1); Gd_class.LoadClassNodes(yNode, TopClassID, yNode.Parent.Text, yNode.Text); } catch { } }
//右键删除菜单 private void dgvDetails_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (e.RowIndex != -1) { dgvDetails.CancelEdit(); dgvDetails.EndEdit(); if (dgvDetails.SelectedRows.Count == 0) { dgvDetails.ClearSelection(); dgvDetails.Rows[e.RowIndex].Selected = true; } contextMenuStrip1.Show(MousePosition.X, MousePosition.Y); } } }
/// <summary> /// 删除信息 /// </summary> public void Delete() { #region delete if (CardAndTable == 0) { dgvProject.CancelEdit(); dgvProject.EndEdit(); if (dgvProject.SelectedRows.Count > 0) { DialogResult result = MessageBox.Show("执行此操作后将不可恢复\t\n\t\n确定要删除吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result == DialogResult.OK) { for (int i = 0; i < dgvProject.SelectedRows.Count; i++) { object projectID = dgvProject.Rows[dgvProject.SelectedRows[i].Index].Cells["项目ID"].Value; if (Object.Equals(projectID, "") || Object.Equals(projectID, null) || Object.Equals(projectID, DBNull.Value)) { continue; } else { if (!project.Delete(Convert.ToInt32(projectID))) { return; } } } //数据绑定 ds = project.getData(TypeNumID, ShowType); dgvProject.DataSource = ds.Tables[0]; table = ds.Tables[0]; lbldgvNum.Text = "共有纪录数:" + Convert.ToString(dgvProject.Rows.Count - 1); //更新节点 project.getProjectNodeData(node, ShowType); //设置导航按钮 if (dgvProject.Rows.Count == 1) { txtFileIndex.Text = "1"; } else { txtFileIndex.Text = Convert.ToString(dgvProject.CurrentCell.RowIndex + 1); } int num = dgvProject.Rows.Count; publicDgv.DataGridView导航(dgvProject, num); } } else { MessageBox.Show("请选择要删除的行!"); return; } } else { if (tProjectID.Text == string.Empty) { MessageBox.Show("当前没有要删除的数据!"); return; } else { DialogResult result = MessageBox.Show("执行此操作后将不可恢复\t\n\t\n确实要删除项目(工程) " + tProjectNum.Text + " 吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result == DialogResult.OK) { if (project.Delete(Convert.ToInt32(tProjectID.Text))) { //绑定数据 ds = project.getData(TypeNumID, ShowType); dgvProject.DataSource = ds.Tables[0]; table = ds.Tables[0]; lblNum.Text = "共有纪录数:" + Convert.ToString(dgvProject.Rows.Count - 1); //更新节点 project.getProjectNodeData(node, ShowType); //设置导航按钮 PageBtnClick(Convert.ToInt32(txtIndex.Text)); } else { return; } } } } #endregion }
//删除行 private void tsdelete_Click(object sender, EventArgs e) { if (click == 0) { dgvFile.CancelEdit(); dgvFile.EndEdit(); if (dgvFile.SelectedRows.Count > 0) { DialogResult result = MessageBox.Show("确实要删除案卷吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result == DialogResult.OK) { for (int i = 0; i < dgvFile.SelectedRows.Count; i++) { object fileID = dgvFile.Rows[dgvFile.SelectedRows[i].Index].Cells["案卷ID"].Value; if (Object.Equals(fileID, "") || Object.Equals(fileID, null) || Object.Equals(fileID, DBNull.Value)) { continue; } else { if (!bz_file.DeleteFile(Convert.ToInt32(fileID))) { return; } } } //数据绑定 ds = bz_file.getData(ContentID); dgvFile.DataSource = ds.Tables[0]; table = ds.Tables[0]; lbldgvNum.Text = Convert.ToString(dgvFile.Rows.Count - 1); //更新节点 bz_file.getFileNodeData(node); //设置导航按钮 if (dgvFile.Rows.Count == 1) { txt行号dgv.Text = "1"; } else { txt行号dgv.Text = Convert.ToString(dgvFile.CurrentCell.RowIndex + 1); } } } else { MessageBox.Show("请选择要删除的行!"); return; } } else { if (txtFileID.Text == string.Empty) { MessageBox.Show("当前没有要删除的数据!"); return; } else { DialogResult result = MessageBox.Show("确实要删除案卷 " + txtFileNum.Text + " 吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result == DialogResult.OK) { if (bz_file.DeleteFile(Convert.ToInt32(txtFileID.Text))) { //绑定数据 ds = bz_file.getData(ContentID); dgvFile.DataSource = ds.Tables[0]; table = ds.Tables[0]; lblNum.Text = Convert.ToString(dgvFile.Rows.Count - 1); //更新节点 bz_file.getFileNodeData(node); //设置导航按钮 PageBtnClick(Convert.ToInt32(txt行号Card.Text)); } else { return; } } } } }