private void AddButton_Click(object sender, EventArgs e) { try { _item.Name = nameTextBox.Text; _item.Price = Convert.ToInt32(priceTextBox.Text); DataTable isSearch = _orderManager.SearchOrder(_item); if (isSearch.Rows.Count > 0) { // customerDataGridView.DataSource = _customerManager.SearchCustomer(searchTextBox.Text); MessageBox.Show("Item Name Exists"); } else { bool isAdded = _orderManager.AddInfo(_item); MessageBox.Show("Saved"); } } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private void AddButton_Click(object sender, EventArgs e) { DataTable isSearch = _orderManager.SearchOrder(nameTextBox.Text); if (isSearch.Rows.Count > 0) { // customerDataGridView.DataSource = _customerManager.SearchCustomer(searchTextBox.Text); MessageBox.Show("Item Name Exists"); } else { bool isAdded = _orderManager.AddInfo(nameTextBox.Text, Convert.ToInt32(priceTextBox.Text)); MessageBox.Show("Saved"); } }