private void button4_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0 || dataGridView1.SelectedCells.Count == 1) { VkladMod c; c = (VkladMod)dataGridView1.CurrentRow.DataBoundItem; if (c != null) { AddVkladForm f = new AddVkladForm(allClients, allProgs); DialogResult result = f.ShowDialog(this); if (result == DialogResult.Cancel) { return; } //c.Cost = f.numericUpDown1.Value; //ph.Name = f.textBox1.Text; //ph.ManufacturerId = (int)f.comboBoxManuf.SelectedValue; c.Balance = int.Parse(f.textBox1.Text); c.DateOpen = DateTime.Now; dbOperations.UpdateVklad(c); RefreshgvVklads(); } } else { MessageBox.Show("Ни один объект не выбран!"); } }
private void button2_Click(object sender, EventArgs e) { AddVkladForm f = new AddVkladForm(allClients, allProgs); DialogResult result = f.ShowDialog(this); if (result == DialogResult.Cancel) { return; } VkladMod vklad = new VkladMod(); vklad.Balance = (int)f.comboBoxClient.SelectedValue; vklad.DateOpen = DateTime.Now; dbOperations.CreateVklad(vklad); RefreshgvVklads(); }