public void BeginTransaction(transactiontype_enum mode = transactiontype_enum.TRANSACTION_GENERAL)
 {
     if (this.projectWasInTransaction == false)
     {
         project.BeginTransaction(territory, mode);
     }
 }
Beispiel #2
0
        public void PerformInTransaction(
            voidDelegate d,
            transactiontype_enum mode = transactiontype_enum.TRANSACTION_GENERAL,
            bool abort = true)
        {
            this.projectWasInTransaction = (project.ProjectStatus & 8) != 0;
            this.projectHasBeenAborted = false;

            if (this.projectWasInTransaction == false)
            {
                BeginTransaction(mode);
            }

            if (this.projectWasInTransaction && abort)
            {
                CommitTransaction();
                BeginTransaction(mode);
            }

            try
            {
                d();
                if (abort)
                {
                    AbortTransaction();
                    projectHasBeenAborted = true;
                    if (this.projectWasInTransaction)
                    {
                        BeginTransaction(mode);
                    }
                }
                else
                {
                    if (this.projectWasInTransaction == false)
                    {
                        CommitTransaction();
                    }
                }
            }
            catch
            {
                if (projectHasBeenAborted == false)
                {
                    AbortTransaction();
                }

                if (this.projectWasInTransaction)
                {
                    BeginTransaction(mode);
                }

                throw;
            }
        }
Beispiel #3
0
 public void PerformInTransaction(voidDelegate d, transactiontype_enum mode = transactiontype_enum.TRANSACTION_GENERAL)
 {
     BeginTransaction(mode);
     try
     {
         d();
         CommitTransaction();
     }
     finally
     {
         AbortTransaction();
     }
 }
Beispiel #4
0
 public void PerformInTransaction(voidDelegate d, transactiontype_enum mode = transactiontype_enum.TRANSACTION_GENERAL)
 {
     BeginTransaction(mode);
     try
     {
         d();
         CommitTransaction();
     }
     finally
     {
         AbortTransaction();
     }
 }
Beispiel #5
0
        public void PerformInTransaction(
                   voidDelegate d,
                   transactiontype_enum mode = transactiontype_enum.TRANSACTION_GENERAL,
                   bool abort = true)
        {
            this.projectWasInTransaction = (project.ProjectStatus & 8) != 0;

            if (this.projectWasInTransaction == false)
            {
                BeginTransaction(mode);
            }

            if (this.projectWasInTransaction && abort)
            {
                CommitTransaction();
                BeginTransaction(mode);
            }

            try
            {
                d();
                if (abort)
                {
                    AbortTransaction();
                    if (this.projectWasInTransaction)
                    {
                        BeginTransaction(mode);
                    }
                }
                else
                {
                    if (this.projectWasInTransaction == false)
                    {
                        CommitTransaction();
                    }
                }
            }
            catch (Exception ex)
            {
                // TODO: What should we do here?
                throw ex;
            }
        }
Beispiel #6
0
        public void PerformInTransaction(
            voidDelegate d,
            transactiontype_enum mode = transactiontype_enum.TRANSACTION_GENERAL)
        {
            this.projectWasInTransaction = (project.ProjectStatus & 8) != 0;

            this.BeginTransaction(mode);

            try
            {
                d();
                this.CommitTransaction();
            }
            catch (Exception)
            {
                // TODO: What should we do here?
               throw;
            }
        }
Beispiel #7
0
 public void PerformInTransaction(voidDelegate d,
                                  transactiontype_enum mode = transactiontype_enum.TRANSACTION_GENERAL,
                                  bool abort = true)
 {
     BeginTransaction(mode);
     try
     {
         d();
         if (abort)
         {
             AbortTransaction();
         }
         else
         {
             CommitTransaction();
         }
     }
     finally
     {
         AbortTransaction();
     }
 }
Beispiel #8
0
        public void PerformInTransaction(
            voidDelegate d,
            transactiontype_enum mode = transactiontype_enum.TRANSACTION_NON_NESTED,
            bool abort = true)
        {
            this.projectWasInTransaction = (project.ProjectStatus & 8) != 0;
            this.projectHasBeenAborted   = false;

            if (this.projectWasInTransaction == false)
            {
                BeginTransaction(mode);
            }

            try
            {
                d();
                if (this.projectWasInTransaction == false && abort)
                {
                    projectHasBeenAborted = true;
                    AbortTransaction();
                }
                else if (this.projectWasInTransaction == false)
                {
                    CommitTransaction();
                }
            }
            catch
            {
                if (this.projectWasInTransaction == false && projectHasBeenAborted == false)
                {
                    AbortTransaction();
                }

                throw;
            }
        }
Beispiel #9
0
 public void BeginTransaction(transactiontype_enum mode = transactiontype_enum.TRANSACTION_GENERAL)
 {
     project.BeginTransaction(territory, mode);
 }
        private void ExecuteInTransaction(MgaProject project, Action doWork, bool abort = false, transactiontype_enum type = transactiontype_enum.TRANSACTION_NON_NESTED)
        {
            if (project == null ||
                doWork == null)
            {
                throw new ArgumentNullException();
            }

            bool inTx = (project.ProjectStatus & 8) != 0;
            if (inTx)
            {
                doWork();
                return;
            }
            project.BeginTransactionInNewTerr(type);

            try
            {
                doWork();

                if (abort)
                {
                    project.AbortTransaction();
                }
                else
                {
                    project.CommitTransaction();
                }
                project.FlushUndoQueue();
            }
            catch (Exception)
            {
                try
                {
                    project.AbortTransaction();
                }
                catch
                {
                }

                throw;
            }
        }
        private void ExecuteInTransaction(IMgaObject context, Action doWork, bool abort = false, transactiontype_enum type = transactiontype_enum.TRANSACTION_NON_NESTED)
        {
            if (context == null ||
                doWork == null)
            {
                throw new ArgumentNullException();
            }

            this.ExecuteInTransaction(context.Project, doWork, abort, type);
        }
Beispiel #12
0
 public void BeginTransaction(transactiontype_enum mode = transactiontype_enum.TRANSACTION_GENERAL)
 {
     project.BeginTransaction(territory, mode);
 }
 public void BeginTransaction(transactiontype_enum mode = transactiontype_enum.TRANSACTION_GENERAL)
 {
     project.BeginTransactionInNewTerr(mode);
 }
		public void PerformInTransaction(voidDelegate d, transactiontype_enum mode = transactiontype_enum.TRANSACTION_GENERAL)
		{
			BeginTransaction(mode);
			try
			{
				d();
				CommitTransaction();
			}
			catch (Exception)
			{
				try
				{
					AbortTransaction();
				}
				catch { }
				throw;
			}
		}
Beispiel #15
0
        public void BeginTransaction(transactiontype_enum mode = transactiontype_enum.TRANSACTION_GENERAL)
        {
            var territory = project.BeginTransactionInNewTerr(mode);

            Marshal.FinalReleaseComObject(territory);
        }
Beispiel #16
0
 public void BeginTransaction(transactiontype_enum mode = transactiontype_enum.TRANSACTION_GENERAL)
 {
     var territory = project.BeginTransactionInNewTerr(mode);
     Marshal.FinalReleaseComObject(territory);
 }