private void Button_Click_1(object sender, RoutedEventArgs e) { VkladWin m = new VkladWin(ind); m.Show(); Close(); }
private void Button_Click(object sender, RoutedEventArgs e) { foreach (Client p in k) { if (ind == p.ClientId) { if (int.Parse(Bal.Text) > p.MainBalance) { MessageBox.Show("Недостаточно средств на счету!"); } else { r = new Vklad(); r.Balance = int.Parse(Bal.Text); dynamic d = comboboxProg.SelectedItem; r.Client_FK = p.ClientId; db.Clients.Find(ind).MainBalance = db.Clients.Find(ind).MainBalance - r.Balance; r.Prog_FK = d.ProgId; r.DateOpen = DateTime.Now; db.Vklads.Add(r); db.SaveChanges(); MessageBox.Show("Вклад добавлен!"); VkladWin m = new VkladWin(ind); m.Show(); Close(); } } } }
private void Button_Click_2(object sender, RoutedEventArgs e) { if (Vklads.SelectedItem == null) { return; } dynamic p = Vklads.SelectedItem; db.Clients.Find(p.Client_id).MainBalance += p.Value; db.Vklads.Remove(db.Vklads.Find(p.Vklad_id)); db.SaveChanges(); Vklads.Items.Refresh(); VkladWin ret = new VkladWin(index); ret.Show(); Close(); }