コード例 #1
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     SEASON_ID = 0;
     btnUpdate.UseSelectable = false;
     try
     {
         foreach (DataGridViewRow row in dataGridViewSeason.SelectedRows)
         {
             SEASON_ID = Convert.ToInt32(row.Cells[0].Value);
         }
         //MessageBox.Show(SEASON_ID.ToString());
         if (SEASON_ID != 0)
         {
             FormUpdateSeason update = new FormUpdateSeason();
             update.ShowDialog(this);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
     }
     finally
     {
         using (TBL_SEASON_DATA_ACCESS sda = new TBL_SEASON_DATA_ACCESS())
         {
             dataGridViewSeason.DataSource = sda.ShowAllSeasonIncludeInactive();
         }
     }
 }
コード例 #2
0
 private void ControlSeason_Load(object sender, EventArgs e)
 {
     using (TBL_SEASON_DATA_ACCESS sda = new TBL_SEASON_DATA_ACCESS())
     {
         dataGridViewSeason.DataSource = sda.ShowAllSeasonIncludeInactive();
     }
 }
コード例 #3
0
 private void btnAddNew_Click(object sender, EventArgs e)
 {
     try
     {
         btnAddNew.UseSelectable = false;
         using (_addseason = new FormAddNewSeason())
         {
             _addseason.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
         GC.Collect();
     }
     finally
     {
         using (TBL_SEASON_DATA_ACCESS sda = new TBL_SEASON_DATA_ACCESS())
         {
             dataGridViewSeason.DataSource = sda.ShowAllSeasonIncludeInactive();
         }
         GC.Collect();
     }
     btnAddNew.UseSelectable = false;
 }
コード例 #4
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     SEASON_ID = 0;
     try
     {
         foreach (DataGridViewRow row in dataGridViewSeason.SelectedRows)
         {
             SEASON_ID = Convert.ToInt32(row.Cells[0].Value);
         }
         //MessageBox.Show(SEASON_ID.ToString());
         if (SEASON_ID != 0)
         {
             using (LicenseDataContext _context = new LicenseDataContext())
             {
                 TBL_SEASON season = (from s in _context.TBL_SEASONs
                                      where s.SEASON_ID == SEASON_ID
                                      select s).FirstOrDefault();
                 season.IS_ACTIVE = false;
                 _context.SubmitChanges();
             };
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
         GC.Collect();
     }
     finally
     {
         using (TBL_SEASON_DATA_ACCESS sda = new TBL_SEASON_DATA_ACCESS())
         {
             dataGridViewSeason.DataSource = sda.ShowAllSeasonIncludeInactive();
         }
     }
     btnDelete.UseSelectable = false;
 }