Exemple #1
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            invoiceAddModifyForm addForm = new invoiceAddModifyForm();

            addForm.addInvoice = true;
            DialogResult result = addForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                invoice = addForm.invoice;
                invoiceIDTextBox.Text = invoice.invoiceID.ToString();
                this.DisplayInvoice();
            }
        }
Exemple #2
0
        private void EditBtn_Click(object sender, EventArgs e)
        {
            if (invoiceIDTextBox.Text.Length == 0)
            {
                MessageBox.Show("Please select an invoice first.");
                return;
            }


            int invoiceID = Convert.ToInt32(invoiceIDTextBox.Text);

            this.GetInvoice(invoiceID);

            invoiceAddModifyForm modifyInvoice = new invoiceAddModifyForm();

            modifyInvoice.addInvoice = false;
            modifyInvoice.invoice    = this.invoice;
            DialogResult result = modifyInvoice.ShowDialog();

            if (result == DialogResult.OK)
            {
                invoice = modifyInvoice.invoice;
                this.DisplayInvoice();
            }
            else if (result == DialogResult.Retry)
            {
                this.GetInvoice(invoice.invoiceID);
                if (invoice != null)
                {
                    this.DisplayInvoice();
                }
                else
                {
                    this.ClearControls();
                }
            }
        }