public void problemaCurenta(string pLname, string pFname, string mLname, string mFname, ref string descriere) { Programare prog = new Programare(); using (MedicDBEntities3 md = new MedicDBEntities3()) { prog = md.Programares.Where(x => x.p_firstname == pFname && x.p_lastname == pLname && x.m_firstname == mFname && x.m_lastname == mLname).FirstOrDefault(); descriere = prog.descriere; } }
public void dataProgramarii(ref List <string> list) { Programare prog = new Programare(); List <Programare> plist = new List <Programare>(); using (MedicDBEntities3 md = new MedicDBEntities3()) { plist = md.Programares.ToList(); foreach (var det in plist) { list.Add(det.data + " " + det.m_lastname + " " + det.m_firstname + " " + det.p_lastname + " " + det.p_firstname); } } }
public int programari(string pCNP, string pLName, string pFName, string descriere, string date, string mFName, string mLName) { Programare programare = new Programare(); PacientDetail p_detail = new PacientDetail(); MedicDetail m_detail = new MedicDetail(); Programare p1 = new Programare(); using (MedicDBEntities3 md = new MedicDBEntities3()) { try { p_detail = md.PacientDetails.Where(x => x.pacient_cnp == pCNP).FirstOrDefault(); m_detail = md.MedicDetails.Where(x => x.lastname == mLName && x.firstname == mFName).FirstOrDefault(); programare = md.Programares.Where(x => x.data == date && x.m_lastname == m_detail.lastname && x.m_firstname == m_detail.firstname).FirstOrDefault(); if (programare != null) { return(0); //exista o programare } else { p1.pacient_cnp = pCNP; p1.p_lastname = pLName; p1.p_firstname = pFName; p1.descriere = descriere; p1.data = date; p1.m_firstname = mFName; p1.m_lastname = mLName; md.Programares.Add(p1); md.SaveChanges(); } } catch { return(-1); } return(1); } }