Ejemplo n.º 1
0
        public void SaveChanges()
        {
            if (!ValidateForm())
            {
                return;
            }

            CustomerDataBindingSource.EndEdit();
            _customer = (Customer)CustomerDataBindingSource.DataSource;
            AddDefaultContract();
            try
            {
                _context.Customers.AddObject(_customer);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                ViewHelper.ShowSaveError();
                ErrorLogger.LogError(this, e);
            }
            if (_saveAndNew)
            {
                _customer = new Customer();
                CustomerDataBindingSource.DataSource = _customer;
                LoadLookups();
            }
            else
            {
                var cdv = new CustomerDetailView();
                cdv.ShowObject(_customer);
                cdv.MdiParent = this.MainForm;
                cdv.Show();
                this.Close();
            }
        }
Ejemplo n.º 2
0
 public void OpenSelectedItem()
 {
     if (_customer != null)
     {
         var customerDetailView = new CustomerDetailView();
         customerDetailView.ShowObject(_customer);
         customerDetailView.MdiParent = this.MdiParent;
         customerDetailView.Show();
     }
 }