Пример #1
0
        private void buttonOrdUpdate_Click(object sender, EventArgs e)
        {
            if (!Validator.IsEmpty(textBoxOrdQuantity))
            {
                MessageBox.Show("Orders must have a valid quantity.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                textBoxAutID.Clear();
                textBoxAutID.Focus();
                return;
            }

            Order aorder = createOrder();
            Order xorder = OrderDA.SearchByNumber(Convert.ToInt32(textBoxOrdNumber.Text));

            Books   abook   = BooksDA.SearchByTitle(comboBoxOrdProduct.Text);
            Clients aclient = ClientsDA.Search(comboBoxOrdClient.Text);

            abook.QOH = (abook.QOH + xorder.OrdQuantity) - aorder.OrdQuantity;
            BooksDA.Update(abook);

            aclient.creditLimit = (aclient.creditLimit + aorder.OrdTotal) - aorder.OrdTotal;
            ClientsDA.Update(aclient);

            OrderDA.Update(aorder);
            OrderDA.ListOrder(listViewOrd);

            buttonOrdList.PerformClick();
            UpdateComboBoxes();
        }