Example #1
0
        private void StudentsdataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            selected = StudentsdataGridView.CurrentCell.RowIndex;
            DataGridViewRow row           = StudentsdataGridView.Rows[selected];
            string          searchStudent = String.Format("select * from CourseDMC where StudentId='{0}'", row.Cells[0].Value);
            var             allCourses    = DataBaseConnection.getInstance().readData(searchStudent);
            Student         s             = new Student();

            s.RegisterationNumber1 = row.Cells[0].Value.ToString();
            s.Name1   = row.Cells[1].Value.ToString();
            s.Degree1 = row.Cells[2].Value.ToString().Trim();
            while (allCourses.Read())
            {
                CourseResult result = new CourseResult();
                result.CourseId1    = allCourses.GetString(0).Trim();
                result.CourseTitle1 = allCourses.GetString(1);
                result.CreditHours1 = (int)allCourses.GetValue(2);
                result.Marks1       = (int)allCourses.GetValue(3);
                result.Semester1    = (int)allCourses.GetValue(4);
                s.Courses2.Add(result);
            }
            Section.getInstance().addStudent(s);
            if (e.ColumnIndex == 4)
            {
                AddStudent editStudent = new AddStudent();
                this.Hide();
                editStudent.Show();
            }
            if (e.ColumnIndex == 5)
            {
                ShowDMC dmc = new ShowDMC();
                dmc.Show();
            }
        }
Example #2
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            AddStudent addStudent = new AddStudent();

            this.Hide();
            addStudent.Show();
        }
Example #3
0
        private void cmdCancel_Click(object sender, EventArgs e)
        {
            AddStudent addStudent = new AddStudent();

            this.Hide();
            addStudent.Show();
        }
Example #4
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            if (this.validateCourses())
            {
                if (isEditeMode)
                {
                    foreach (CourseResult find in Section.getInstance().ListofStudents().Last().Courses2)
                    {
                        if (find.CourseId1 == Section.getInstance().ListofStudents().ElementAt(secondaLast).Courses2.Last().CourseId1&&
                            find.CourseTitle1 == Section.getInstance().ListofStudents().ElementAt(secondaLast).Courses2.Last().CourseTitle1&&
                            find.CreditHours1 == Section.getInstance().ListofStudents().ElementAt(secondaLast).Courses2.Last().CreditHours1&&
                            find.Semester1 == Section.getInstance().ListofStudents().ElementAt(secondaLast).Courses2.Last().Semester1&&
                            find.Marks1 == Section.getInstance().ListofStudents().ElementAt(secondaLast).Courses2.Last().Marks1)
                        {
                            find.CourseId1    = txtBxCourseId.Text;
                            find.CourseTitle1 = txtCourseTitle.Text;
                            find.CreditHours1 = int.Parse(cmbCreditHour.Text);
                            find.Semester1    = int.Parse(cmbSemester.Text);
                            find.Marks1       = int.Parse(txtMarks.Text);
                            break;
                        }
                    }
                }
                else
                {
                    CourseResult result = new CourseResult();
                    result.CourseId1    = txtBxCourseId.Text;
                    result.CourseTitle1 = txtCourseTitle.Text;
                    result.CreditHours1 = int.Parse(cmbCreditHour.Text);
                    result.Semester1    = int.Parse(cmbSemester.Text);
                    result.Marks1       = int.Parse(txtMarks.Text);
                    Section.getInstance().ListofStudents().Last().Courses2.Add(result);
                }

                AddStudent addStudent = new AddStudent();
                this.Hide();
                addStudent.Show();
            }
        }