示例#1
0
        protected static FR_CAS_GCFSSoT_1858_Array Execute(DbConnection connection, DbTransaction transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_CAS_GCFSSoT_1858_Array();

            var command = connection.CreateCommand();

            command.Connection  = connection;
            command.Transaction = transaction;
            const string commandLocation = "MMDocConnectDBMethods.Case.Atomic.Retrieval.SQL.cls_Get_Case_FS_Statuses_on_Tenant.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;

            var results = new List <CAS_GCFSSoT_1858>();
            var loader  = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(connection, transaction);
            var reader  = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader());

            try
            {
                reader.SetOrdinals(new[] { "fs_status", "fs_key", "status_date", "gpos_type", "is_status_active", "bill_position_id", "is_status_manually_set", "case_id" });
                while (reader.Read())
                {
                    var resultItem = new CAS_GCFSSoT_1858();
                    //0:parameter fs_status of type int
                    resultItem.fs_status = reader.GetInteger(0);
                    //1:parameter fs_key of type String
                    resultItem.fs_key = reader.GetString(1);
                    //2:parameter status_date of type DateTime
                    resultItem.status_date = reader.GetDate(2);
                    //3:parameter gpos_type of type String
                    resultItem.gpos_type = reader.GetString(3);
                    //4:parameter is_status_active of type Boolean
                    resultItem.is_status_active = reader.GetBoolean(4);
                    //5:parameter bill_position_id of type Guid
                    resultItem.bill_position_id = reader.GetGuid(5);
                    //6:parameter is_status_manually_set of type Boolean
                    resultItem.is_status_manually_set = reader.GetBoolean(6);
                    //7:parameter case_id of type Guid
                    resultItem.case_id = reader.GetGuid(7);

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

            returnStatus.Result = results.ToArray();
            return(returnStatus);
        }
示例#2
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_CAS_GCFSSoT_1858_Array Invoke(DbConnection connection, DbTransaction transaction, string connectionString, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var cleanupConnection  = connection == null;
            var cleanupTransaction = transaction == null;

            var functionReturn = new FR_CAS_GCFSSoT_1858_Array();

            try
            {
                if (cleanupConnection)
                {
                    connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(connectionString);
                    connection.Open();
                }
                if (cleanupTransaction)
                {
                    transaction = connection.BeginTransaction();
                }

                functionReturn = Execute(connection, transaction, securityTicket);

                #region Cleanup Connection/Transaction
                //Commit the transaction
                if (cleanupTransaction)
                {
                    transaction.Commit();
                }
                //Close the connection
                if (cleanupConnection)
                {
                    connection.Close();
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction)
                    {
                        transaction?.Rollback();
                    }
                }
                catch
                {
                    // ignored
                }

                try
                {
                    if (cleanupConnection)
                    {
                        connection?.Close();
                    }
                }
                catch
                {
                    // ignored
                }

                throw new Exception("Exception occurred in method cls_Get_Case_FS_Statuses_on_Tenant", ex);
            }
            return(functionReturn);
        }