コード例 #1
0
        private void DeleteClicked(object sender, EventArgs e)
        {
            ExamRepository eRepo = new ExamRepository();

            string[] acc2 = this.comboBoxCourseId.Text.Split(' ');
            if (eRepo.Delete2(acc2[0]) != 0)
            {
                MessageBox.Show("One Exam Deleted", "Successful");
                this.dataGridViewExam.DataSource = eRepo.GetAllExams2();
            }
            else
            {
                MessageBox.Show("Exam For This Course ID Doesn't Exists", "Failed");
            }
        }
コード例 #2
0
        public ExamInfo()
        {
            InitializeComponent();

            SemesterRepository sRepo = new SemesterRepository();

            this.comboBoxSemesterName.DataSource = sRepo.GetAllSemesterNames2();

            CourseRepository cRepo = new CourseRepository();

            this.comboBoxCourseId.DataSource = cRepo.GetCourseIdNameSectionsBySemester2(this.comboBoxSemesterName.Text);

            AccountRepository aRepo = new AccountRepository();

            this.comboBoxFacultyId.DataSource = aRepo.GetAccountIdAndNames2("Faculty");

            ExamRepository eRepo = new ExamRepository();

            this.dataGridViewExam.DataSource = eRepo.GetAllExams2();
        }
コード例 #3
0
        private void AddClicked(object sender, EventArgs e)
        {
            Exam   ex = new Exam();
            Course c  = new Course();

            string[] acc  = this.comboBoxFacultyId.Text.Split(' ');
            string[] acc2 = this.comboBoxCourseId.Text.Split(' ');
            ex.CourseId = acc2[0];
            c.CourseId  = acc2[0];
            ex.Semester = this.comboBoxSemesterName.Text;
            c.Semester  = this.comboBoxSemesterName.Text;
            ex.Room     = this.textBoxRoom.Text;

            if (this.radioButton1.Checked)
            {
                ex.Day = this.radioButton1.Text;
            }
            else if (this.radioButton2.Checked)
            {
                ex.Day = this.radioButton2.Text;
            }
            else if (this.radioButton3.Checked)
            {
                ex.Day = this.radioButton3.Text;
            }
            else if (this.radioButton4.Checked)
            {
                ex.Day = this.radioButton4.Text;
            }
            else if (this.radioButton5.Checked)
            {
                ex.Day = this.radioButton5.Text;
            }
            else
            {
                ex.Day = this.radioButton6.Text;
            }

            if (this.radioButtonSlot1.Checked)
            {
                ex.Slot = this.radioButtonSlot1.Text;
            }
            else if (this.radioButtonSlot2.Checked)
            {
                ex.Slot = this.radioButtonSlot2.Text;
            }
            else if (this.radioButtonSlot3.Checked)
            {
                ex.Slot = this.radioButtonSlot3.Text;
            }
            else
            {
                ex.Slot = this.radioButtonSlot4.Text;
            }

            ex.AssignedFacultyId = acc[0];

            ExamRepository   eRepo = new ExamRepository();
            CourseRepository cRepo = new CourseRepository();

            if (eRepo.CheckExamCourseId2(ex.CourseId) == false)
            {
                if (cRepo.CheckCourseIdAndSemesterName2(c))
                {
                    if (ex.Room != "" && eRepo.Insert2(ex))
                    {
                        MessageBox.Show("One Exam Added", "Successful");
                        this.dataGridViewExam.DataSource = eRepo.GetAllExams2();
                    }
                    else
                    {
                        MessageBox.Show("Fill All The Fields", "Failed");
                    }
                }
                else
                {
                    MessageBox.Show("There Is No Such Course In This Semester", "Failed");
                }
            }
            else
            {
                MessageBox.Show("Exam For This Course ID Already Exists", "Failed");
            }
        }
コード例 #4
0
        private void RefreshClicked(object sender, EventArgs e)
        {
            ExamRepository eRepo = new ExamRepository();

            this.dataGridViewExam.DataSource = eRepo.GetAllExams2();
        }