コード例 #1
0
        private void addStudentToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Add_Student addStudent = new Add_Student();

            this.Hide();
            addStudent.Show();
        }
コード例 #2
0
        private void picBxAddNew_Click(object sender, EventArgs e)
        {
            Add_Student add_new = new  Add_Student();

            this.Hide();
            add_new.Show();
        }
コード例 #3
0
        private void studentsGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            selected = studentsGridView1.CurrentCell.RowIndex;
            DataGridViewRow row = studentsGridView1.Rows[selected];

            if (e.ColumnIndex == 8)
            {
                GeneralID.selectedObjectid = (int)row.Cells[0].Value;
                Add_Student add = new Add_Student();
                this.Hide();
                add.Show();
            }
            else if (e.ColumnIndex == 9)
            {
                DialogResult dr = MessageBox.Show("Are you sure want delete this Student", "Delete Student", MessageBoxButtons.OKCancel,
                                                  MessageBoxIcon.Question);

                if (dr == DialogResult.OK)
                {
                    int selectId = (int)row.Cells[0].Value;

                    string deleteStudentGroup = string.Format("delete GroupStudent where StudentId='{0}'", selectId);
                    DataBaseConnection.getInstance().executeQuery(deleteStudentGroup);
                    string deleteStudentQuery = string.Format("delete Student where Id='{0}'", selectId);
                    DataBaseConnection.getInstance().executeQuery(deleteStudentQuery);


                    string deletePersonQuery = string.Format("delete Person where Id='{0}'", selectId);
                    DataBaseConnection.getInstance().executeQuery(deletePersonQuery);


                    MessageBox.Show("Student deleted Successfully");
                    this.load_data_in_gridview();
                }
            }
        }