Пример #1
0
        protected static FR_L3DAC_RACDbID_1431 Execute(DbConnection Connection, DbTransaction Transaction, P_L3DAC_RACDbID_1431 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L3DAC_RACDbID_1431();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL3_DeviceAccountCodes.Atomic.Retrieval.SQL.cls_Retrive_Account_Code_Details_byAccID.sql";

            command.CommandText = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(commandLocation)).ReadToEnd();
            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ticket", securityTicket);
            command.CommandTimeout = QueryTimeout;

            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Account_RefID", Parameter.Account_RefID);



            List <L3DAC_RACDbID_1431> results = new List <L3DAC_RACDbID_1431>();
            var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
            var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader());

            try
            {
                reader.SetOrdinals(new string[] { "Account_RefID", "USR_Device_AccountCodeID", "AccountCode_Value", "AccountCode_ValidFrom", "AccountCode_ValidTo", "IsAccountCode_Expirable", "AccountCode_CurrentStatus_RefID", "AccountCode_NumberOfAccesses_MaximumValue", "AccountCode_NumberOfAccesses_CurrentValue", "Tenant_RefID" });
                while (reader.Read())
                {
                    L3DAC_RACDbID_1431 resultItem = new L3DAC_RACDbID_1431();
                    //0:Parameter Account_RefID of type Guid
                    resultItem.Account_RefID = reader.GetGuid(0);
                    //1:Parameter USR_Device_AccountCodeID of type Guid
                    resultItem.USR_Device_AccountCodeID = reader.GetGuid(1);
                    //2:Parameter AccountCode_Value of type String
                    resultItem.AccountCode_Value = reader.GetString(2);
                    //3:Parameter AccountCode_ValidFrom of type DateTime
                    resultItem.AccountCode_ValidFrom = reader.GetDate(3);
                    //4:Parameter AccountCode_ValidTo of type DateTime
                    resultItem.AccountCode_ValidTo = reader.GetDate(4);
                    //5:Parameter IsAccountCode_Expirable of type bool
                    resultItem.IsAccountCode_Expirable = reader.GetBoolean(5);
                    //6:Parameter AccountCode_CurrentStatus_RefID of type Guid
                    resultItem.AccountCode_CurrentStatus_RefID = reader.GetGuid(6);
                    //7:Parameter AccountCode_NumberOfAccesses_MaximumValue of type String
                    resultItem.AccountCode_NumberOfAccesses_MaximumValue = reader.GetString(7);
                    //8:Parameter AccountCode_NumberOfAccesses_CurrentValue of type String
                    resultItem.AccountCode_NumberOfAccesses_CurrentValue = reader.GetString(8);
                    //9:Parameter Tenant_RefID of type Guid
                    resultItem.Tenant_RefID = reader.GetGuid(9);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw new Exception("Exception occured durng data retrieval in method cls_Retrive_Account_Code_Details_byAccID", ex);
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = results.FirstOrDefault();
            return(returnStatus);
        }
Пример #2
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L3DAC_RACDbID_1431 Invoke(DbConnection Connection, DbTransaction Transaction, P_L3DAC_RACDbID_1431 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
Пример #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L3DAC_RACDbID_1431 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3DAC_RACDbID_1431 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L3DAC_RACDbID_1431 functionReturn = new FR_L3DAC_RACDbID_1431();

            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_Retrive_Account_Code_Details_byAccID", ex);
            }
            return(functionReturn);
        }
Пример #4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L3DAC_RACDbID_1431 Invoke(string ConnectionString, P_L3DAC_RACDbID_1431 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }