Esempio n. 1
0
        //Delete
        private void buttonClDel_Click(object sender, EventArgs e)
        {
            DialogResult ans = MessageBox.Show("Are you sure you want to delete the Client information?", "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (ans == DialogResult.Yes)
            {
                if (OrderDA.SearchByClientID(Convert.ToInt32(textBoxClID.Text)) != null)
                {
                    MessageBox.Show("This client has open orders in the system, please verify the orders before deleting this client.", "ALERT!");
                    return;
                }
                ClientDA.Delete(Convert.ToInt32(textBoxClID.Text));
                ClientDA.List(listViewSales);
                UpdateComboBoxes();
            }
        }
Esempio n. 2
0
        //Search button
        private void buttonOrdSearch_Click(object sender, EventArgs e)
        {
            Order aorder = new Order();

            if (!string.IsNullOrEmpty(textBoxOrdSearch.Text))
            {
                switch (comboBoxOrdSearch.SelectedIndex)
                {
                case 0:
                    int tempId;
                    if (!int.TryParse(textBoxOrdSearch.Text, out tempId))
                    {
                        MessageBox.Show("Please enter a valid term to be searched.", "No search information!");
                        return;
                    }
                    aorder = OrderDA.SearchID(Convert.ToInt32(textBoxOrdSearch.Text));
                    break;

                case 1:
                    if (!int.TryParse(textBoxOrdSearch.Text, out tempId))
                    {
                        MessageBox.Show("Please enter a valid term to be searched.", "No search information!");
                        return;
                    }
                    aorder = OrderDA.SearchByClientID(Convert.ToInt32(textBoxOrdSearch.Text));
                    break;

                case 2:
                    aorder = OrderDA.SearchByClientName(textBoxOrdSearch.Text);
                    break;
                }

                if (aorder == null)
                {
                    MessageBox.Show("Order not found!", "Not found!");
                    textBoxOrdSearch.Clear();
                    textBoxOrdSearch.Focus();
                    return;
                }

                OrderDA.ListSearch(aorder, listViewOrder);
                return;
            }
            MessageBox.Show("Please enter a valid term to be searched.", "No search information!");
            return;
        }