Beispiel #1
0
 private void LoadData()
 {
     try
     {
         var list = logic.Read(null);
         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);
     }
 }
Beispiel #2
0
 private void FormClient_Load(object sender, EventArgs e)
 {
     if (id.HasValue)
     {
         try
         {
             var view = logic.Read(new FavoritesBindingModel {
                 Id = id
             })?[0];
             if (view != null)
             {
                 textBoxLink.Text   = view.Link;
                 comboBoxUsers.Text = view.AdName;
                 textBoxAdName.Text = view.AdName;
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
                             MessageBoxIcon.Error);
         }
     }
 }