Ejemplo n.º 1
0
        private void AssignClicked(object sender, EventArgs e)
        {
            CourseAssign s = new CourseAssign();

            string[] acc = this.comboBoxAccount.Text.Split(' ');
            s.AccountId      = acc[0];
            s.AssignedCourse = this.comboBoxAssignedCourse.Text;
            s.Section        = this.comboBoxSection.Text;
            s.Semester       = this.comboBoxSemesterName.Text;
            Course c = new Course();

            c.Name     = this.comboBoxAssignedCourse.Text;
            c.Section  = this.comboBoxSection.Text;
            c.Semester = this.comboBoxSemesterName.Text;

            CourseAssignRepository aRepo = new CourseAssignRepository();
            CourseRepository       cRepo = new CourseRepository();

            if (cRepo.CheckCourse2(c))
            {
                if (aRepo.CheckAssignedCourse2(s))
                {
                    if (aRepo.Insert2(s))
                    {
                        MessageBox.Show("One Course Assigned", "Successful");
                    }
                    else
                    {
                        MessageBox.Show("Operation Failed", "Failed");
                    }
                }
                else
                {
                    MessageBox.Show("Already Exists", "Failed");
                }
            }
            else
            {
                MessageBox.Show("Invalid Course", "Failed");
            }
        }