public List <Course> getAssignedFoundationCourses(string studentId, string ctlg, string mjr)
        {
            var           result = "";
            List <Course> list   = new List <Course>();

            using (CPSCreationEntities db = new CPSCreationEntities())
            {
                var student = db.StudentDetails.Where(o => o.studentID.ToLower().Equals(studentId));
                if (student.Any())
                {
                    result = student.FirstOrDefault().AssignedFoundation;
                }
            }

            if (!result.Equals("None") && !result.Equals(""))
            {
                List <string> str = result.Split(',').ToList();
                foreach (string c in str)
                {
                    string cShrtName = c;
                    Course crs       = getCourseDetailUsingCourseShortName(c, ctlg, mjr);
                    list.Add(crs);
                }
            }
            return(list);
        }
Esempio n. 2
0
        public void updateStudentDetails(string studentId, List <Course> assignedFoundationClasses, string facultyAd)
        {
            string        cShtName;
            List <string> list = new List <string>();
            string        foundationsString = "";

            if (assignedFoundationClasses != null)
            {
                foreach (Course c in assignedFoundationClasses)
                {
                    cShtName = c.CourseShortName;
                    list.Add(cShtName);
                }

                foundationsString = string.Join(",", list.ToArray());
            }

            using (CPSCreationEntities db = new CPSCreationEntities())
            {
                var result = db.StudentDetails.SingleOrDefault(b => b.studentID == studentId);
                if (result != null)
                {
                    result.AssignedFoundation     = foundationsString;
                    result.AssignedFacultyAdvisor = facultyAd;
                    db.SaveChanges();
                }
            }
        }//end of updateStudentDetails
        }//getCourseDetailsUsingCourseShortName

        public List <List <Course> > getAllCompletedCourseDetails(string studentId, string ctlg, string mjr)
        {
            List <List <Course> > list = new List <List <Course> >();

            List <Course> completedCoreCourses       = new List <Course>();
            List <Course> completedElectiveCourses   = new List <Course>();
            List <Course> completedFoundationCourses = new List <Course>();
            var           result = "";


            using (CPSCreationEntities db = new CPSCreationEntities())
            {
                var student = db.StudentDetails.Where(o => o.studentID.ToLower().Equals(studentId));
                if (student.Any())
                {
                    result = student.FirstOrDefault().completedCoursesAndGrades;
                }
            }

            if (result != null)
            {
                List <string> str   = result.Split('|').ToList();
                List <string> spStr = new List <string>();

                foreach (string c in str)
                {
                    spStr = c.Split(',').ToList();

                    string csSname = spStr[0];
                    string csGrade = spStr[1];
                    string csSem   = spStr[2];

                    Course crs  = getCourseDetailUsingCourseShortName(csSname, ctlg, mjr);
                    string type = crs.CourseType;

                    if (crs.CourseType.Equals("C"))
                    {
                        Course coreCs = new Course(csSname, crs.CourseFullName, crs.CourseSubject, crs.Courselevel, crs.CreditHrs, crs.CourseType, csSem, csGrade);
                        completedCoreCourses.Add(coreCs);
                    }
                    else if (crs.CourseType.Equals("F"))
                    {
                        Course coreCs = new Course(csSname, crs.CourseFullName, crs.CourseSubject, crs.Courselevel, crs.CreditHrs, crs.CourseType, csSem, csGrade);
                        completedFoundationCourses.Add(coreCs);
                    }
                    else if (crs.CourseType.Equals("E"))
                    {
                        Course coreCs = new Course(csSname, crs.CourseFullName, crs.CourseSubject, crs.Courselevel, crs.CreditHrs, crs.CourseType, csSem, csGrade);
                        completedElectiveCourses.Add(coreCs);
                    }
                }

                list.Add(completedFoundationCourses);
                list.Add(completedCoreCourses);
                list.Add(completedElectiveCourses);
            }
            return(list);
        }//get all completedCourseDetails
Esempio n. 4
0
        public List <String> getAllElectiveForSWEN()
        {
            using (CPSCreationEntities db = new CPSCreationEntities())
            {
                var results = db.Catalog16_17.Where(p => p.SWEN.Contains("E")).Select(p => new
                {
                    p.Course
                }).Cast <string>().ToList();;

                return(results);
            }
        }
Esempio n. 5
0
        public string getStudentFirstName(string id)
        {
            using (CPSCreationEntities db = new CPSCreationEntities())
            {
                var student = db.StudentDetails.Where(o => o.studentID.ToLower().Equals(id));
                if (student.Any())
                {
                    return(student.FirstOrDefault().firstName);
                }
            }

            return("");
        }
Esempio n. 6
0
 public string getStudentMajor(string studentId)
 {
     using (CPSCreationEntities db = new CPSCreationEntities())
     {
         var student = db.StudentDetails.Where(o => o.studentID.ToLower().Equals(studentId));
         if (student.Any())
         {
             return(student.FirstOrDefault().majorName);
         }
         else
         {
             return(String.Empty);
         }
     }
 }
Esempio n. 7
0
 public string GetFacultyNameByID(string id)
 {
     using (CPSCreationEntities db = new CPSCreationEntities())
     {
         var res = db.FacultyDetails.Where(o => o.FacultyId.Equals(id));
         if (res.Any())
         {
             return(res.SingleOrDefault().First_Name + " " + res.SingleOrDefault().Last_Name);
         }
         else
         {
             return(null);
         }
     }
 }
