Exemple #1
0
 private void openCustomerToolStripMenuItem_Click( object sender, EventArgs e )
 {
     using ( SelectCustomerForm selectCustomerForm = new SelectCustomerForm() )
     {
         if ( selectCustomerForm.ShowDialog() == DialogResult.OK )
         {
             CustomerForm customerForm = new CustomerForm();
             customerForm.Customer = selectCustomerForm.SelectedCustomer;
             customerForm.MdiParent = this;
             customerForm.Show();
         }
     }
 }
        private void updateButton_Click( object sender, EventArgs e )
        {
            if ( this.customer == null )
            {
                this.customer = new Customer();
                this.customer.FirstName = this.firstNameTextBox.Text;
                this.customer.LastName = this.lastNameTextBox.Text;
                this.customer.CustomerId = this.customerIdTextBox.Text;
                this.customer = this.customerProcesses.Value.CreateCustomer( this.customer );
            }
            else
            {
                this.customer.FirstName = this.firstNameTextBox.Text;
                this.customer.LastName = this.lastNameTextBox.Text;
                this.customerProcesses.Value.UpdateCustomer( this.customer );
            }

            CustomerForm customerForm = new CustomerForm();
            customerForm.Customer = this.customer;
            customerForm.MdiParent = this.MdiParent;
            customerForm.Show();
            this.Close();
        }