public ActionResult Create([Bind(Include = "NextStudentNumberId,NextAvailableNumber")] NextStudentNumber nextStudentNumber)
        {
            if (ModelState.IsValid)
            {
                db.NextStudentNumbers.Add(nextStudentNumber);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(nextStudentNumber));
        }
        public ActionResult Create([Bind(Include = "ProgramId,ProgramAcronym,Description")] Program program)
        {
            if (ModelState.IsValid)
            {
                db.Programs.Add(program);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(program));
        }
        public ActionResult Create([Bind(Include = "GPAStateId,LowerLimit,UpperLimit,TuitionRateFactor")] RegularState regularState)
        {
            if (ModelState.IsValid)
            {
                db.GPAStates.Add(regularState);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(regularState));
        }
        //public ActionResult Create([Bind(Include = "NextAuditCourseId,NextAvailableNumber")] NextAuditCourse nextAuditCourse) original line
        public ActionResult Create([Bind(Include = "NextAuditCourseId,GradedCourse.setNextCourseNumber()")] NextAuditCourse nextAuditCourse)
        {
            if (ModelState.IsValid)
            {
                db.NextAuditCourses.Add(nextAuditCourse);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(nextAuditCourse));
        }
        public ActionResult Create([Bind(Include = "NextMasteryCourseId,NextAvailableNumber")] NextMasteryCourse nextMasteryCourse)
        {
            if (ModelState.IsValid)
            {
                db.NextMasteryCourses.Add(nextMasteryCourse);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(nextMasteryCourse));
        }
