private void AddClientToOrder_Click(object sender, EventArgs e) { if ((comboBoxOrderCat.SelectedItem != null && comboBoxOrderCat.SelectedItem.ToString() == "Поставка") && textBoxClient.Text != String.Empty) { MessageBox.Show(@"Клиент уже добавлен как поставщик указанных товаров!", @"Поставщик уже добавлен"); return; } ClientFindForm cff = new ClientFindForm(_db._ds.Tables["Client"], _db.Rights); cff.ShowDialog(); Client clnt = cff.clnt; if (clnt.Id != 0) { string clntName = clnt.LastName +@" "+ clnt.FirstName +@" "+ clnt.MiddleName; string clntFullName; if (clnt.FirmName != String.Empty) { clntFullName = clnt.FirmName + @" (" + clntName + @")"; } else { clntFullName = clntName; } textBoxClient.Text = clntFullName + @" Id" + clnt.Id; } }
private void ClientFindBtn_Click(object sender, EventArgs e) { ClientFindForm cff = new ClientFindForm(_db._ds.Tables["Client"], _db.Rights); cff.ShowDialog(); Client clnt = cff.clnt; if (clnt.Id != 0) { foreach (DataGridViewRow row in dataGridViewClients.Rows) { if (Convert.ToInt32(row.Cells[0].Value) == clnt.Id) { bsClients.Position = dataGridViewClients.Rows.IndexOf(row); break; } } } }