public int DeletePhongThi(PhongThi pPhongThi) { var PhongThi = Context.PhongThis.FirstOrDefault(p => p.MaPhong == pPhongThi.MaPhong); Context.PhongThis.Remove(PhongThi); return(Context.SaveChanges()); }
/// <summary> /// Sửa thông tin 1 phòng thi /// </summary> /// <returns>true</returns> private static void UpdatePhongThi(PhongThi item) { try { Conn.ExcuteQuerySql("update PHONGTHI set TenPhong = N'" + item.TenPhong + "',SucChua = " + item.SucChua + ",GhiChu = N'" + item.GhiChu + "' WHERE ID = " + item.ID + ""); } catch (Exception ex) { Log2File.LogExceptionToFile(ex); } }
/// <summary> /// Thêm 1 phòng thi /// </summary> /// <returns></returns> public static bool ThemPhongThi(PhongThi item) { try { Conn.ExcuteQuerySql("insert into PHONGTHI(TenPhong,SucChua,GhiChu) values(N'" + item.TenPhong + "'," + item.SucChua + ",N'" + item.GhiChu + "')"); return(true); } catch (Exception ex) { Log2File.LogExceptionToFile(ex); return(false); } }
public int SavePhongThi(PhongThi pPhongThi) { var PhongThi = Context.PhongThis.FirstOrDefault(p => p.Id == pPhongThi.Id); if (PhongThi == null) { PhongThi = new PhongThi(); Context.PhongThis.Add(PhongThi); } PhongThi.MaPhong = pPhongThi.MaPhong; PhongThi.TenPhong = pPhongThi.TenPhong; PhongThi.IDGiamThi = pPhongThi.IDGiamThi; PhongThi.Port = pPhongThi.Port; PhongThi.Status = pPhongThi.Status; PhongThi.ThoiGianKetThuc = pPhongThi.ThoiGianKetThuc; return(Context.SaveChanges()); }
public void Post(PhongThi PhongThi) { PhongThi.PhongThiId = Guid.NewGuid(); db.PhongThi.Add(PhongThi); db.SaveChanges(); }
/// <summary> /// Trạng Thái 1 : Đang có sinh viên thi : 0 /// </summary> /// <param name="pPhongThi"></param> /// <returns></returns> public bool CheckExistInPhongThi(PhongThi pPhongThi) { return(Context.PhongThis.Any(h => h.Status.Equals(pPhongThi.Status == 1))); }
public bool CheckExistPhong(PhongThi pPhongThi) { return(Context.PhongThis.Any(p => p.MaPhong == pPhongThi.MaPhong)); }