//////////////////////////////////////////////PROMOCODES///////////////////////////////////////////////// private void addPromocodeButton_Click(object sender, RoutedEventArgs e) { try { Add_Promocode_n add = new Add_Promocode_n(); add.Owner = this; add.Show(); } catch { MessageBox.Show("Ошибка добавления."); } }
private void editPromocodeButton_Click(object sender, RoutedEventArgs e) { Add_Promocode_n add = new Add_Promocode_n(); add.Owner = this; editFlag = true; try { using (UserContext db = new UserContext()) { add.promocodeTextbox.Text = db.Promocodes.ToList()[promocodesDatagrid.SelectedIndex + 1].Value; add.effectCombobox.Text = db.Promocodes.ToList()[promocodesDatagrid.SelectedIndex + 1].Effect; } } catch { MessageBox.Show("Выберите промокод."); } add.Show(); }