/// <summary> /// Them moi phong kham vao entities /// </summary> /// <param name="MAPHONGKHAM"></param> /// <param name="TENPHONG"></param> /// <param name="NGAYTAO"></param> /// <param name="TRANGTHAI"></param> public static void Insertphongkham(string MAPHONGKHAM, string TENPHONG, DateTime NGAYTAO, Boolean TRANGTHAI) { using (DB_HMS_Entities ds = new DB_HMS_Entities()) { tbPHONGKHAM pk = new tbPHONGKHAM(); pk.MAPHONGKHAM = MAPHONGKHAM; pk.TENPHONG = TENPHONG; pk.NGAYTAO = NGAYTAO; pk.TRANGTHAI = TRANGTHAI; ds.AddTotbPHONGKHAMs(pk); ds.SaveChanges(); } }
/// <summary> /// cap nhat phong kham vao entities /// </summary> /// <param name="MAPHONGKHAM"></param> /// <param name="TENPHONG"></param> /// <param name="NGAYTAO"></param> /// <param name="TRANGTHAI"></param> public static void Updatephongkham(string MAPHONGKHAM, string TENPHONG, DateTime NGAYTAO, Boolean TRANGTHAI) { using (DB_HMS_Entities ds = new DB_HMS_Entities()) { tbPHONGKHAM pk = new tbPHONGKHAM(); var query = (from dss in ds.tbPHONGKHAMs where dss.MAPHONGKHAM == MAPHONGKHAM select dss).First(); query.TENPHONG = TENPHONG; query.NGAYTAO = NGAYTAO; query.TRANGTHAI = TRANGTHAI; ds.SaveChanges(); } }