private void mnuEdit_Click(object sender, EventArgs e) { if (tab1.SelectedIndex == 0) { if (DBGrid.CurrentRow == null) { return; } modAccSubjectList mod = (modAccSubjectList)DBGrid.CurrentRow.DataBoundItem; EditSubjectList frm = new EditSubjectList(); frm.EditItem(mod); if (frm.ShowDialog() == DialogResult.OK) { LoadData(); Find(Util.retValue1); } } else { if (DBGrid2.CurrentRow == null) { return; } modAccSubjectList mod = (modAccSubjectList)DBGrid2.CurrentRow.DataBoundItem; EditSubjectList frm = new EditSubjectList(); frm.EditItem(mod); if (frm.ShowDialog() == DialogResult.OK) { LoadData(); Find(Util.retValue1); } } }
private void toolNew_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; string subjectid = string.Empty; if (rb1.Checked) { subjectid = "913530"; } else if (rb2.Checked) { subjectid = "913535"; } else { subjectid = "913540"; } EditSubjectList frm = new EditSubjectList(); frm.AddItem(subjectid, -1); if (frm.ShowDialog() == DialogResult.OK) { LoadData(); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void mnuAddChild_Click(object sender, EventArgs e) { if (tab1.SelectedIndex == 0) { if (DBGrid.CurrentRow == null) { return; } modAccSubjectList mod = (modAccSubjectList)DBGrid.CurrentRow.DataBoundItem; if (mod.HasChildren == 0) { MessageBox.Show("该科目不能添加子科目!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } EditSubjectList frm = new EditSubjectList(); frm.AddItem(mod.SubjectId, mod.AdFlag); if (frm.ShowDialog() == DialogResult.OK) { LoadData(); Find(Util.retValue1); } } else { if (DBGrid2.CurrentRow == null) { return; } modAccSubjectList mod = (modAccSubjectList)DBGrid2.CurrentRow.DataBoundItem; if (mod.HasChildren == 0) { MessageBox.Show("该科目不能添加子科目!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } EditSubjectList frm = new EditSubjectList(); frm.AddItem(mod.SubjectId, mod.AdFlag); if (frm.ShowDialog() == DialogResult.OK) { LoadData(); Find(Util.retValue1); } } }