Esempio n. 6
0
        public ActionResult Create([Bind(Include = "CourseId,ProgramId,CourseNumber,Title,CreditHours,TuitionAmount,Notes")] Course course)
        {
            if (ModelState.IsValid)
            {
                db.Courses.Add(course);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ProgramId = new SelectList(db.Programs, "ProgramId", "ProgramAcronym", course.ProgramId);
            return(View(course));
        }
        public ActionResult Create([Bind(Include = "CourseId,ProgramId,Title,CreditHours,TuitionAmount,Notes")] AuditCourse auditCourse)
        {
            if (ModelState.IsValid)
            {
                db.Courses.Add(auditCourse);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ProgramId = new SelectList(db.Programs, "ProgramId", "Description", auditCourse.ProgramId);
            return(View(auditCourse));
        }
        public ActionResult Create([Bind(Include = "StudentCardId,CardNumber,StudentId")] StudentCard studentCard)
        {
            if (ModelState.IsValid)
            {
                db.StudentCards.Add(studentCard);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.StudentId = new SelectList(db.Students, "StudentId", "FullName", studentCard.StudentId);
            return(View(studentCard));
        }
Esempio n. 9
0
        public ActionResult Create([Bind(Include = "RegistrationId,StudentId,CourseId,RegistrationDate,Grade,Notes")] Registration registration)
        {
            if (ModelState.IsValid)
            {
                db.Registrations.Add(registration);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CourseId  = new SelectList(db.Courses, "CourseId", "Title", registration.CourseId);
            ViewBag.StudentId = new SelectList(db.Students, "StudentId", "FullName", registration.StudentId);
            return(View(registration));
        }
Esempio n. 10
0
        public ActionResult Create([Bind(Include = "StudentId,GPAStateId,ProgramId,StudentNumber,FirstName,LastName,Address,City,Province,PostalCode,DateCreated,GradePointAverage,OutstandingFees,Notes")] Student student)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(student);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.GPAStateId = new SelectList(db.GPAStates, "GPAStateId", "GPAStateId", student.GPAStateId);
            ViewBag.ProgramId  = new SelectList(db.Programs, "ProgramId", "ProgramAcronym", student.ProgramId);
            return(View(student));
        }
Esempio n. 11
0
        public ActionResult Create([Bind(Include = "CourseId,ProgramId,Title,CreditHours,TuitionAmount,Notes,AssignmentWeight,MidtermWeight,FinalWeight")] GradedCourse gradedCourse)
        //public ActionResult Create([Bind(Include = "CourseId,ProgramId,CourseNumber,Title,CreditHours,TuitionAmount,Notes,AssignmentWeight,MidtermWeight,FinalWeight")] GradedCourse gradedCourse)
        {
            if (ModelState.IsValid)
            {
                gradedCourse.setNextCourseNumber(); //is this right
                db.Courses.Add(gradedCourse);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ProgramId = new SelectList(db.Programs, "ProgramId", "Description", gradedCourse.ProgramId);
            return(View(gradedCourse));
        }
Esempio n. 12
0
        /// <summary>
        /// Performs the appropriate operation of CollegeRegistration dependent on what type of transaction it is.
        /// </summary>
        /// <param name="transactionRecords"></param>
        private void processTransactions(IEnumerable <XElement> transactionRecords)
        {
            //Loop through each transaction and grab each child element value
            foreach (XElement node in transactionRecords)
            {
                string typeValue               = node.Element("type").Value;
                string studentNumberValue      = node.Element("student_no").Value;
                string courseNumberValue       = node.Element("course_no").Value;
                string registrationNumberValue = node.Element("registration_no").Value;
                string gradeValue              = node.Element("grade").Value;
                string notes = node.Element("notes").Value;

                //Parse numerical values
                long studentNumberParsed = long.Parse(studentNumberValue);

                //If the type is 1 (registration), then register the course for the student
                if (typeValue.Equals("1") && registrationNumberValue.Equals("*") && gradeValue.Equals("*"))
                {
                    int?courseID = (from results
                                    in db.Courses
                                    where results.CourseNumber == courseNumberValue
                                    select results.CourseId).SingleOrDefault();

                    int?studentID = (from results
                                     in db.Students
                                     where results.StudentNumber == studentNumberParsed
                                     select results.StudentId).SingleOrDefault();

                    if (studentID != null && courseID != null)
                    {
                        int course  = (int)courseID;
                        int student = (int)studentID;
                        ServiceReference.CollegeRegistrationClient localWS = new ServiceReference.CollegeRegistrationClient();
                        int returnCode = localWS.registerCourse(student, course, notes);
                        db.SaveChanges();

                        //Successful registration
                        if (returnCode == 0)
                        {
                            logData += "Successful registration for student number: " + studentNumberValue + ". Course selected: " + courseNumberValue + "\r\n";
                        }

                        //Failed Registrations
                        else if (returnCode == -100 || returnCode == -200 || returnCode == -300)
                        {
                            logData += registerError(returnCode);
                        }

                        //Unknown error when registering
                        else
                        {
                            logData += registerError(returnCode);
                        }
                    }
                }

                //If the type is 2 (grading), then update the grade
                else if (typeValue.Equals("2") && !registrationNumberValue.Equals("*") && !gradeValue.Equals("*"))
                {
                    double gradeParsed        = (double.Parse(gradeValue)) / 100;
                    long   registrationParsed = long.Parse(registrationNumberValue);

                    int?registrationID = (from results
                                          in db.Registrations
                                          where results.RegistrationNumber == registrationParsed
                                          select results.RegistrationId).SingleOrDefault();


                    //If the grade is within range
                    if (gradeParsed >= 0 && gradeParsed <= 1 && registrationID != null)
                    {
                        int registration = (int)registrationID;
                        ServiceReference.CollegeRegistrationClient localWS = new ServiceReference.CollegeRegistrationClient();

                        try
                        {
                            localWS.updateGrade(gradeParsed, registration, notes);
                            db.SaveChanges();
                            logData += "Grade " + gradeValue + " applied to student " + studentNumberValue + " for registration " + registrationNumberValue + "\r\n";
                        }
                        catch (Exception)
                        {
                            logData += "Problem with transaction: update for " + registrationNumberValue + " was unsuccessful\r\n";
                        }
                    }
                }
            }
        }