private void HienThiLoThuoc() { dsLoaiThuoc = loaithuocBLL.LayThongTinLoaiThuoc(); dsThuoc = thuocBLL.LayThongTinThuoc(); dsLoThuoc = loThuocBLL.LayThongTinLoThuoc(); var gridviewInfo = dsLoaiThuoc .Join(dsThuoc, lt1 => lt1.MaLoaiThuoc, t => t.MaLoaiThuoc, (lt1, t) => new { lt1, t }) .Join(dsLoThuoc, _lt1 => _lt1.t.MaThuoc, lt2 => lt2.MaThuoc, (_lt1, lt2) => new { _lt1, lt2 }) .Where(w => w.lt2.TrangThai == 1) .Select(s => new { MaThuoc = s._lt1.t.MaThuoc, MaLoThuoc = s.lt2.MaLoThuoc, TenThuoc = s._lt1.t.TenThuoc, DVT = s.lt2.DVT, SoLuong = s.lt2.SoLuong, LoaiBenh = s._lt1.lt1.TenLoaiThuoc, }).ToList(); bsDSLoThuoc.DataSource = gridviewInfo; dgvDanhSachThuoc.DataSource = bsDSLoThuoc; }
private void CbbInfo() { dsNCC = nccBLL.LayThongTinNCC(); dsThuoc = thuocBLL.LayThongTinThuoc(); cbbNCC.DataSource = dsNCC; cbbNCC.ValueMember = "MaNCC"; cbbNCC.DisplayMember = "TenNCC"; cboLoaiThuoc.DataSource = dsThuoc; cboLoaiThuoc.ValueMember = "MaThuoc"; cboLoaiThuoc.DisplayMember = "TenThuoc"; }
private void HienThiThongTinThuoc() { dsT = tBLL.LayThongTinThuoc(); dsLoaiT = LoaiTBLL.LayThongTinLoaiThuoc(); bs = new BindingSource(); var gridviewInfo = dsLoaiT .Join(dsT, lt1 => lt1.MaLoaiThuoc, t => t.MaLoaiThuoc, (lt1, t) => new { MaThuoc = t.MaThuoc, TenThuoc = t.TenThuoc, MoTa = t.MoTa, LoaiBenh = lt1.TenLoaiThuoc, }).ToList(); bs.DataSource = gridviewInfo; dgvDanhSachThuocKD.DataSource = bs; dgvDanhSachThuocKD.Focus(); dgvDanhSachThuocKD.Columns[0].HeaderText = "Mã thuốc"; dgvDanhSachThuocKD.Columns[1].HeaderText = "Tên thuốc"; dgvDanhSachThuocKD.Columns[2].HeaderText = "Mô Tả"; dgvDanhSachThuocKD.Columns[3].HeaderText = "Tên loại thuốc"; dgvDanhSachThuocKD.Columns[0].Width = 50; dgvDanhSachThuocKD.Columns[1].Width = 150; dgvDanhSachThuocKD.Columns[2].Width = 50; dgvDanhSachThuocKD.Columns[3].Width = 57; }
private void HienThiThongTinThuoc() { dsThuoc = thuocBLL.LayThongTinThuoc(); dsLoaiThuoc = loaiThuocBLL.LayThongTinLoaiThuoc(); var gridviewInfo = dsThuoc .Join(dsLoaiThuoc, t => t.MaLoaiThuoc, lt => lt.MaLoaiThuoc, (t, lt) => new { t, lt }) .Where(_t => _t.t.TrangThai == 1) .Select(_t1 => new { MaThuoc = _t1.t.MaThuoc, LoaiThuoc = _t1.lt.TenLoaiThuoc, TenThuoc = _t1.t.TenThuoc, MoTa = _t1.t.MoTa, TrangThai = _t1.t.TrangThai }).ToList(); bsThuoc.DataSource = gridviewInfo; dgvDanhSachThuoc.DataSource = bsThuoc; }
private void HienThiCTDonThuoc(string maDT) { dsCTDonThuoc = ctDonThuocBLL.LayThongTinCTDonThuoc(); dsThuoc = thuocBLL.LayThongTinThuoc(); var gridviewInfo = dsCTDonThuoc .Join(dsThuoc, ct => ct.MaThuoc, t => t.MaThuoc, (ct, t) => new { ct, t }) .Where(_ct => _ct.ct.MaDonThuoc.Contains(maDT)) .Select(_ct => new { MaThuoc = _ct.t.MaThuoc, TenThuoc = _ct.t.TenThuoc, DVT = _ct.ct.DVT, SoLuong = _ct.ct.SoLuong }).ToList(); bsCTDonThuoc.DataSource = gridviewInfo; dgvDanhSachThuocKD.DataSource = bsCTDonThuoc; }