Esempio n. 1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         using (games_crud game = new games_crud())
         {
             game.txtHomeScore.Visible  = false;
             game.txtAwayScore.Visible  = false;
             game.lblAwayScore.Visible  = false;
             game.lblHomeScore.Visible  = false;
             game.lblFormName.Text      = "Игра: Добавление";
             game.lblId_team.Visible    = false;
             game.txtid_game.Visible    = false;
             game.cmbStatusGame.Visible = false;
             game.lblStatusGame.Visible = false;
             game.objstate = (int)Enums.Checked.Insert;
             game.LoadData();
             game.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         LoadData();
     }
 }
Esempio n. 2
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     try
     {
         using (games_crud game = new games_crud())
         {
             //game.LoadData();
             game.txtid_game.Text           = DataGridGames.CurrentRow.Cells[0].Value.ToString();
             game.txtCity.Text              = DataGridGames.CurrentRow.Cells[1].Value.ToString();
             game.txtDate.Text              = DataGridGames.CurrentRow.Cells[2].Value.ToString();
             game.cmbArena.SelectedValue    = (int)DataGridGames.CurrentRow.Cells[3].Value;
             game.cmbHomeTeam.SelectedValue = (int)DataGridGames.CurrentRow.Cells[4].Value;
             game.cmbAwayTeam.SelectedValue = (int)DataGridGames.CurrentRow.Cells[5].Value;
             game.txtHomeScore.Value        = (int)DataGridGames.CurrentRow.Cells[6].Value;
             game.txtAwayScore.Value        = (int)DataGridGames.CurrentRow.Cells[7].Value;
             if ((bool)DataGridGames.CurrentRow.Cells[8].Value == true)
             {
                 game.status_game = true;
                 game.cmbStatusGame.SelectedValue = 0;
             }
             else
             {
                 game.status_game = false;
                 game.cmbStatusGame.SelectedValue = 1;
             }
             game.objstate         = (int)Enums.Checked.Update;
             game.lblFormName.Text = "Игрок: Редактирование";
             game.LoadData();
             game.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         LoadData();
     }
 }