Beispiel #1
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L2AS_GUSfA_1609 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L2AS_GUSfA_1609 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L2AS_GUSfA_1609 functionReturn = new FR_L2AS_GUSfA_1609();

            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 ex;
            }
            return(functionReturn);
        }
Beispiel #2
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L2AS_GUSfA_1609 Invoke(string ConnectionString, P_L2AS_GUSfA_1609 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }
Beispiel #3
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L2AS_GUSfA_1609 Invoke(DbConnection Connection, DbTransaction Transaction, P_L2AS_GUSfA_1609 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
Beispiel #4
0
        protected static FR_L2AS_GUSfA_1609 Execute(DbConnection Connection, DbTransaction Transaction, P_L2AS_GUSfA_1609 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L2AS_GUSfA_1609();
            returnValue.Result = new L2AS_GUSfA_1609();

            var hasSubscription    = false;
            var isTenantSubscribed = false;

            #region ORM_CMN_Tenant_ApplicationSubscription

            var query1 = new ORM_CMN_Tenant_ApplicationSubscription.Query();
            query1.Application_RefID = Parameter.ApplicationID;
            query1.Tenant_RefID      = securityTicket.TenantID;
            query1.IsDeleted         = false;
            query1.IsDisabled        = false;

            var subscription = ORM_CMN_Tenant_ApplicationSubscription.Query.Search(Connection, Transaction, query1);

            if (subscription.Count() == 0)
            {
                returnValue.Result.HasSubscription    = false;
                returnValue.Result.IsTenantSubscribed = false;
                return(returnValue);
            }
            isTenantSubscribed = true;
            #endregion

            #region ORM_CMN_Account_ApplicationSubscription

            var query2 = new ORM_CMN_Account_ApplicationSubscription.Query();
            query2.Application_RefID = subscription.First().Application_RefID;
            query2.Tenant_RefID      = securityTicket.TenantID;
            query2.Account_RefID     = securityTicket.AccountID;
            query2.IsDeleted         = false;
            query2.IsDisabled        = false;

            hasSubscription = ORM_CMN_Account_ApplicationSubscription.Query.Exists(Connection, Transaction, query2);
            returnValue.Result.HasSubscription    = hasSubscription;
            returnValue.Result.IsTenantSubscribed = isTenantSubscribed;
            returnValue.Result.Configuration      = subscription.FirstOrDefault().Configuration;

            #endregion

            return(returnValue);

            #endregion UserCode
        }