private void dataGridViewClients_DoubleClick(object sender, EventArgs e) { if (dataGridViewClients.CurrentCell != null) { int clientID = Convert.ToInt32(_db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex].ItemArray[0]); Client clnt = new Client(); clnt.SetValues(clientID, _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["LastName"].ToString(), _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["FirstName"].ToString(), _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["MiddleName"].ToString(), _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["Sex"].ToString(), Convert.ToDateTime(_db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["BirthDay"]), _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["Phone1"].ToString(), _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["Phone2"].ToString(), _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["Phone3"].ToString(), _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["Adress"].ToString(), Convert.ToDouble(_db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["SumOrders"]), Convert.ToInt32(_db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["Discount"]), _db._ds.Tables["Client"].Rows[dataGridViewClients.CurrentCell.RowIndex]["FirmName"].ToString() ); ClientForm cf = new ClientForm(clnt); cf.ShowDialog(); clnt = cf.client; if (clnt.Id != 0) { client.SetClient(clnt); //_waitForResponse.WaitOne(); } } else { MessageBox.Show(@"Нажмите в строке, чтобы выделить клиента", @"Error" ); } }
private void NewClientBtn_Click(object sender, EventArgs e) { Client clnt = new Client(); clnt.SetId(client.GetCurIdentity("Client") + 1); ClientForm cf = new ClientForm(clnt); cf.ShowDialog(); clnt = cf.client; if (clnt.Id != 0) { client.SetClient(clnt); //_waitForResponse.WaitOne(); } }