コード例 #1
0
ファイル: customerForm.cs プロジェクト: iq/SQLDBFinal
        private void AddBtn_Click(object sender, EventArgs e)
        {
            customerAddModifyForm addCustomerForm = new customerAddModifyForm();

            addCustomerForm.addCustomer = true;
            DialogResult result = addCustomerForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                customer = addCustomerForm.customer;
                customerIDTextBox.Text = customer.CustomerID.ToString();
                this.DisplayCustomer();
            }
        }
コード例 #2
0
ファイル: customerForm.cs プロジェクト: iq/SQLDBFinal
        private void EditBtn_Click(object sender, EventArgs e)
        {
            if (customerIDTextBox.Text.Length == 0)
            {
                MessageBox.Show("Please select a customer first.");
                return;
            }

            int customerID = Convert.ToInt32(customerIDTextBox.Text);

            this.GetCustomer(customerID);

            customerAddModifyForm modifyCustomerForm = new customerAddModifyForm();

            modifyCustomerForm.addCustomer = false;
            modifyCustomerForm.customer    = this.customer;
            DialogResult result = modifyCustomerForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                customer = modifyCustomerForm.customer;
                this.DisplayCustomer();
            }
            else if (result == DialogResult.Retry)
            {
                this.GetCustomer(customer.CustomerID);
                if (customer != null)
                {
                    this.DisplayCustomer();
                }
                else
                {
                    this.ClearControls();
                }
            }
        }