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 bool remove(int stuId) { string sql = "update Student set isDelete=1 where stuId=" + stuId; return(sdl.updata(sql)); }
public bool Modify(Model.Teachers ts) { string sql = @"update Teacher set userName='******',fId=" + ts.fName + ",pId=" + ts.pName + ",cId=" + ts.cName + " where tId=" + ts.tId; return(sdl.updata(sql)); }
public bool add(optionStem os) { string sql = @"insert optionStem values('" + os.optionName + "','" + os.optionA + "','" + os.optionB + "','" + os.optionC + "','" + os.optionD + "','" + os.optionCorrect + "',5,0," + os.pId + ")"; return(sal.updata(sql)); }
public bool reseter(reseter re) { string sql = "update " + re.type + " set pwd = '" + re.npwd + "' where userName ='******' and pwd ='" + re.cpwd + "'"; return(sl.updata(sql)); }