Пример #1
0
        private void EditBtn_Click(object sender, EventArgs e)
        {
            if (vendorIDTextBox.Text.Length == 0)
            {
                MessageBox.Show("Please select a vendor first.");
                return;
            }
            int vendorID = Convert.ToInt32(vendorIDTextBox.Text);

            this.GetVendor(vendorID);

            vendorAddModifyForm modifyForm = new vendorAddModifyForm();

            modifyForm.addVendor = false;
            modifyForm.vendor    = this.vendor;
            DialogResult result = modifyForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                vendor = modifyForm.vendor;
                this.DisplayVendor();
            }
            else if (result == DialogResult.Retry)
            {
                this.GetVendor(vendor.vendorID);
                if (vendor != null)
                {
                    this.DisplayVendor();
                }
                else
                {
                    this.ClearControls();
                }
            }
        }
Пример #2
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            vendorAddModifyForm addForm = new vendorAddModifyForm();

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

            if (result == DialogResult.OK)
            {
                vendor = addForm.vendor;
                vendorIDTextBox.Text = vendor.vendorID.ToString();
                this.DisplayVendor();
            }
        }