Example #1
0
        public void SaveChanges()
        {
            InvoiceDetailbindingSource.EndEdit();
            _invoice = (Invoice)InvoiceDetailbindingSource.DataSource;
            try
            {
                _context.SaveChanges();
            }

            catch (Exception)
            {
                ViewHelper.ShowSaveError();
                return;
            }
        }
Example #2
0
        public void DeleteObject()
        {
            if (_newMode)
            {
                return;
            }
            InvoiceDetailbindingSource.EndEdit();
            var invoice = (Invoice)InvoiceDetailbindingSource.DataSource;

            try
            {
                //_context.Invoices.DeleteObject(invoice);
                _context.SaveChanges();
                Close();
            }
            catch (Exception e)
            {
                ViewHelper.ShowDeleteError();
                ErrorLogger.LogError(this, e);
            }
        }