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);
     }
 }
Пример #2
0
        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;
		}
Пример #8
0
 private void detach_Diems(Diem entity)
 {
     this.SendPropertyChanging();
     entity.MonHoc = null;
 }
Пример #9
0
 private void attach_Diems(Diem entity)
 {
     this.SendPropertyChanging();
     entity.MonHoc = this;
 }
Пример #10
0
 partial void DeleteDiem(Diem instance);
Пример #11
0
 partial void UpdateDiem(Diem instance);
Пример #12
0
 partial void InsertDiem(Diem instance);
Пример #13
0
 private void detach_Diems(Diem entity)
 {
     this.SendPropertyChanging();
     entity.SinhVien = null;
 }
Пример #14
0
 private void attach_Diems(Diem entity)
 {
     this.SendPropertyChanging();
     entity.SinhVien = this;
 }