public void CancelEditsToBusinessObject(IBusinessObject bo)
 {
     bo.CancelEdits();
     if (bo.Status.IsNew)
     {
         bo.MarkForDelete();
     }
 }
示例#2
0
 public void CancelEditsToBusinessObject(IBusinessObject bo)
 {
     bo.CancelEdits();
     if (bo.Status.IsNew)
     {
         bo.MarkForDelete();
     }
 }
 ///<summary>
 /// Deletes the given business object
 ///</summary>
 ///<param name="businessObject">The business object to delete</param>
 public virtual void DeleteBusinessObject(IBusinessObject businessObject)
 {
     try
     {
         businessObject.MarkForDelete();
         var committer = BORegistry.DataAccessor.CreateTransactionCommitter();
         committer.AddBusinessObject(businessObject);
         committer.CommitTransaction();
     }
     catch (Exception)
     {
         businessObject.CancelEdits();
         throw;
     }
 }
 ///<summary>
 /// Deletes the given business object
 ///</summary>
 ///<param name="businessObject">The business object to delete</param>
 public virtual void DeleteBusinessObject(IBusinessObject businessObject)
 {
     try
     {
         businessObject.MarkForDelete();
         var committer = BORegistry.DataAccessor.CreateTransactionCommitter();
         committer.AddBusinessObject(businessObject);
         committer.CommitTransaction();
     }
     catch (Exception)
     {
         businessObject.CancelEdits();
         throw;
     }
 }
示例#5
0
 private void CancelChangesToBusinessObject(IBusinessObject currentBO, bool selectLastRowInGrid)
 {
     if (currentBO.Status.IsNew)
     {
         _lastSelectedBusinessObject = null;
         ReadOnlyGridControl.Grid.BusinessObjectCollection.Remove(currentBO);
         if (selectLastRowInGrid)
         {
             SelectLastRowInGrid();
         }
     }
     else
     {
         currentBO.CancelEdits();
     }
 }
        private void CancelButtonClicked(object sender, EventArgs e)
        {
            IBusinessObject currentBO = CurrentBusinessObject ?? _newBO;

            if (currentBO.Status.IsNew)
            {
                _lastSelectedBusinessObject = null;
                _readOnlyGridControl.Grid.BusinessObjectCollection.Remove(currentBO);
                SelectLastRowInGrid();
            }
            else
            {
                currentBO.CancelEdits();
            }
            UpdateControlEnabledState();

            RefreshGrid();
        }
 private void CancelButtonClicked(object sender, EventArgs e)
 {
     try
     {
         IBusinessObject currentBO = CurrentBusinessObject ?? _newBO;
         if (currentBO.Status.IsNew)
         {
             _lastSelectedBusinessObject = null;
             _readOnlyGridControl.Grid.BusinessObjectCollection.Remove(currentBO);
             SelectLastRowInGrid();
         }
         else
         {
             currentBO.CancelEdits();
         }
         UpdateControlEnabledState();
         RefreshGrid();
     }
     catch (Exception ex)
     {
         GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error ");
     }
 }
 ///<summary>
 /// Deletes the <paramref name="selectedBo"/> using the
 /// <see cref="IReadOnlyGridControl.BusinessObjectDeletor"/>.
 /// Rolls back the delete and notifies the user if any errors occur
 ///</summary>
 ///<param name="selectedBo"></param>
 public void DeleteBusinessObject(IBusinessObject selectedBo)
 {
     GridControl.SelectedBusinessObject = null;
     try
     {
         GridControl.BusinessObjectDeletor.DeleteBusinessObject(selectedBo);
     }
     catch (Exception ex)
     {
         try
         {
             selectedBo.CancelEdits();
             GridControl.SelectedBusinessObject = selectedBo;
         }
             // ReSharper disable EmptyGeneralCatchClause
         catch
         {
             //Do nothing
         }
         // ReSharper restore EmptyGeneralCatchClause
         GlobalRegistry.UIExceptionNotifier.Notify(ex, "There was a problem deleting",
                                                   "Problem Deleting");
     }
 }
 ///<summary>
 /// Deletes the <paramref name="selectedBo"/> using the
 /// <see cref="IReadOnlyGridControl.BusinessObjectDeletor"/>.
 /// Rolls back the delete and notifies the user if any errors occur
 ///</summary>
 ///<param name="selectedBo"></param>
 public void DeleteBusinessObject(IBusinessObject selectedBo)
 {
     GridControl.SelectedBusinessObject = null;
     try
     {
         GridControl.BusinessObjectDeletor.DeleteBusinessObject(selectedBo);
     }
     catch (Exception ex)
     {
         try
         {
             selectedBo.CancelEdits();
             GridControl.SelectedBusinessObject = selectedBo;
         }
         // ReSharper disable EmptyGeneralCatchClause
         catch
         {
             //Do nothing
         }
         // ReSharper restore EmptyGeneralCatchClause
         GlobalRegistry.UIExceptionNotifier.Notify(ex, "There was a problem deleting",
                                                   "Problem Deleting");
     }
 }