Ejemplo n.º 1
0
        public ActionResult EnrollemntUp()
        {
            if (TempData["fileName"] != null)
            {
                string            fileName = (string)TempData["fileName"];
                var               engine   = new FileHelperEngine <EnrollementVM>();
                var               records  = engine.ReadFile(fileName);
                List <Enrollment> enrols   = new List <Enrollment>();
                foreach (var rec in records)
                {
                    if (db.Enrollments.Any(e => e.SectionID == rec.SectionID && e.Student_ID == rec.StudentID))
                    {
                        var enrol1 = db.Enrollments.First(e => e.SectionID == rec.SectionID && e.Student_ID == rec.StudentID);
                        db.Enrollments.Remove(enrol1);
                        db.SaveChanges();
                        rec.CourseCode = rec.CourseCode + "Duplicate";
                    }
                    var enrol = new Enrollment()
                    {
                        EnrollmentDate = DateTime.Now, SectionID = rec.SectionID, Student_ID = rec.StudentID, Status = rec.Status
                    };
                    db.Enrollments.Add(enrol);
                    db.SaveChanges();
                    //enrols.Add(enrol);
                }
                //db.Enrollments.AddRange(enrols);
                //db.SaveChanges();

                return(View(records));
            }
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult Uploaded()
        {
            if (TempData["fileName"] != null && TempData["GradeDistributionID"] != null)
            {
                string fileName    = (string)TempData["fileName"];
                int    GradeDistID = (int)TempData["GradeDistributionID"];
                var    engine      = new FileHelperEngine <GradeItemVM>();
                var    records     = engine.ReadFile(fileName);
                //List<GradeItem> enrols = new List<GradeItem>();
                int assessTypeId;
                foreach (var rec in records)
                {
                    assessTypeId = db.AssessmentTypes.Where(x => x.Type == rec.AssessType).FirstOrDefault().AssessmentTypeID;
                    var GrItem = new GradeItem()
                    {
                        AssessmentTypeID = assessTypeId, AssessmentTNo = rec.Number, CrNo = rec.Criterion, GradeDistributionID = GradeDistID, Weight = rec.Weight, Name = rec.Code
                    };
                    db.GradeItems.Add(GrItem);
                    db.SaveChanges();
                    //enrols.Add(enrol);
                }
                //db.Enrollments.AddRange(enrols);
                //db.SaveChanges();

                return(View(records));
            }
            return(View());
        }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "AssessmentTypeID,Type")] AssessmentType assessmentType)
        {
            if (ModelState.IsValid)
            {
                db.AssessmentTypes.Add(assessmentType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(assessmentType));
        }
Ejemplo n.º 4
0
        public ActionResult Create([Bind(Include = "SemesterID,Name,year,ShortName,StartDate,EndDate")] Semester semester)
        {
            if (ModelState.IsValid)
            {
                db.Semesters.Add(semester);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(semester));
        }
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "DepartmentID,Name,FullName")] Department department)
        {
            if (ModelState.IsValid)
            {
                db.Departments.Add(department);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(department));
        }
Ejemplo n.º 6
0
        public ActionResult Create([Bind(Include = "GradeDistributionID,Name,EffectiveDate")] GradeDistribution gradeDistribution)
        {
            if (ModelState.IsValid)
            {
                db.GradeDistributions.Add(gradeDistribution);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(gradeDistribution));
        }
Ejemplo n.º 7
0
        public ActionResult Create([Bind(Include = "LetterGradeID,Grade,MinGrade,MaxGrade")] LetterGrade letterGrade)
        {
            if (ModelState.IsValid)
            {
                db.LetterGrades.Add(letterGrade);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(letterGrade));
        }
Ejemplo n.º 8
0
        public ActionResult Create([Bind(Include = "CourseID,Code,Title,Credits,DepartmentID")] Course course)
        {
            if (ModelState.IsValid)
            {
                db.Courses.Add(course);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "Name", course.DepartmentID);
            return(View(course));
        }
Ejemplo n.º 9
0
        public ActionResult Create([Bind(Include = "LOID,LearningOutcome,LODesc,DepartmentID")] LO lO)
        {
            if (ModelState.IsValid)
            {
                db.LOs.Add(lO);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "Name", lO.DepartmentID);
            return(View(lO));
        }
Ejemplo n.º 10
0
        public ActionResult Create([Bind(Include = "InstructorID,FirstMidName,LastName,DepartmentID,HireDate")] Instructor instructor)
        {
            if (ModelState.IsValid)
            {
                db.Instructors.Add(instructor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "Name", instructor.DepartmentID);
            return(View(instructor));
        }
Ejemplo n.º 11
0
        public ActionResult Create([Bind(Include = "StudentID,FirstMidName,LastName,DepartmentID,EnrollmentDate,Status")] Student student)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(student);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "Name", student.DepartmentID);
            return(View(student));
        }
