public string getStudents()
        {
            string         rel           = "";
            HttpCookie     accountCookie = Request.Cookies["Account"];
            int            id            = int.Parse(accountCookie["userId"]);
            List <Student> list          = dbhelper.getFirstWillStudents(id);

            if (list == null)
            {
                return(rel);
            }
            List <ProfessorStudent> retunList = new List <ProfessorStudent>();
            ProfessorStudent        ps        = null;

            foreach (Student s in list)
            {
                ps = new ProfessorStudent();
                if (s.Gender)
                {
                    ps.Gender = "男";
                }
                else
                {
                    ps.Gender = "女";
                }
                ps.StuGraSchool = s.StuGraSchool;
                ps.StuID        = s.StuID;
                ps.StuName      = s.StuName;
                // 0软件工程与管理 1虚拟现实与应用 2人工智能 3大数据技术与应用
                ps.StuResumeUrl = s.StuResumeUrl == null ? "" : s.StuResumeUrl;
                if (s.StuMajorID == 0)
                {
                    ps.StuMajor = "软件工程与管理";
                }
                else if (s.StuMajorID == 1)
                {
                    ps.StuMajor = "虚拟现实与应用";
                }
                else if (s.StuMajorID == 2)
                {
                    ps.StuMajor = "人工智能";
                }
                else if (s.StuMajorID == 3)
                {
                    ps.StuMajor = "大数据技术与应用";
                }
                retunList.Add(ps);
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            var json = serializer.Serialize(retunList);

            rel = json.ToString();
            return(rel);
        }
Exemplo n.º 2
0
        public string getStudentsOfProfessorToStudent(int id)
        {
            string         rel  = "";
            List <Student> list = dbhelper.getStudentsOfProfessorToStudent(id);

            if (list == null)
            {
                return(rel);
            }
            List <ProfessorStudent> retunList = new List <ProfessorStudent>();
            ProfessorStudent        ps        = null;

            foreach (Student s in list)
            {
                ps              = new ProfessorStudent();
                ps.Gender       = s.Gender;
                ps.StuGraSchool = s.StuGraSchool;
                ps.StuID        = s.StuID;
                ps.StuName      = s.StuName;
                // 0软件工程与管理 1虚拟现实与应用 2人工智能 3大数据技术与应用
                if (s.StuMajorID == 0)
                {
                    ps.StuMajor = "软件工程与管理";
                }
                else if (s.StuMajorID == 1)
                {
                    ps.StuMajor = "虚拟现实与应用";
                }
                else if (s.StuMajorID == 2)
                {
                    ps.StuMajor = "人工智能";
                }
                else if (s.StuMajorID == 3)
                {
                    ps.StuMajor = "大数据技术与应用";
                }
                retunList.Add(ps);
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            var json = serializer.Serialize(retunList);

            rel = json.ToString();
            return(rel);
        }