code View

id 41
Title Last EXAM value for a given id_person
Type snippet
Highlight group
Description Last EXAM value for a given id_person (Viral load in the example)
Code
var qry =  (from ex in db.d_events.Where(s => p.id_person == IDPERSON && s.event_type == "EXAMS")
		   from ex_vload in db.d_events_att.Where(w => ex.id_event == w.id_event && w.domain == "A_EXAMS_VLOAD")
		   select new
		   {
			   ex.id_person,
			   ex.date_apt_exe
			   ex_vload.vn2,
		   }).AsEnumerable().Select(s => new
		   {
			   s.id_person,
			   SAMPLE_DATE = s.date_apt_exe,
			   PCR = Common.UtilityVL.GetVL(s.vn2.ToString()) 
		   });


// or  
var qry = (from ex in db.d_events_att.Where(w => w.domain == "A_EXAMS_VLOAD" && w.id_person == IDPERSON )
		   select new
		   {
			   ex.id_person,
			   ex_date = ex.d_event.date_apt_exe,
			   ex.vn2,
		   }).AsEnumerable()
		   .Where(w => w.ex_date.HasValue)
		   .Select(s => new
		   {
			   s.id_person,
			   SAMPLE_DATE = s.ex_date,
			   PCR = Common.UtilityVL.GetVL(s.vn2.ToString())
		   });

 

Ordine 60