public CustomerDetailsForm(Customer customer = null)
 {
     _isEditForm = false;
     _customer = new Customer();
     InitializeComponent();
     this.buttonCustomerCancel.CausesValidation = false;
     if (customer != null)
     {
         _isEditForm = true;
         this._customer = customer;
         this.textBoxCustomerId.Text = _customer.CustomerId.ToString();
         this.textBoxCustomerId.ReadOnly = true;
         this.textBoxAddress.Text = _customer.Address;
         this.textBoxName.Text = _customer.Name;
         this.textBoxPhoneNumber.Text = _customer.PhoneNum;
     }
 }
 public OrderDetailsForm(Customer selectedCustomer, CustomerContext context, Order editOrder = null)
 {
     _context = context;
     InitializeComponent();
     this.comboBoxClient.DataSource = _context.Customer.Local.ToBindingList();
     if (editOrder != null) // edit order
     {
         _order = editOrder;
         _updateMode = true;
         SetInitialData(editOrder);
     }
     else // add new order
     {
         _order = new Order();
         _updateMode = false;
         if (selectedCustomer != null)
             this.comboBoxClient.SelectedValue = selectedCustomer.CustomerId;
     }
     this.Shown += OrderDetailsForm_Shown;
 }