public virtual DataTable FindAll(T t) { string tableName = t.GetType().Name; string sql = "select * from " + tableName + " where 1=1"; return(sDal.FindAll(sql)); }
public DataTable findAchievement() { string sql = string.Format(@"select s.stuId,userName,fName,pName,g.gNo,cName,Fraction from Student s left join Faculty f on s.fId=f.fId left join Professional p on f.fId=p.fId left join Grade g on s.gNo=g.gNo left join Class c on c.gNo=g.gNo where s.isDelete=0 group by s.stuId,userName,fName,pName,g.gNo,c.cName,Fraction"); return(sdl.FindAll(sql)); }
public bool query(Account at) { string TableName = at.type; string Name = at.userName; string Pwd = at.pwd; string sql = "select * from " + TableName + " where userName='******' and pwd='" + Pwd + "'"; DataTable dt = sDal.FindAll(sql); if (dt.Rows.Count > 0) { string sq = "select Access from " + TableName + " where userName='******' and pwd='" + Pwd + "'"; string menu = sDal.FindAll(sq).Rows[0][0].ToString(); return(true); } else { return(false); } }
public int Answer(string[] optioName, string[] ranswer, string user, string passw) { subjectDal sd = new subjectDal(); string sql = "select sum(optionScore) from optionStem where optionName='" + optioName[0] + "' and optionCorrect='" + ranswer[0] + "'"; string count = "select count(*) from optionStem where pId=6"; DataTable dt = sd.FindAll(count); int Count = Convert.ToInt32(dt.Rows[0][0]); for (int i = 1; i <= Count; i++) { for (int j = 1; j < optioName.Length; j++) { sql += " or optionName='" + optioName[j] + "' and optionCorrect='" + ranswer[j] + "' "; } } DataTable rows = sd.FindAll(sql); int rIndex = Convert.ToInt32(rows.Rows[0][0]); string Fraction = "update Student set Fraction=" + rIndex + " where userName='******' and pwd='" + passw + "'"; sd.updata(Fraction); return(rIndex); }
//加载试题 public string getTest(string userNam, string pwd) { subjectDal sd = new subjectDal(); string Test = "<ul>"; string pid = "select s.pId from Professional p join Student s on p.pId=s.pId where userName='******' and pwd='" + pwd + "' "; DataTable de = sd.FindAll(pid); int pId = Convert.ToInt32(de.Rows[0][0]); //查询试题所有条数 string sql = "select count(*) from optionStem where pId=" + pId; string Tsql = "select * from optionStem o join Student s on s.pId=o.pId where s.pid=" + pId; DataTable dt = sd.FindAll(Tsql); DataTable dtb = sd.FindAll(sql); int count = Convert.ToInt32(dtb.Rows[0][0]); string[] option = { "A", "B", "C", "D" }; for (int i = 0; i < count; i++) { int p = 0; Test += "<span><li><h3>" + dt.Rows[i][1].ToString() + "</h3></li></span><label>"; for (int j = 2; j < 6; j++) { Test += "<span><h4>" + option[p] + "<li><input type='radio' value='" + option[p] + "' name=" + i + "></li>" + dt.Rows[i][j].ToString() + "</h4></span>"; p++; if (p == 4) { p = 0; } } } Test += "<br /><input type='button'class='btn btn-primary' value='点击提交试卷' id='confirm' onclick='Submission()'>"; return(Test); }
public string qTest(int pid) { subjectDal sl = new subjectDal(); string sql = "select optionName,optionA,optionB,optionC,optionD,optionCorrect from optionStem where pId=" + pid + " and "; ArrayList array = new ArrayList(); Random r = new Random(); string Test = "<ul>"; ArrayList list = new ArrayList(); int k = 1; do { k = r.Next(1, 21); if (!list.Contains(k)) { list.Add(k); } }while (list.Count < 20); sql += " optionId=" + list[0]; for (int i = 1; i < list.Count; i++) { sql += " or optionId=" + list[i]; } DataTable dt = sl.FindAll(sql); string[] option = { "A", "B", "C", "D" }; for (int i = 0; i < 20; i++) { int p = 0; Test += "<span><li><h3>" + dt.Rows[i][0].ToString() + "</h3></li></span><label>"; for (int j = 1; j < 5; j++) { Test += "<span><h4>" + option[p] + "<li><input type='radio' value='" + option[p] + "' name=" + i + "></li>" + dt.Rows[i][j].ToString() + "</h4></span>"; p++; if (p == 4) { p = 0; } } } Test += "<br /><input type='button'class='btn btn-primary' value='点击提交试卷' id='confirm' onclick='Submission()'>"; return(Test); }
public override DataTable FindAll(Student t) { string TableName = t.GetType().Name; string sql = string.Format(@"select s.stuId,userName,fName,pName,g.gNo,cName from Student s left join Faculty f on s.fId=f.fId left join Professional p on f.fId=p.fId left join Grade g on s.gNo=g.gNo left join Class c on c.gNo=g.gNo where s.isDelete=0 group by s.stuId,userName,fName,pName,g.gNo,c.cName"); return(sdl.FindAll(sql)); }
public DataTable findAll() { string sql = "select tId,userName,fName,pName,gNo,cName from Teacher t join Faculty f on t.fId=f.fId join Professional p on p.pId=t.pId join Class c on c.cId=t.cId where t.isDelete=0"; return(sdl.FindAll(sql)); }
public DataTable findAll() { string sql = "select * from Faculty"; return(sal.FindAll(sql)); }
public DataTable FindAll() { string sql = "select * from Class"; return(sal.FindAll(sql)); }
public DataTable getAll() { string sql = "select optionId,optionName,optionA,optionB,optionC,optionD,optionCorrect from optionStem where isDelete=0"; return(sal.FindAll(sql)); }
public DataTable show() { string sql = "select * from staffInfo"; return(sl.FindAll(sql)); }
public DataTable findAll() { string sql = "select * from Professional"; return(sdl.FindAll(sql)); }