Ejemplo n.º 1
0
        private void addButton_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(customerIdTextBox.Text) || String.IsNullOrEmpty(itemNameTextBox.Text) || String.IsNullOrEmpty(quantityTextBox.Text))
            {
                MessageBox.Show("Field  Cant be Empty!");
                return;
            }

            if (_orderManager.isOrderExist(Convert.ToInt32(customerIdTextBox.Text), itemNameTextBox.Text, Convert.ToInt32(quantityTextBox.Text)))
            {
                MessageBox.Show("Order Alredy Taken!!!");
                return;
            }


            bool isAdded = _orderManager.AddData(Convert.ToInt32(customerIdTextBox.Text), itemNameTextBox.Text, Convert.ToInt32(quantityTextBox.Text));

            if (isAdded)
            {
                MessageBox.Show("Order is Successful.");
            }
            else
            {
                MessageBox.Show("Order cant taken. ");
            }

            showOrderGridView.DataSource = _orderManager.ShowData();
        }