private void LoadData() { try { var list = worktypeLogic.Read(null); if (list != null) { dataGridViewWorktypes.DataSource = list; dataGridViewWorktypes.Columns[0].Visible = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка загрузки данных по услугам", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadDataForCrOrUpd() { var worktypelist = worktypeLogic.Read(null); if (worktypelist != null) { comboBoxWorktype.DisplayMember = "Name"; comboBoxWorktype.ValueMember = "Id"; comboBoxWorktype.DataSource = worktypelist; comboBoxWorktype.SelectedItem = null; } if (idForUpd.HasValue) { try { var view = materialLogic.Read(new MaterialBindingModel { Id = idForUpd })?[0]; if (view != null) { textBoxMaterialName.Text = view.Name; textBoxMaterialInfo.Text = view.Info; textBoxMaterialPrice.Text = view.Price.ToString(); comboBoxWorktype.Text = view.WorktypeName; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public FormVisitWorktype(WorktypeLogic wLogic) { InitializeComponent(); List <WorktypeViewModel> list = wLogic.Read(null); if (list != null) { comboBoxWorktype.DisplayMember = "Name"; comboBoxWorktype.ValueMember = "Id"; comboBoxWorktype.DataSource = list; comboBoxWorktype.SelectedItem = null; } }