private void btnSave_Click(object sender, EventArgs e)
        {
            fill_DataGried();
            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(+count + "  " + "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 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);
            }
        }
Exemplo n.º 3
0
        private void newRegistrationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmStuden_Details frmSD = new frmStuden_Details();

            frmSD.MdiParent = this;
            mainPanel.Controls.Clear();
            mainPanel.Controls.Add(frmSD);
            frmSD.Dock = DockStyle.Fill;
            //this.panel3.Height = 400;
            frmSD.Show();

            //frmStuden_Details frmSD = new frmStuden_Details ();
            //frmSD.ShowDialog();
            this.Text = "© Queens's University  Student Registration System : Student Details";
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            studentBean stBean              = null;
            studentInfo stInfo = null;

            if (valid_control())
            {
                try
                {
                    stBean = new studentBean();
                    stInfo = new studentInfo();

                    stBean.Studentid = Int32.Parse(this.txtStudentId.Text.ToString().Trim());
                    stBean.St_name = this.txtStudentName.Text.Trim();
                    stBean.Dob = DateTime.Parse(this.dtpDOB.Text.Trim());
                    stBean.St_gradepointavg = Decimal.Parse(this.txtGradeAvg.Text.Trim());

                    if (this.cbTrue.Checked)
                    {
                        stBean.St_active = "Yes";
                    }
                    else
                    {
                        stBean.St_active = "No";
                    }

                    if (stInfo.add_TemStudentData(stBean))
                    {
                        MessageBox.Show(systemMessage.TEMP_SAVE, systemMessage.MESSAGEBOXTITLE_SUCCESS, MessageBoxButtons.OK, MessageBoxIcon.Information);

                        frmStuden_Details frm_Stdetail = new frmStuden_Details();
                        globleVeriables.STU_ID = globleVeriables.STU_ID - 1;

                        frmMain frm_M = new frmMain();
                        frm_Stdetail.MdiParent = frm_M;
                        frm_M.mainPanel.Controls.Clear();
                        frm_M.mainPanel.Controls.Add(frm_Stdetail);
                        frm_M.mainPanel.Dock = DockStyle.Fill;

                        frm_Stdetail.Show();
                        // Close form
                        this.Dispose();

                    }
                    else
                    {
                        MessageBox.Show(systemMessage.TEMP_INSERT, systemMessage.MESSAGEBOXTITLE, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                {
                    globleVeriables.STU_ID = globleVeriables.STU_ID - 1;
                    if (ex.Message.Equals("Database Not Found!"))
                    {
                        MessageBox.Show(systemMessage.DATABASE_NOTFOUND, systemMessage.MESSAGEBOXTITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show(systemMessage.TEMP_INSERT, systemMessage.MESSAGEBOXTITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                clear_Content();
                setStudentId();
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            studentBean stBean = null;
            studentInfo stInfo = null;

            if (valid_control())
            {
                try
                {
                    stBean = new studentBean();
                    stInfo = new studentInfo();

                    stBean.Studentid        = Int32.Parse(this.txtStudentId.Text.ToString().Trim());
                    stBean.St_name          = this.txtStudentName.Text.Trim();
                    stBean.Dob              = DateTime.Parse(this.dtpDOB.Text.Trim());
                    stBean.St_gradepointavg = Decimal.Parse(this.txtGradeAvg.Text.Trim());

                    if (this.cbTrue.Checked)
                    {
                        stBean.St_active = "Yes";
                    }
                    else
                    {
                        stBean.St_active = "No";
                    }

                    if (stInfo.add_TemStudentData(stBean))
                    {
                        MessageBox.Show(systemMessage.TEMP_SAVE, systemMessage.MESSAGEBOXTITLE_SUCCESS, MessageBoxButtons.OK, MessageBoxIcon.Information);

                        frmStuden_Details frm_Stdetail = new frmStuden_Details();
                        globleVeriables.STU_ID = globleVeriables.STU_ID - 1;

                        frmMain frm_M = new frmMain();
                        frm_Stdetail.MdiParent = frm_M;
                        frm_M.mainPanel.Controls.Clear();
                        frm_M.mainPanel.Controls.Add(frm_Stdetail);
                        frm_M.mainPanel.Dock = DockStyle.Fill;

                        frm_Stdetail.Show();
                        // Close form
                        this.Dispose();
                    }
                    else
                    {
                        MessageBox.Show(systemMessage.TEMP_INSERT, systemMessage.MESSAGEBOXTITLE, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                {
                    globleVeriables.STU_ID = globleVeriables.STU_ID - 1;
                    if (ex.Message.Equals("Database Not Found!"))
                    {
                        MessageBox.Show(systemMessage.DATABASE_NOTFOUND, systemMessage.MESSAGEBOXTITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show(systemMessage.TEMP_INSERT, systemMessage.MESSAGEBOXTITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }



                clear_Content();
                setStudentId();
            }
        }