public List <KetQuaBDO> GetKetQuaByMaSV(string MaSV) { List <KetQuaBDO> ListKetQua = new List <KetQuaBDO>(); using (SqlConnection connection = new SqlConnection(ConnectionInformation.ConnectionString)) { using (SqlCommand command = new SqlCommand("spGetKetQua", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@Masv", MaSV); connection.Open(); SqlDataAdapter KetQuaAdapter = new SqlDataAdapter(); DataTable KetQuaTable = new DataTable(); KetQuaAdapter.SelectCommand = command; KetQuaAdapter.Fill(KetQuaTable); if (KetQuaTable.Rows.Count > 0) { for (int i = 0; i < KetQuaTable.Rows.Count; i++) { KetQuaBDO KetQua = new KetQuaBDO(); KetQua.MaSV = (string)KetQuaTable.Rows[i]["masv"]; KetQua.MaMH = (string)KetQuaTable.Rows[i]["Mamh"]; KetQua.Diem = (int)KetQuaTable.Rows[i]["Diem"]; ListKetQua.Add(KetQua); } } } } return(ListKetQua); }
public bool Update(KetQuaBDO ketqua) { try { ketquaBUS.Update(ketqua); return(true); } catch (FaultException) { throw; } }
public bool Update(KetQuaBDO kq) { if (kq != null) { if (kq.MaSV != null && kq.MaSV != string.Empty && kq.MaMH != null && kq.MaMH != string.Empty) { ketquaDAL.Update(kq); return(true); } } return(false); }
public int Add(KetQuaBDO KetQua) { using (SqlConnection connection = new SqlConnection(ConnectionInformation.ConnectionString)) { using (SqlCommand command = new SqlCommand("spEditKetQua", connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@StatementType", ConnectionInformation.Insert); command.Parameters.AddWithValue("@masv", KetQua.MaSV); command.Parameters.AddWithValue("@Mamh", KetQua.MaMH); command.Parameters.AddWithValue("@Diem", KetQua.Diem); connection.Open(); return(command.ExecuteNonQuery()); } } }