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

            addForm.addLineItem = true;

            lineItem           = new InvoiceLineItem();
            lineItem.invoiceID = Convert.ToInt32(lineItemsNumber.Text);
            addForm.lineItem   = lineItem;

            DialogResult result = addForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                lineItem = addForm.lineItem;
                lineItemsIDTextBox.Text = lineItem.lineItemsID.ToString();
                this.Display();
            }
        }
Example #2
0
        private void ModifyBtn_Click(object sender, EventArgs e)
        {
            if (lineItemsIDTextBox.Text.Length == 0)
            {
                MessageBox.Show("Please select an invoice first.");
                return;
            }


            int lineID = Convert.ToInt32(lineItemsIDTextBox.Text);

            MessageBox.Show(lineID + "");

            this.GetLineItem(lineID);

            MessageBox.Show(lineItem.lineItemsID + "");

            lineItemsAddModifyForm modifyForm = new lineItemsAddModifyForm();

            modifyForm.addLineItem = false;
            modifyForm.lineItem    = this.lineItem;
            DialogResult result = modifyForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                lineItem = modifyForm.lineItem;
                this.Display();
            }
            else if (result == DialogResult.Retry)
            {
                this.GetLineItem(lineItem.lineItemsID);
                if (lineItem != null)
                {
                    this.Display();
                }
                else
                {
                    this.ClearControls();
                }
            }
        }