Esempio n. 1
0
        private void createGroupToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Make_Group createGroup = new Make_Group();

            this.Hide();
            createGroup.Show();
        }
Esempio n. 2
0
        private void picBxAddNew_Click(object sender, EventArgs e)
        {
            Make_Group make_group = new Make_Group();

            this.Hide();
            make_group.Show();
        }
Esempio n. 3
0
        private void showStudentGroupsGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            selectedrow = showStudentGroupsGridView.CurrentCell.RowIndex;
            DataGridViewRow row = showStudentGroupsGridView.Rows[selectedrow];

            if (e.ColumnIndex == 4)
            {
                GeneralID.selectedObjectid = (int)row.Cells[0].Value;
                Make_Group makeGroup = new Make_Group();
                this.Hide();
                makeGroup.Show();
            }
            else if (e.ColumnIndex == 5)
            {
                DialogResult dr = MessageBox.Show("Are you sure want remove this Student from  Group", "Remove Student", MessageBoxButtons.OKCancel,
                                                  MessageBoxIcon.Question);

                if (dr == DialogResult.OK)
                {
                    string selectStudent      = row.Cells[1].Value.ToString();
                    string deleteStudentQuery = string.Format("delete GroupStudent where StudentId=(select Id from Student where RegistrationNo='{0}')", selectStudent);
                    DataBaseConnection.getInstance().executeQuery(deleteStudentQuery);

                    //if group students delete then total group remove
                    int    groupId      = (int)row.Cells[0].Value;
                    string query        = string.Format("select count(StudentId) from GroupStudent where GroupId='{0}'", groupId);
                    int    countStudent = DataBaseConnection.getInstance().getRowsCount(query);
                    if (countStudent == 0)
                    {
                        string deleteGroupProject = string.Format("delete GroupProject where GroupId='{0}'", groupId);
                        DataBaseConnection.getInstance().executeQuery(deleteGroupProject);
                        string deleteGroupEvaluation = string.Format("delete GroupEvaluation where GroupId='{0}'", groupId);
                        DataBaseConnection.getInstance().executeQuery(deleteGroupEvaluation);
                        string deleteTotalGroup = string.Format("delete [Group] where Id='{0}'", groupId);
                        DataBaseConnection.getInstance().executeQuery(deleteTotalGroup);
                        MessageBox.Show("Total group remove as Group Empty");
                    }

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