/// <summary> /// Getting data from DB, criteria: maBenhNhan /// </summary> /// <param name="maBenhNhan"></param> private void ReadList(string maBenhNhan) { using (var dc = new QLPM_ModelDataContext()) { (from pk in dc.PHIEUKHAMBENHs where pk.Ma_BenhNhan == maBenhNhan select pk).ToList().ForEach(x => DS_PhieuKham.Add((PHIEUKHAM)x)); } }
/// <summary> /// Getting data from DB, criteria: date.today /// </summary> /// <returns></returns> private void ReadList(DateTime datePicked) { DS_PhieuKham.Clear(); // Getting data from DB (if exists) using (var dc = new QLPM_ModelDataContext()) { (from pk in dc.PHIEUKHAMBENHs where pk.NgayKham == datePicked select pk).ToList().ForEach(x => DS_PhieuKham.Add((PHIEUKHAM)x)); } }
/// <summary> /// Load Data from DB /// </summary> /// <param name="maBenhNhan"></param> private void GetData(string maBenhNhan) { using (var dc = new QLPM_ModelDataContext()) { dc.PHIEUKHAMBENHs.Where(x => x.Ma_BenhNhan == maBenhNhan).ToList().ForEach(x => { DS_PhieuKham.Add(new CTTRACUU() { PhieuKham = (PHIEUKHAM)x, HoaDon = (CTHOADON)(x.HOADONs.Single(y => y.Ma_PhieuKham == x.Ma_PhieuKham)) }); }); } }