Ejemplo n.º 12
0
        public ActionResult ScaleGradesto4()
        {
            //db.AssessmentGrades.SqlQuery("UPDATE AssessmentGrades set Grade4 = Grade where GradeS IS NULL");
            //db.AssessmentGrades.SqlQuery("UPDATE AssessmentGrades set Grade4 = Round(4*GradeS/100,0) where GradeS IS NOT NULL");
            db.Database.ExecuteSqlCommand("UPDATE AssessmentGrades set Grade4 = Grade where GradeS IS NULL");
            db.Database.ExecuteSqlCommand("UPDATE AssessmentGrades set Grade4 = CEILING(GradeS/25) where GradeS IS NOT NULL");
            db.SaveChanges();
            //db.AssessmentGrades.Where(x => x.GradeS.HasValue).ForEachAsync(w => w.Grade4 = Math.Round(4*w.GradeS.Value/100));
            //db.AssessmentGrades.Where(x => !x.GradeS.HasValue).ForEachAsync(w => w.Grade4 = w.Grade);


            db.SaveChanges();
            return(RedirectToAction("PIResults"));
        }
Ejemplo n.º 13
0
        public ActionResult Create([Bind(Include = "SectionID,Code,CourseID,SemesterID,Room,ClassInstructorID,LabInstructorID,GradeDistributionID")] Section section)
        {
            if (ModelState.IsValid)
            {
                db.Sections.Add(section);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ClassInstructorID   = new SelectList(db.Instructors, "InstructorID", "FirstMidName", section.ClassInstructorID);
            ViewBag.CourseID            = new SelectList(db.Courses, "CourseID", "Code", section.CourseID);
            ViewBag.GradeDistributionID = new SelectList(db.GradeDistributions, "GradeDistributionID", "Name", section.GradeDistributionID);
            ViewBag.LabInstructorID     = new SelectList(db.Instructors, "InstructorID", "FirstMidName", section.LabInstructorID);
            ViewBag.SemesterID          = new SelectList(db.Semesters, "SemesterID", "ShortName", section.SemesterID);
            return(View(section));
        }
Ejemplo n.º 14
0
        public ActionResult Uploaded()
        {
            if (TempData["fileName"] != null)
            {
                string fileName = (string)TempData["fileName"];
                var    engine   = new FileHelperEngine <EnrollVM>();
                var    records  = engine.ReadFile(fileName);
                foreach (var rec in records)
                {
                    var en = new Enroll()
                    {
                        EnrollmentDate = DateTime.Now, SectionID = rec.CRN, StudentID = rec.StudentId, Status = rec.Status
                    };
                    db.Enrolls.Add(en);
                    db.SaveChanges();
                }

                return(View(records));
            }
            return(View());
        }
Ejemplo n.º 15
0
        public ActionResult Uploaded()
        {
            if (TempData["fileName"] != null)
            {
                string fileName = (string)TempData["fileName"];
                var    engine   = new FileHelperEngine <GradeVM>();
                var    records  = engine.ReadFile(fileName);
                int    EnrId;
                int    GradeDistId;
                int    grItem;
                foreach (var rec in records)
                {
                    //EnrId = db.Enrolls.Where(x => x.SectionID == rec.CRN && x.StudentID == rec.StudentId).FirstOrDefault().EnrollID;
                    var enr = db.Enrolls.Where(x => x.SectionID == rec.CRN && x.StudentID == rec.StudentId).FirstOrDefault();
                    //GradeDistId = db.Sections.Where(x => x.SectionID == rec.CRN).FirstOrDefault().GradeDistributionID;
                    GradeDistId = enr.Section.GradeDistributionID;
                    var Item = db.GradeItems.Where(x => x.Name == rec.Code && x.GradeDistributionID == GradeDistId).FirstOrDefault();
                    if (Item == null)
                    {
                        continue;
                    }
                    grItem = Item.GradeItemID;
                    if (db.AssessmentGrades.Any(x => x.GradeItemID == grItem && x.EnrollID == enr.EnrollID))
                    {
                        continue;
                    }
                    var gr = new AssessmentGrade()
                    {
                        EnrollID = enr.EnrollID, Grade = rec.Grade, GradeItemID = grItem, GradeS = rec.GradeS
                    };
                    db.AssessmentGrades.Add(gr);
                    db.SaveChanges();
                }

                return(View(records));
            }
            return(View());
        }
Ejemplo n.º 16
0
        public ActionResult Uploaded()
        {
            if (TempData["fileName"] != null && TempData["DepartmentID"] != null)
            {
                string fileName     = (string)TempData["fileName"];
                int    DepartmentID = (int)TempData["DepartmentID"];
                var    engine       = new FileHelperEngine <PIVM>();
                var    records      = engine.ReadFile(fileName);
                int    LOId;
                foreach (var rec in records)
                {
                    LOId = db.LOs.Where(x => x.DepartmentID == DepartmentID && x.LearningOutcome == rec.SO).FirstOrDefault().LOID;
                    var pi = new PI()
                    {
                        LOID = LOId, PILetter = rec.PI, PIDesc = rec.desc, PINo = rec.Number
                    };
                    db.PIs.Add(pi);
                    db.SaveChanges();
                }

                return(View(records));
            }
            return(View());
        }