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

            FR_L6US_GURT_1054 functionReturn = new FR_L6US_GURT_1054();

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

                functionReturn = Execute(Connection, Transaction, 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_Get_UserRunningTimes", ex);
            }
            return(functionReturn);
        }
Exemple #2
0
        protected static FR_L6US_GURT_1054 Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_L6US_GURT_1054();
            //Put your code here
            returnValue.Result = new L6US_GURT_1054();
            ORM_USR_Account_ApplicationSetting.Query ApplicationSettingsQuery = new ORM_USR_Account_ApplicationSetting.Query();
            ApplicationSettingsQuery.Account_RefID = securityTicket.AccountID;
            ApplicationSettingsQuery.Tenant_RefID  = securityTicket.TenantID;
            ApplicationSettingsQuery.ItemValue     = EnumUtils.GetEnumDescription(RunningTimes.Item_Key);
            if (ORM_USR_Account_ApplicationSetting.Query.Exists(Connection, Transaction, ApplicationSettingsQuery))
            {
                Guid DefinitionID = ORM_USR_Account_ApplicationSetting.Query.Search(Connection, Transaction, ApplicationSettingsQuery).FirstOrDefault().ApplicationSetting_Definition_RefID;
                ORM_USR_Account_ApplicationSetting_Definition ApplicationDefinition = new ORM_USR_Account_ApplicationSetting_Definition();
                ApplicationDefinition.Load(Connection, Transaction, DefinitionID);
                returnValue.Result.UserRunningTimesXML = ApplicationDefinition.DefaultValue;
            }
            return(returnValue);

            #endregion UserCode
        }