private void button1_Click(object sender, EventArgs e) { AddClientForm cf = new AddClientForm(); cf.Show(); this.Hide(); }
private void buttonAdd_Click(object sender, EventArgs e) { var addClientForm = new AddClientForm(); addClientForm.ShowDialog(); MainFormUtils.SetRoot(treeViewClients, _clientService.GetRootClients()); }
// Добавление private void tbAdd_Click(object sender, EventArgs e) { AddClientForm ClientTab = new AddClientForm(); DialogResult result = ClientTab.ShowDialog(this); if (result == DialogResult.Cancel) { return; } client client = new client(); client.fio = ClientTab.textBox_fio.Text; var s = ClientTab.textBox_pas.Text; client.pass = Convert.ToInt32(s); client.born = ClientTab.dateTimePicker_born.Value; var id = ClientTab.textBox_id.Text; client.idclient = Convert.ToInt32(id); dbcontex.client.Add(client); dbcontex.SaveChanges(); MessageBox.Show("Новый объект добавлен"); }
public OrderForm(order order) { this.order = order; InitializeComponent(); client_form = new AddClientForm(order); film_form = new AddFilmForm(order); dateTimePicker1.Value = order.issue_date; dateTimePicker2.Value = order.return_date; numericUpDown_OrderCost.Value = order.cost; }
private void ShowNewClient(Client client) { if (this.ActiveMdiChild != null) { this.ActiveMdiChild.Close(); } AddClientForm addClientForm = new AddClientForm(_accessToken, client); addClientForm.MdiParent = this; addClientForm.WindowState = FormWindowState.Maximized; addClientForm.ControlBox = false; addClientForm.MaximizeBox = false; addClientForm.MinimizeBox = false; addClientForm.ShowIcon = false; addClientForm.Show(); }
// Изменение private void tbEdit_Click(object sender, EventArgs e) { int index = getSelectedRow(dataGridView1); if (index != -1) { int id = 0; bool converted = Int32.TryParse(dataGridView1[0, index].Value.ToString(), out id); if (converted == false) { return; } client client = dbcontex.client.Where(i => i.idclient == id).FirstOrDefault(); if (client != null) { AddClientForm ClientTab = new AddClientForm(); ClientTab.textBox_fio.Text = client.fio; ClientTab.textBox_pas.Text = client.pass.Value.ToString(); ClientTab.dateTimePicker_born.Text = client.born.ToString(); ClientTab.textBox_id.Text = client.idclient.ToString(); DialogResult result = ClientTab.ShowDialog(this); if (result == DialogResult.Cancel) { return; } client.fio = ClientTab.textBox_fio.Text; var s = ClientTab.textBox_pas.Text; client.pass = Convert.ToInt32(s); client.born = ClientTab.dateTimePicker_born.Value; var idClient = ClientTab.textBox_id.Text; client.idclient = Convert.ToInt32(idClient); dbcontex.SaveChanges(); dataGridView1.Refresh(); // обновляем грид MessageBox.Show("Объект обновлен"); } } }
private void toolStripButton1_Click(object sender, EventArgs e) { AddClientForm addclientfrm = new AddClientForm(); OpenForm(addclientfrm); }