Esempio n. 8
0
        public List <Course> getAllElectiveDetailsForSWEN()
        {
            using (CPSCreationEntities db = new CPSCreationEntities())
            {
                var results = db.Catalog16_17.Where(p => p.SWEN.Contains("E")).Select(p => new Course
                {
                    CourseShortName = p.Course,
                    CourseFullName  = p.LongTitle,
                    CourseSubject   = p.Subject,
                    Courselevel     = p.Catalog,
                    CreditHrs       = p.creditHrs
                }).ToList();

                return(results);
            }
        }
Esempio n. 9
0
        }//end of istheStudentNew

        public bool doesStudentExist(string studentId)
        {
            bool flag = false;

            using (CPSCreationEntities db = new CPSCreationEntities())
            {
                var student = db.StudentDetails.Where(o => o.studentID.ToLower().Equals(studentId));
                if (student.Any())
                {
                    if (student.FirstOrDefault().studentID == studentId)
                    {
                        flag = true;
                    }
                    else
                    {
                        flag = false;
                    }
                }
            }
            return(flag);
        }
Esempio n. 10
0
        public List <string> getAllFacultyAdvisorForDepartment(string major)
        {
            List <String> list = new List <string>();
            String        str  = "";

            using (CPSCreationEntities db = new CPSCreationEntities())
            {
                var results = db.FacultyDetails.Where(p => p.AdvisorDepartment.Contains(major)).Select(p => new FacultyDetails
                {
                    FirstName = p.First_Name,
                    LastName  = p.Last_Name,
                    FacultyId = p.FacultyId,
                }).ToList();

                foreach (FacultyDetails f in results)
                {
                    str = f.FirstName + " " + f.LastName;
                    list.Add(str);
                }
                return(list);
            }
        }
Esempio n. 11
0
        }//end of updateStudentDetails

        public void updateFacultyDetails(string studentId, string facultyName)
        {
            string firstNameFaculty = "";

            string[] words = facultyName.Split(' ');
            firstNameFaculty = words[0];
            string studentListStr = studentId + ",";

            using (CPSCreationEntities db = new CPSCreationEntities())
            {
                Boolean flag   = false;
                var     result = db.FacultyDetails.SingleOrDefault(b => b.First_Name == firstNameFaculty);
                if (result != null)
                {
                    var check = result.AdvisingStudentList;
                    if (check != null)
                    {
                        flag = true;
                    }

                    if (flag)
                    {
                        if (result.AdvisingStudentList.Contains(studentListStr))
                        {
                            result.AdvisingStudentList = result.AdvisingStudentList;
                        }
                        else
                        {
                            result.AdvisingStudentList += studentListStr;
                        }
                    }
                    else
                    {
                        result.AdvisingStudentList = studentListStr;
                    }
                    db.SaveChanges();
                }
            }
        }
Esempio n. 12
0
        public bool isTheStudentNew(string studentId)
        {
            bool flag = false;

            using (CPSCreationEntities db = new CPSCreationEntities())
            {
                var student = db.StudentDetails.Where(o => o.studentID.ToLower().Equals(studentId));
                if (student.Any())
                {
                    if (student.FirstOrDefault().currentSemester == student.FirstOrDefault().admittedSemester)
                    {
                        flag = true;
                    }
                    else
                    {
                        flag = false;
                    }
                }
            }

            return(flag);
        }//end of istheStudentNew
Esempio n. 13
0
        }//end of getRegisteredCourseDetails

        public Course getCourseDetailUsingCourseShortName(string csname, string ctlg, string mjr)
        {
            Course crs = new Course();

            if (ctlg.Equals("Catalog16_17"))
            {
                if (mjr.Equals("SWEN"))
                {
                    using (CPSCreationEntities db = new CPSCreationEntities())
                    {
                        var course = db.Catalog16_17.Where(o => o.Course.ToLower().Equals(csname));
                        if (course.Any())
                        {
                            string csShortName = course.FirstOrDefault().Course;
                            string csLongName  = course.FirstOrDefault().LongTitle;
                            string csCredits   = course.FirstOrDefault().creditHrs;
                            string csType      = course.FirstOrDefault().SWEN;
                            string csSubject   = course.FirstOrDefault().Subject;
                            string csCatalog   = course.FirstOrDefault().Catalog;

                            crs = new Course(csShortName, csLongName, csSubject, csCatalog, csCredits, csType);
                        }
                    }
                    return(crs);
                }
                else if (mjr.Equals("CSCI"))
                {
                }
                else if (mjr.Equals("SENG"))
                {
                }
            }
            else if (ctlg.Equals("Catalog17_18"))
            {
            }

            return(crs);
        }//getCourseDetailsUsingCourseShortName
Esempio n. 14
0
        public string catalogNeedsTofollow(string studentId)
        {
            string strCatalog = "";

            using (CPSCreationEntities db = new CPSCreationEntities())
            {
                var student = db.StudentDetails.Where(o => o.studentID.ToLower().Equals(studentId));
                if (student.Any())
                {
                    string admittedSem = student.FirstOrDefault().admittedSemester;
                    if (admittedSem.Equals("Fall16") || admittedSem.Equals("Spring17") || admittedSem.Equals("Summer17"))
                    {
                        strCatalog = "Catalog16_17";
                    }
                    else if (admittedSem.Equals("Fall17") || admittedSem.Equals("Spring18") || admittedSem.Equals("Summer18"))
                    {
                        strCatalog = "Catalog17_18";
                    }
                }
            }

            return(strCatalog);
        }