Exemplo n.º 1
0
        /// <summary>
        /// takes in a TUID and creates a StudentObj with Full name, Email, TUID, Major, and College Code
        /// </summary>
        /// <param name="TUID"></param>
        /// <returns></returns>
        public static StudentObj getStudentInfo(string TUID)
        {
            //////// Get LDAP Info
            StudentObj student = new StudentObj();
            LDAPuser   entry   = getLDAPEntryByTUID(TUID);

            if (entry != null)
            {
                String[] name = entry.cn.Split(null); // splits 'cn' into first, middle, last

                if (name.Length == 2)                 // No middle initial
                {
                    student.firstName  = name[0];
                    student.middleInit = "";
                    student.lastName   = name[1];
                }
                else if (name.Length == 3)     // Has middle initial
                {
                    student.firstName  = name[0];
                    student.middleInit = name[1];
                    student.lastName   = name[2];
                }
                else if (name.Length == 4)     // Special case for people with 4 part names
                {
                    student.firstName  = name[0];
                    student.middleInit = name[1] + " " + name[2];
                    student.lastName   = name[3];
                }

                student.email = entry.mail;
                student.tuid  = entry.templeEduID;

                //////// Get Academic Info
                WS_StudentSearch.WS_Student studentProxy = new WS_StudentSearch.WS_Student();
                WS_StudentSearch.Result     results      = new WS_StudentSearch.Result();
                results = studentProxy.GetAcademicInfoByTUID(webServiceUsername, webServicePassword, TUID);

                // Check if request was successful
                if (results.Status == "OK")     // Success
                {
                    WS_StudentSearch.Student[] s = results.Students;
                    student.major1 = s[0].major1;
                    student.major2 = s[0].major2;
                    student.school = s[0].collegeCode;
                }
                else     // Something went wrong...
                {
                    return(null);
                }
            }

            return(student);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Takes in a Terms Code and returns the Term Object associated with it
        /// </summary>
        /// <param name="termCode"></param>
        /// <returns>Term Object</returns>
        public static Term getTermByTermCode(string termCode)
        {
            WS_StudentSearch.WS_Student studentProxy = new WS_StudentSearch.WS_Student();
            WS_StudentSearch.Result     results      = new WS_StudentSearch.Result();
            results = studentProxy.GetTermByTermCode(webServiceUsername, webServicePassword, termCode);

            // Check if request was successful
            if (results.Status == "OK")     // Success
            {
                Term returnTerm           = new Term();
                WS_StudentSearch.Term[] t = results.Terms;
                returnTerm.termCode  = t[0].code;
                returnTerm.termName  = t[0].name;
                returnTerm.startDate = DateTime.Parse(t[0].startDate).ToShortDateString().ToString();
                returnTerm.endDate   = DateTime.Parse(t[0].endDate).ToShortDateString().ToString();
                return(returnTerm);
            }
            else     // Something went wrong...
            {
                return(null);
            }
        }