private void DelBtn_Click(object sender, RoutedEventArgs e) { if (DataGridSubscribers.SelectedItem != null) { MainWindow.manager.RemoveFromList(DataGridSubscribers.SelectedItem as Subscriber); DataGridSubscribers.SelectedItem = null; DataGridSubscribers.ItemsSource = MainWindow.getManagerSubList(); MainWindow.BackToList(); } }
private void Save_Click(object sender, RoutedEventArgs e) { if (validateForm()) { string name = FirstName.Text; string surname = SecondName.Text; string city = City.Text; string postal = Postal.Text; string street = Street.Text; string sex = comboBox.Text; string houseNumber = HouseNumber.Text; int age = int.Parse(Age.Text); Model.Subscriber subscriber = new Model.Subscriber(name, surname, sex, city, postal, street, houseNumber, age); MainWindow.AddToList(subscriber); MainWindow.BackToList(); } }
private void Save_Click(object sender, RoutedEventArgs e) { if (validateEditForm()) { SelectedItem.FirstName = FirstName.Text; SelectedItem.SecondName = SecondName.Text; SelectedItem.Age = int.Parse(Age.Text); SelectedItem.Sex = comboBox.Text; SelectedItem.City = City.Text; SelectedItem.PostalCode = Postal.Text; SelectedItem.StreetAddress = Street.Text; SelectedItem.HouseNumber = HouseNumber.Text; MainWindow.BackToList(); } else { MessageBox.Show("There Is some empty textBox or age is not a number. "); } }
private void Back_Click(object sender, RoutedEventArgs e) { MainWindow.BackToList(); }