private void EditDeptInfo() { if (!(dgDept[dgDept.CurrentRowIndex, 0] == "09") || !(dgDept[dgDept.CurrentRowIndex, 0] == "99") || !(dgDept[dgDept.CurrentRowIndex, 0] == "GL")) { frmEditDept editdept = new frmEditDept(); editdept.TextBox1.Text = dgDept[dgDept.CurrentRowIndex, 0].ToString(); editdept.TextBox2.Text = dgDept[dgDept.CurrentRowIndex, 1].ToString(); editdept.ComboBox1.Text = dgDept[dgDept.CurrentRowIndex, 2].ToString(); editdept.CheckBox1.Checked = dgDept[dgDept.CurrentRowIndex, 3].ToString() == "1" ? true : false; editdept.frmMode = 0; //修改记录 editdept.Text = "修改部门"; editdept.OldDeptCode = dgDept[dgDept.CurrentRowIndex, 0].ToString(); //保存原始部门编号 editdept.OldDeptName = dgDept[dgDept.CurrentRowIndex, 1].ToString(); //保存原始部门名称 editdept.ShowDialog(); if (editdept.DialogResult == DialogResult.OK) { LoadDeptList(); } } }
private void ToolBar1_ButtonClick(System.Object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { switch (ToolBar1.Buttons.IndexOf(e.Button)) { case 0: //添加 frmEditDept editdept = new frmEditDept(); editdept.TextBox1.Text = dgDept[dgDept.CurrentRowIndex, 0].ToString(); editdept.TextBox2.Text = dgDept[dgDept.CurrentRowIndex, 1].ToString(); editdept.ComboBox1.Text = dgDept[dgDept.CurrentRowIndex, 2].ToString(); editdept.CheckBox1.Checked = dgDept[dgDept.CurrentRowIndex, 3].ToString() == "1" ? true : false; editdept.frmMode = 1; //添加记录 editdept.Text = "添加部门"; editdept.TextBox1.Text = ""; editdept.TextBox2.Text = ""; editdept.ComboBox1.Text = ""; editdept.CheckBox1.Checked = false; editdept.ShowDialog(); if (editdept.DialogResult == DialogResult.OK) { LoadDeptList(); } break; case 1: //修改 if (!(dgDept.CurrentRowIndex < 0)) { EditDeptInfo(); } break; case 2: //删除 if (!(dgDept.CurrentRowIndex < 0)) { if (!(dgDept[dgDept.CurrentRowIndex, 0] == "09") || !(dgDept[dgDept.CurrentRowIndex, 0] == "99") || !(dgDept[dgDept.CurrentRowIndex, 0] == "GL")) { if (MessageBox.Show("确定要删除当前选中的编号为 " + dgDept[dgDept.CurrentRowIndex, 0].ToString().Trim() + " 的部门吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { //'删除操作 if (DelDept(dgDept[dgDept.CurrentRowIndex, 0].ToString())) { LoadDeptList(); } } } } break; case 4: //打印 if (MessageBox.Show("确定要进行打印操作吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { if (!PrintReport(CurrentDeptListSqlCode)) { MessageBox.Show("打印失败!如果问题依然存在请联系系统管理员。"); } } break; case 6: //关闭 this.Close(); break; } }
private void ToolBar1_ButtonClick(System.Object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { switch (ToolBar1.Buttons.IndexOf(e.Button)) { case 0: //添加 frmEditDept editdept = new frmEditDept(); editdept.TextBox1.Text = dgDept[dgDept.CurrentRowIndex, 0].ToString(); editdept.TextBox2.Text = dgDept[dgDept.CurrentRowIndex, 1].ToString(); editdept.ComboBox1.Text = dgDept[dgDept.CurrentRowIndex, 2].ToString(); editdept.CheckBox1.Checked = dgDept[dgDept.CurrentRowIndex, 3].ToString() == "1" ? true : false; editdept.frmMode = 1; //添加记录 editdept.Text = "添加部门"; editdept.TextBox1.Text = ""; editdept.TextBox2.Text = ""; editdept.ComboBox1.Text = ""; editdept.CheckBox1.Checked = false; editdept.ShowDialog(); if (editdept.DialogResult == DialogResult.OK) { LoadDeptList(); } break; case 1: //修改 if (! (dgDept.CurrentRowIndex < 0)) { EditDeptInfo(); } break; case 2: //删除 if (! (dgDept.CurrentRowIndex < 0)) { if (! (dgDept[dgDept.CurrentRowIndex, 0] == "09") || ! (dgDept[dgDept.CurrentRowIndex, 0] == "99") || ! (dgDept[dgDept.CurrentRowIndex, 0] == "GL")) { if (MessageBox.Show("确定要删除当前选中的编号为 " + dgDept[dgDept.CurrentRowIndex, 0].ToString().Trim() + " 的部门吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { //'删除操作 if (DelDept(dgDept[dgDept.CurrentRowIndex, 0].ToString())) { LoadDeptList(); } } } } break; case 4: //打印 if (MessageBox.Show("确定要进行打印操作吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { if (! PrintReport(CurrentDeptListSqlCode)) { MessageBox.Show("打印失败!如果问题依然存在请联系系统管理员。"); } } break; case 6: //关闭 this.Close(); break; } }
private void EditDeptInfo() { if (!(dgDept[dgDept.CurrentRowIndex, 0] == "09") || !(dgDept[dgDept.CurrentRowIndex, 0] == "99") || ! (dgDept[dgDept.CurrentRowIndex, 0] == "GL")) { frmEditDept editdept = new frmEditDept(); editdept.TextBox1.Text = dgDept[dgDept.CurrentRowIndex, 0].ToString(); editdept.TextBox2.Text = dgDept[dgDept.CurrentRowIndex, 1].ToString(); editdept.ComboBox1.Text = dgDept[dgDept.CurrentRowIndex, 2].ToString(); editdept.CheckBox1.Checked = dgDept[dgDept.CurrentRowIndex, 3].ToString() == "1" ? true : false; editdept.frmMode = 0; //修改记录 editdept.Text = "修改部门"; editdept.OldDeptCode = dgDept[dgDept.CurrentRowIndex, 0].ToString(); //保存原始部门编号 editdept.OldDeptName = dgDept[dgDept.CurrentRowIndex, 1].ToString(); //保存原始部门名称 editdept.ShowDialog(); if (editdept.DialogResult == DialogResult.OK) { LoadDeptList(); } } }