Exemplo n.º 1
0
        private void DeleteButtonClicked(object sender, EventArgs e)
        {
            if (CurrentBusinessObject == null)
            {
                return;
            }

            IBusinessObject businessObject = CurrentBusinessObject;

            RemoveGridSelectionEvent();
            if (businessObject.Status.IsNew)
            {
                //RemoveGridSelectionEvent();
                ReadOnlyGridControl.SelectedBusinessObject = null;
                ReadOnlyGridControl.Grid.BusinessObjectCollection.Remove(businessObject);
                //AddGridSelectionEvent();
            }
            else
            {
                businessObject.MarkForDelete();
                businessObject.Save();
            }
            AddGridSelectionEvent();
            _lastSelectedBusinessObject = null;

            if (CurrentBusinessObject == null && ReadOnlyGridControl.Grid.Rows.Count > 0)
            {
                SelectLastRowInGrid();
            }
            UpdateControlEnabledState();
        }
 public void CancelEditsToBusinessObject(IBusinessObject bo)
 {
     bo.CancelEdits();
     if (bo.Status.IsNew)
     {
         bo.MarkForDelete();
     }
 }
Exemplo n.º 3
0
 public void CancelEditsToBusinessObject(IBusinessObject bo)
 {
     bo.CancelEdits();
     if (bo.Status.IsNew)
     {
         bo.MarkForDelete();
     }
 }
        private void DeleteButtonClicked(object sender, EventArgs e)
        {
            IBusinessObject businessObject = CurrentBusinessObject;

            businessObject.MarkForDelete();
            businessObject.Save();

            if (CurrentBusinessObject == null && _readOnlyGridControl.Grid.Rows.Count > 0)
            {
                SelectLastRowInGrid();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Deletes the Child Bo identified by <paramref name="bo"/>
        /// </summary>
        /// <param name="committer"></param>
        /// <param name="bo"></param>
        protected virtual void DeleteChild(TransactionCommitter committer, IBusinessObject bo)
        {
            if (bo == null)
            {
                return;
            }
            if (!bo.Status.IsDeleted)
            {
                bo.MarkForDelete();
            }
//            if (bo.Status.IsNew) return;
            committer.ExecuteTransactionToDataSource(committer.CreateTransactionalBusinessObject(bo));
        }
Exemplo n.º 6
0
 ///<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;
     }
 }
Exemplo n.º 7
0
 ///<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;
     }
 }
        private void DeleteButtonClicked(object sender, EventArgs e)
        {
            try
            {
                IBusinessObject businessObject = CurrentBusinessObject;
                businessObject.MarkForDelete();
                businessObject.Save();

                if (CurrentBusinessObject == null && _readOnlyGridControl.Grid.Rows.Count > 0)
                {
                    SelectLastRowInGrid();
                }
            }
            catch (Exception ex)
            {
                GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error ");
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Handles the event of a row being deleted
        /// </summary>
        /// <param name="sender">The object that notified of the event</param>
        /// <param name="e">Attached arguments regarding the event</param>
        private void RowDeletedHandler(object sender, DataRowChangeEventArgs e)
        {
            DataRow row = e.Row;

            try
            {
                IBusinessObject changedBo = GetBusinessObjectForRow(row);
                if (changedBo == null)
                {
                    return;
                }
                try
                {
                    string message;
                    if (changedBo.IsDeletable(out message))
                    {
                        DeregisterForBOEvents();
                        changedBo.MarkForDelete();
                        changedBo.Save();
                    }
                    else
                    {
                        row.RejectChanges();
                    }
                }
                finally
                {
                    RegisterForBOEvents();
                }
            }
            catch (Exception ex)
            {
                string message = "There was a problem saving. : " + ex.Message;
                row.RowError = message;
                GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error ");
            }
        }
Exemplo n.º 10
0
		/// <summary>
		/// Deletes the Child Bo identified by <paramref name="bo"/>
		/// </summary>
		/// <param name="committer"></param>
		/// <param name="bo"></param>
		protected virtual void DeleteChild(TransactionCommitter committer, IBusinessObject bo)
		{
			if (bo == null) return;
			if (!bo.Status.IsDeleted)
			{
				bo.MarkForDelete();
			}
//            if (bo.Status.IsNew) return;
			committer.ExecuteTransactionToDataSource(committer.CreateTransactionalBusinessObject(bo));
		}
 private static void CleanupObjectFromDatabase(IBusinessObject bo)
 {
     bo.MarkForDelete();
     bo.Save();
 }