private void CICHBdGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (CICHBdGrid.SelectedItem != null) { CICHClass cich = CICHBdGrid.SelectedItem as CICHClass; CICHDate.SelectedDate = cich.Date; int indexConcerts = ConcertsIdName.Items.IndexOf(cich.ConcertsName); ConcertsIdName.SelectedItem = ConcertsIdName.Items.GetItemAt(indexConcerts); int indexConcertHalls = ConcertHallsIdName.Items.IndexOf(cich.ConcertHallsName); ConcertHallsIdName.SelectedItem = ConcertHallsIdName.Items.GetItemAt(indexConcertHalls); CICHPrice.Text = cich.Price.ToString(); CICHFreeSpaces.Text = cich.FreeSpaces.ToString(); CICHReservedSpaces.Text = cich.FreeSpaces.ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void CICHSave_Click(object sender, RoutedEventArgs e) { try { CICHClass cich = CICHBdGrid.SelectedItem as CICHClass; bdClassUpdate.UpdateCICH(cich.Id, (DateTime)CICHDate.SelectedDate, ConcertsIdName.SelectedItem.ToString(), ConcertHallsIdName.SelectedItem.ToString(), Int32.Parse(CICHPrice.Text), Int32.Parse(CICHFreeSpaces.Text), Int32.Parse(CICHReservedSpaces.Text)); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { refreshCICHBdGrid(); } }
private void CICHDelete_Click(object sender, RoutedEventArgs e) { try { if (CICHBdGrid.SelectedItem != null) { CICHClass cich = CICHBdGrid.SelectedItem as CICHClass; bdClassDelete.DeleteRowTable(cich.Id, "CICH"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { refreshCICHBdGrid(); } }