Example #1
0
        //end add studentinfo&&student-class



        /////////////////////search class student by id

        public List <Studenttemp> searchstubyclassid(int classid)
        {
            List <Studenttemp>   lstu = new List <Studenttemp>();
            Exercise_ERContainer cn   = new Exercise_ERContainer();

            var query = from st in cn.StudInfo1Set join cs in cn.class_student on st.studentid equals cs.studentid where  cs.classid == classid
                        select new { sid = st.studentid, sname = st.name, sno = cs.classno };

            foreach (var result in query)
            {
                Studenttemp st2 = new Studenttemp();
                st2.studentid = result.sid;
                st2.name      = result.sname;
                st2.no        = (int)result.sno;
                lstu.Add(st2);
            }
            return(lstu);
        }
Example #2
0
        //end add studentinfo&&student-class



        /////////////////////search class student by id

        public List <Studenttemp> searchstubyclassid(int classid)
        {
            List <Studenttemp>   lstu  = new List <Studenttemp>();
            Exercise_ERContainer cn    = new Exercise_ERContainer();
            classinfo            tempc = cn.classinfo.Find(classid);
            int ccid  = (int)tempc.courseid;
            var query = from st in cn.StudInfo1Set join cs in cn.class_student on st.studentid equals cs.studentid where  cs.classid == classid
                        orderby cs.classno
                        select new { sid = st.studentid, sname = st.name, sno = cs.classno, sclassid = cs.classid, spd = st.pd };

            foreach (var result in query)
            {
                Studenttemp st2 = new Studenttemp();
                st2.studentid = result.sid;
                st2.name      = result.sname;
                st2.no        = (int)result.sno;
                st2.pd        = result.spd;
                st2.classid   = result.sclassid;
                st2.courseid  = ccid;
                lstu.Add(st2);
            }
            return(lstu);
        }