public TestScore GetTestScore(string matruong, string sbd, string hoTen) { TestScore testScore = new TestScore(); testScore.ListTruong = GetTruongs(); testScore.MaTruong = matruong; testScore.Sbd = sbd; testScore.HoTen = hoTen; string sql = string.Format("SELECT DISTINCT TS.SBD, TS.HOTEN, TS.NGAYSINH, CN.TENNGANH, DT.KHOITHI, DT.DIEM FROM DIEMTHI DT JOIN THISINH TS ON DT.SBD = TS.SBD JOIN CHUYENNGANH CN ON CN.MANGANH = DT.MANGANH WHERE DT.MATRUONG = N'{0}' AND (TS.SBD = '{1}' OR HOTEN = N'{2}')", matruong, sbd, hoTen); var dataTableDiemThi = dataProvider.ExecuteQuery(sql); foreach (DataRow row in dataTableDiemThi.Rows) { DiemThi diemThi = new DiemThi(); diemThi.Sbd = row["Sbd"].ToString(); diemThi.HoTen = row["HoTen"].ToString(); diemThi.NgaySinh = Convert.ToDateTime(row["NgaySinh"].ToString()); diemThi.TenNganh = row["TenNganh"].ToString(); diemThi.KhoiThi = row["KhoiThi"].ToString(); diemThi.Diem = float.Parse(row["Diem"].ToString()); testScore.ListDiem.Add(diemThi); } return testScore; }
public TestScore GetTestScore(string matruong, string sbd, string hoTen) { TestScore testScore = new TestScore(); testScore.ListTruong = GetTruongs(); testScore.MaTruong = matruong; testScore.Sbd = sbd; testScore.HoTen = hoTen; string sql = string.Format("SELECT DISTINCT TS.SBD, TS.HOTEN, TS.NGAYSINH, CN.TENNGANH, DT.KHOITHI, DT.DIEM FROM DIEMTHI DT JOIN THISINH TS ON DT.SBD = TS.SBD JOIN CHUYENNGANH CN ON CN.MANGANH = DT.MANGANH WHERE DT.MATRUONG = N'{0}' AND (TS.SBD = '{1}' OR HOTEN = N'{2}')", matruong, sbd, hoTen); var dataTableDiemThi = dataProvider.ExecuteQuery(sql); foreach (DataRow row in dataTableDiemThi.Rows) { DiemThi diemThi = new DiemThi(); diemThi.Sbd = row["Sbd"].ToString(); diemThi.HoTen = row["HoTen"].ToString(); diemThi.NgaySinh = Convert.ToDateTime(row["NgaySinh"].ToString()); diemThi.TenNganh = row["TenNganh"].ToString(); diemThi.KhoiThi = row["KhoiThi"].ToString(); diemThi.Diem = float.Parse(row["Diem"].ToString()); testScore.ListDiem.Add(diemThi); } return(testScore); }
public ActionResult TestScore() { TestScore testScore = new TestScore(); testScore.ListTruong = truongHelper.GetTruongs(); return View(testScore); }