public bool DelDiem(string idSV, string idLopHP) { try { Diem x = db.Diems.Where(t => t.ID_LopHocPhan == idLopHP && t.ID_SinhVien == idSV).FirstOrDefault(); if (x != null) { db.Diems.Remove(x); db.SaveChanges(); return(true); } return(true); } catch (Exception) { return(false); } }
public List <Diem> dsdiem() { List <Diem> ds = new List <Diem>(); Open(); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select * from Diem"; cmd.Connection = conn; SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Diem a = new Diem(); a.MaHocSinh = reader.GetString(0); a.MaMonHoc = reader.GetString(1); // if (reader.GetDouble(2) == null) try { a.DiemKy1 = reader.GetDouble(2); // a.DiemKy2 = reader.GetDouble(3); } catch (Exception ex) { a.DiemKy1 = -1; } try { a.DiemKy2 = reader.GetDouble(3); // a.DiemKy2 = reader.GetDouble(3); } catch (Exception ex) { a.DiemKy2 = -1; } ds.Add(a); } Close(); conn.Close(); return(ds); }
partial void DeleteDiem(Diem instance);
partial void UpdateDiem(Diem instance);
partial void InsertDiem(Diem instance);
private void detach_Diems(Diem entity) { this.SendPropertyChanging(); entity.MonHoc = null; }
private void attach_Diems(Diem entity) { this.SendPropertyChanging(); entity.MonHoc = this; }
private void detach_Diems(Diem entity) { this.SendPropertyChanging(); entity.SinhVien = null; }
private void attach_Diems(Diem entity) { this.SendPropertyChanging(); entity.SinhVien = this; }