Пример #1
0
        public Student Login(int sid)
        {
            string sql = "select * from wxb_0604student s where s.studentid=:sd";
            List <OracleParameter> paras = new List <OracleParameter>();

            paras.Add(new OracleParameter(":sd", sid));
            Student          s  = null;
            OracleDataReader dr = base.ExecuteSelect(sql, paras);
            ClassInfoService cs = new ClassInfoService();

            if (dr.Read())
            {
                s = new Student
                {
                    Studentid   = Convert.ToInt32(dr["studentid"]),
                    Studentname = dr["studentname"].ToString(),
                    Studentrole = Convert.ToInt32(dr["studentrole"]),
                    Classid     = cs.GetClassInfoById(Convert.ToInt32((dr["classid"])))
                };
            }
            dr.Close();
            return(s);
        }
Пример #2
0
        public List <AssignInfo> GetResultAssign(string sid, int cid, string start, string end)
        {
            string sql = @"select x.*,to_char(x.assigntime,'yyyy-mm-dd hh:mi:ss') atime  from (select a.*,c.classid,s.studentname 
                            from wxb_0604assigninfo a ,wxb_0604classinfo c, wxb_0604student s
                                    where s.classid = c.classid and a.studentid = s.studentid) x
                             where(x.classid =:cid or 0 >=:isall)
                             and x.studentname like '%'||:sn||'%'
                             and x.assigntime > to_date(:st, 'yyyy-mm-dd-hh24:mi')
                             and x.assigntime < to_date(:en, 'yyyy-mm-dd-hh24:mi')";
            List <OracleParameter> paras = new List <OracleParameter>();

            paras.Add(new OracleParameter(":cid", cid));
            paras.Add(new OracleParameter(":isall", Math.Sign(cid)));
            paras.Add(new OracleParameter(":sn", sid));
            paras.Add(new OracleParameter(":st", start));
            paras.Add(new OracleParameter(":en", end));
            OracleDataReader  dr    = base.ExecuteSelect(sql, paras);
            List <AssignInfo> lista = new List <AssignInfo>();
            ClassInfoService  cs    = new ClassInfoService();

            while (dr.Read())
            {
                var a = new AssignInfo
                {
                    Assignid    = Convert.ToInt32(dr["assignid"]),
                    Assigntime  = dr["atime"].ToString(),
                    Assigndesc  = dr["assigndesc"].ToString(),
                    Assigntag   = Convert.ToInt32(dr["assigntag"]),
                    Studentname = dr["studentname"].ToString(),
                    Classinfo   = cs.GetClassInfoById(cid)
                };
                lista.Add(a);
            }
            dr.Close();
            return(lista);
        }