Example #1
0
        protected static FR_Bool Execute(DbConnection Connection, DbTransaction Transaction, P_L3BA_CCB_1646 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Bool();

            #region Booking account

            var bookingAccount = new CL1_ACC_BOK.ORM_ACC_BOK_BookingAccount
            {
                ACC_BOK_BookingAccountID = Guid.NewGuid(),
                BookingAccountName       = Parameter.BookingAccountName,
                BookingAccountNumber     = "000001",
                FiscalYear_RefID         = Parameter.FiscalYearID,
                Tenant_RefID             = securityTicket.TenantID
            };
            bookingAccount.Save(Connection, Transaction);

            #endregion

            #region Create Account assignment to booking account as "Bank Account"

            var accountAssignment = CL3_BookingAccounts.Utils.BookingAccountUtils.GetEmptyBankAccount();
            accountAssignment.ACC_BOK_BookingAccounts_Purpose_BP_AssignmentID = Guid.NewGuid();
            accountAssignment.BookingAccount_RefID      = bookingAccount.ACC_BOK_BookingAccountID;
            accountAssignment.BusinessParticipant_RefID = Parameter.BusinessParticipantID;
            accountAssignment.Tenant_RefID = securityTicket.TenantID;

            accountAssignment.Save(Connection, Transaction);

            #endregion

            #region Bank account

            var bankAccount = new CL1_ACC_CBX.ORM_ACC_CBX_CashBox
            {
                ACC_CBX_CashBoxID = Guid.NewGuid(),
                CashBoxName       = Parameter.BookingAccountName,
                CashBoxNumber     = Parameter.CashBoxNumber,
                Currency_RefID    = Parameter.CurrencyID,
                Tenant_RefID      = securityTicket.TenantID
            };
            bankAccount.Save(Connection, Transaction);

            #endregion

            returnValue.Result = true;
            return(returnValue);

            #endregion UserCode
        }
Example #2
0
 ///<summary>
 /// Ivokes the method with the given Connection, leaving it open if no exceptions occured
 ///<summary>
 public static FR_Bool Invoke(DbConnection Connection, P_L3BA_CCB_1646 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, null, null, Parameter, securityTicket));
 }
Example #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_Bool Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3BA_CCB_1646 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_Bool functionReturn = new FR_Bool();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, Parameter, securityTicket);

                #region Cleanup Connection/Transaction
                //Commit the transaction
                if (cleanupTransaction == true)
                {
                    Transaction.Commit();
                }
                //Close the connection
                if (cleanupConnection == true)
                {
                    Connection.Close();
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw new Exception("Exception occured in method cls_Create_CashBox", ex);
            }
            return(functionReturn);
        }