private void refresh() { textBoxX3.Text = RandomString(7); var q = from a in BL.Read() join b in patBL.Read() on a.PatientId equals b.Id join c in recBL.Read() on a.ReceptionistId equals c.Id where (a.ReceptionistId == recId) select new { a.Id, a.BillNo, a.Amount, PName = b.Name, RName = c.Name }; dataGridView1.DataSource = q.ToList(); //Patients Combos comboBoxEx1.DataSource = patBL.Read().Where(a => a.ReceptionistId == recId).Select(a => new { a.Id, a.Name }).ToList(); comboBoxEx1.DisplayMember = "Name"; comboBoxEx1.ValueMember = "Id"; comboBoxEx4.DataSource = patBL.Read().Where(a => a.ReceptionistId == recId).Select(a => new { a.Id, a.Name }).ToList(); comboBoxEx4.DisplayMember = "Name"; comboBoxEx4.ValueMember = "Id"; //Receptionist Combos comboBoxEx2.DataSource = recBL.Read().Select(a => new { a.Id, a.Name }).Where(a => a.Id == recId).ToList(); comboBoxEx2.DisplayMember = "Name"; comboBoxEx2.ValueMember = "Id"; comboBoxEx3.DataSource = recBL.Read().Select(a => new { a.Id, a.Name }).Where(a => a.Id == recId).ToList(); comboBoxEx3.DisplayMember = "Name"; comboBoxEx3.ValueMember = "Id"; }
private void refresh() { var q = from a in BL.Read() join b in patBL.Read() on a.PatientId equals b.Id join c in recBL.Read() on a.ReceptionistId equals c.Id where (a.ReceptionistId == recId) select new { a.Id, a.BillNo, a.Amount, PName = b.Name, RName = c.Name }; dataGridView1.DataSource = q.ToList(); if (dataGridView1.SelectedCells.Count > 0) { labelX4.Text = getValue(1).ToString(); } }