private void btnSave_Click(object sender, EventArgs e) { studentInfo st_Info = new studentInfo(); int count = st_Info.getTemCount(); frmMain frm_M = new frmMain(); frmStudentRegistation frm_Reg = new frmStudentRegistation(); try { if (st_Info.add_StudentData() && st_Info.delete_TempData()) { DialogResult dResult = MessageBox.Show("Records added successfully.", systemMessage.MESSAGEBOXTITLE_SUCCESS, MessageBoxButtons.OK, MessageBoxIcon.Information); if (dResult == DialogResult.OK) { frmStuden_Details frm_Stdetail = new frmStuden_Details(); frmMain frm_M1 = new frmMain(); frm_Stdetail.MdiParent = frm_M1; frm_M1.mainPanel.Controls.Clear(); frm_M1.mainPanel.Controls.Add(frm_Stdetail); frm_M1.mainPanel.Dock = DockStyle.Fill; frm_Stdetail.Show(); this.Close(); fill_DataGried(); } } } catch (Exception ex) { MessageBox.Show(systemMessage.TEMP_INSERT, systemMessage.MESSAGEBOXTITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void exitToolStripMenuItem_Click(object sender, EventArgs e) { globleVeriables.STU_ID = 0; studentInfo st_Info = new studentInfo (); int count = st_Info.getTemCount(); if (count > 0) { DialogResult dialogResult = MessageBox.Show(systemMessage.EXIT_APP, systemMessage.MESSAGEBOXTITLE, MessageBoxButtons.OK, MessageBoxIcon.Warning); if (dialogResult == DialogResult.OK) { try { if (st_Info.add_StudentData()&& st_Info.delete_TempData()) { DialogResult dResult = MessageBox.Show(+count+" "+"Records add to view successfully.", systemMessage.MESSAGEBOXTITLE_SUCCESS, MessageBoxButtons.OK, MessageBoxIcon.Information); if (dResult == DialogResult.OK) { Application.Exit(); ; } } } catch (Exception ex) { MessageBox.Show(systemMessage.TEMP_INSERT, systemMessage.MESSAGEBOXTITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { Application.Exit(); } }