private void createbutton_Click(object sender, EventArgs e)
        {
            CourseRegistration           c     = new CourseRegistration();
            CourseRepository             cRepo = new CourseRepository();
            CourseRegistrationRepository d     = new CourseRegistrationRepository();
            CourseResultsRepository      rr    = new CourseResultsRepository();

            c.CourseId   = this.courseidtextBox.Text;
            c.CourseName = d.GetCourse2(this.courseidtextBox.Text).CourseName;

            c.Section   = d.GetCourse2(this.courseidtextBox.Text).Section;
            c.Semester  = d.GetCourse2(this.courseidtextBox.Text).Semester;
            c.AccountId = this.accountidtextBox.Text;
            c.Status    = "Confirmed";
            CourseRegistrationRepository cr    = new CourseRegistrationRepository();
            CourseRepository             r     = new CourseRepository();
            AccountRepository            ar    = new AccountRepository();
            StudentBalanceRepository     sRepo = new StudentBalanceRepository();
            StudentBalance sb = new StudentBalance();

            sb.AccountId = this.accountidtextBox.Text;

            try
            {
                s = ar.GetAccountTypeShovon2(c.AccountId).AccountType;
            }
            catch
            {
            }

            if (cr.CourseVerification2(c.CourseId) == this.courseidtextBox.Text && s == "Student" && cRepo.GetCourse2(this.courseidtextBox.Text).MaxStudent != cRepo.GetCourse2(this.courseidtextBox.Text).CurrentStudent)
            {
                if (cr.DoubleIDRegistrationVerify(this.accountidtextBox.Text, this.courseidtextBox.Text).Contains(this.accountidtextBox.Text))
                {
                    MessageBox.Show("Student Already In the Course ");
                }
                else
                {
                    if (cr.Insert2(c) && rr.DoReg(c.AccountId, c.CourseId, c.Semester, c.Section, c.CourseName) && sRepo.UpdateStudentBalance(sb))
                    {
                        if (r.Increase2(c.CourseId))
                        {
                            MessageBox.Show("Successful");
                        }
                        else
                        {
                            MessageBox.Show("Error Current Student Not Increased");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Error Inserting");
                    }
                }
            }
            else
            {
                MessageBox.Show("Error Course Or Student Verification");
            }
        }
Example #2
0
        private void buttonApproveDrop_Click(object sender, EventArgs e)
        {
            string fullName    = comboBoxSelectCourse.Text;
            string nameCourse  = fullName.Remove(fullName.Length - 2, 2);
            string nameSection = comboBoxSelectCourse.Text;

            nameSection = "" + nameSection[fullName.Length - 1];

            CourseResults cr = new CourseResults();

            cr.CourseName = nameCourse;
            cr.Semester   = "Spring 17-18";
            cr.Section    = nameSection;
            cr.AccountId  = comboBoxSelectStudent.Text;
            cr.Quiz       = 0;
            cr.Term       = 0;
            cr.FinalMark  = 0;
            cr.Grade      = 0;
            cr.Status     = "Drop";

            CourseResultsRepository crr = new CourseResultsRepository();

            if (crr.UpdateStatus(cr))
            {
                MessageBox.Show("Student ID dropped from the course");
            }
            else
            {
                MessageBox.Show("OOPS!!! Something went wrong");
            }
        }
        private void buttonUploadQuiz_Click(object sender, EventArgs e)
        {
            string fullName    = comboBoxSelectCourse.Text;
            string nameCourse  = fullName.Remove(fullName.Length - 2, 2);
            string nameSection = comboBoxSelectCourse.Text;

            nameSection = "" + nameSection[fullName.Length - 1];

            string selectedId = comboBoxSelectStudent.Text;

            selectedId = selectedId.Substring(0, selectedId.IndexOf(" ")).Trim();

            CourseResults cr = new CourseResults();

            cr.CourseName = nameCourse;
            cr.Section    = nameSection;
            cr.Semester   = comboBoxSelectSemester.Text;
            cr.AccountId  = selectedId;
            cr.Quiz       = (double)numericUpDownUploadQuizMark.Value;
            cr.Term       = 0;
            cr.FinalMark  = 0;
            cr.Grade      = 0;
            cr.Status     = "Active";

            CourseResultsRepository crr = new CourseResultsRepository();

            if (crr.UpdateQuizMark(cr))
            {
                MessageBox.Show("Quiz Mark uploaded Successfully");
            }
            else
            {
                MessageBox.Show("OOPS !!! Something went wr");
            }
        }
        private void DoneRegistrationClicked(object sender, EventArgs e)
        {
            string fullName   = CourseComboBox.Text;
            string nameCourse = fullName.Remove(fullName.Length - 2, 2);

            course  = nameCourse;
            section = CourseComboBox.Text;
            section = "" + section[fullName.Length - 1];

            List <Course>    cList = new List <Course>();
            CourseRepository cvr   = new CourseRepository();

            cList = cvr.GetCourseIdStudent(course, semester, section);

            string courseId = "";
            int    maxStudent = 0, currentStudent = 0;

            for (int i = 0; i < cList.Count(); i++)
            {
                courseId       = cList[i].CourseId;
                maxStudent     = cList[i].MaxStudent;
                currentStudent = cList[i].CurrentStudent;
            }

            CourseRegistrationRepository cdr = new CourseRegistrationRepository();
            CourseResultsRepository      xdr = new CourseResultsRepository();
            bool yo = xdr.DoReg(ID, courseId, semester, section, course);

            if (cdr.DoRegistration(ID, courseId, semester, section, course))
            {
                MessageBox.Show("Registration for this subject is Done", "Done");
            }
            else
            {
                MessageBox.Show("Registration for this subject is not Possible", "Error");
            }

            this.RegistrationLabel.Text += semester + ": " + course + " " + section + "\n";
        }
Example #5
0
        private void comboBoxSelectCourse_SelectedIndexChanged(object sender, EventArgs e)
        {
            buttonApproveDrop.Enabled = false;
            string fullName    = comboBoxSelectCourse.Text;
            string nameCourse  = fullName.Remove(fullName.Length - 2, 2);
            string nameSection = comboBoxSelectCourse.Text;

            nameSection = "" + nameSection[fullName.Length - 1];
            //labelUserName.Text = nameCourse+"  "+ nameSection;

            CourseResultsRepository crr   = new CourseResultsRepository();
            List <CourseResults>    cList = new List <CourseResults>();

            cList = crr.GetAllDroppedStudent("Spring 17-18", nameCourse, nameSection);

            for (int i = 0; i < cList.Count; i++)
            {
                if (cList[i].Status == "Apply Drop")
                {
                    comboBoxSelectStudent.Items.Add(cList[i].AccountId);
                }
            }
        }
        private void buttonUploadTerm_Click(object sender, EventArgs e)
        {
            string fullName    = comboBoxSelectCourse.Text;
            string nameCourse  = fullName.Remove(fullName.Length - 2, 2);
            string nameSection = comboBoxSelectCourse.Text;

            nameSection = "" + nameSection[fullName.Length - 1];

            string selectedId = comboBoxSelectStudent.Text;

            selectedId = selectedId.Substring(0, selectedId.IndexOf(" ")).Trim();

            CourseResults           cr  = new CourseResults();
            CourseResultsRepository crr = new CourseResultsRepository();

            cr.CourseName = nameCourse;
            cr.Section    = nameSection;
            cr.Semester   = comboBoxSelectSemester.Text;
            cr.AccountId  = selectedId;
            cr.Quiz       = 0;
            cr.Term       = (double)numericUpDownUploadTermMark.Value;
            cr.FinalMark  = 0;
            cr.Grade      = 0;
            cr.Status     = "Active";

            double term = cr.Term;
            double quiz = crr.GetQuizMark(cr);

            cr.FinalMark = quiz + term;

            if (cr.FinalMark >= 80)
            {
                cr.Grade = 4.00;
            }
            if (cr.FinalMark >= 70 && cr.FinalMark <= 79)
            {
                cr.Grade = 3.75;
            }
            if (cr.FinalMark >= 60 && cr.FinalMark <= 69)
            {
                cr.Grade = 3.5;
            }
            if (cr.FinalMark >= 50 && cr.FinalMark <= 59)
            {
                cr.Grade = 3.25;
            }
            if (cr.FinalMark >= 40 && cr.FinalMark <= 49)
            {
                cr.Grade = 3.0;
            }
            if (cr.FinalMark >= 30 && cr.FinalMark <= 39)
            {
                cr.Grade = 2.75;
            }
            if (cr.FinalMark < 30)
            {
                cr.Grade = 0;
            }
            if (crr.UpdateTermMark(cr))
            {
                MessageBox.Show("Term Mark uploaded Successfully");
            }
            if (!crr.UpdateTermMark(cr))
            {
                MessageBox.Show("OOPS !!! Something went wrong");
            }
        }
        private void SemesterComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            string semester = SemesterComboBox.Text;
            double count = 0, gpa, cgcount = 0, cgpa;
            int    i, n = 0, cgn = 0;

            CourseResultsRepository gr     = new CourseResultsRepository();
            List <CourseResults>    gList  = new List <CourseResults>();
            List <CourseResults>    cgList = new List <CourseResults>();

            cgList = gr.GetAllResult(ID);
            for (i = 0; i < cgList.Count; i++)
            {
                if (cgList[i].Status == "Active")
                {
                    cgcount += cgList[i].Grade;
                    cgn++;
                }
            }


            gList = gr.GetAllResult(semester, ID);
            DataTable gTable = new DataTable();

            gTable.Columns.Add("Subject", typeof(string));
            gTable.Columns.Add("Section", typeof(string));
            gTable.Columns.Add("Quiz", typeof(double));
            gTable.Columns.Add("Final", typeof(double));
            gTable.Columns.Add("Final Mark", typeof(double));
            gTable.Columns.Add("Grade", typeof(double));
            gTable.Columns.Add("Status", typeof(string));

            for (i = 0; i < gList.Count; i++)
            {
                gTable.Rows.Add(gList[i].CourseName, gList[i].Section, gList[i].Quiz, gList[i].Term, gList[i].FinalMark, gList[i].Grade, gList[i].Status);

                if (gList[i].Status == "Active")
                {
                    count += gList[i].Grade;
                    n++;
                }
            }
            gpa = count / n;
            if (n == 0)
            {
                this.GPALabel.Text = "This Semester's GPA: None";
            }
            else
            {
                this.GPALabel.Text = "This Semester's GPA: " + string.Format("{0:0.00}", gpa);
                //this.GPALabel.Text = "This Semester's GPA: " + gpa;
            }

            cgpa = cgcount / cgn;
            if (cgn == 0)
            {
                this.CGPALabel.Text = "Total CGPA: None";
            }
            else
            {
                this.CGPALabel.Text = "Total CGPA: " + string.Format("{0:0.00}", cgpa);
                //this.CGPALabel.Text = "This Semester's GPA: " + cgpa;
            }
            ResultGridView.DataSource = gTable;
            ResultGridView.ReadOnly   = true;
        }