private void FormAddRequestDrug_Load(object sender, EventArgs e) { try { List <DrugViewModel> listDrugs = serviceDrug.GetList(); comboBoxDrug.DisplayMember = "DrugName"; comboBoxDrug.ValueMember = "Id"; comboBoxDrug.DataSource = listDrugs; comboBoxDrug.SelectedItem = null; } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadData() { try { List <DrugViewModel> list = service.GetList(); if (list != null) { dataGridView.DataSource = list; dataGridView.Columns[0].Visible = false; dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FormServiceDrug_Load(object sender, EventArgs e) { try { List <DrugViewModel> list = service.GetList(); if (list != null) { comboBoxComponent.DisplayMember = "DrugName"; comboBoxComponent.ValueMember = "Id"; comboBoxComponent.DataSource = list; comboBoxComponent.SelectedItem = null; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (model != null) { comboBoxComponent.Enabled = false; comboBoxComponent.SelectedValue = model.DrugId; textBoxCount.Text = model.Count.ToString(); } }
public IEnumerable <DrugEntity> GetList(string deptid) { return(service.GetList(deptid)); }