private void FormDop_Load(object sender, EventArgs e) { var list = Osnv.Read(null); if (list != null) { comboBox1.DataSource = list; comboBox1.DisplayMember = "Name"; comboBox1.ValueMember = "Id"; } if (id.HasValue) { try { var view = Dop.Read(new DopBindingModel { Id = id })?[0]; if (view != null) { textBoxFullName.Text = view.Name; textBoxCount.Text = view.Count.ToString(); dateTimePicker1.Value = view.DataCreateDop; textBoxJob.Text = view.Place; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void LoadData() { try { var list = Osnv.Read(null); if (list != null) { dataGridView.DataSource = list; dataGridView.Columns[0].Visible = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FormOsnv_Load(object sender, EventArgs e) { if (id.HasValue) { try { var view = Osnv.Read(new OsnvBindingModel { Id = id })?[0]; if (view != null) { textBoxTitle.Text = view.Name; textBoxSubject.Text = view.Type; dateTimePicker1.Value = view.DateCreate; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }