コード例 #1
0
        protected static FR_L3WH_GRPaQCIfH_0905_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L3WH_GRPaQCIfH_0905 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L3WH_GRPaQCIfH_0905_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL3_Warehouse.Atomic.Retrieval.SQL.cls_Get_ReceiptPositions_and_QualityControlItems_for_HeaderID.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, "ReceiptHeaderID", Parameter.ReceiptHeaderID);



            List <L3WH_GRPaQCIfH_0905> results = new List <L3WH_GRPaQCIfH_0905>();
            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[] { "LOG_RCP_Receipt_PositionID", "Receipt_Header_RefID", "ReceiptPosition_Product_RefID", "LOG_RCP_Receipt_Position_QualityControlItem", "Receipt_Position_RefID", "Quantity", "BatchNumber", "SerialKey", "ExpiryDate", "Target_WRH_Shelf_RefID" });
                while (reader.Read())
                {
                    L3WH_GRPaQCIfH_0905 resultItem = new L3WH_GRPaQCIfH_0905();
                    //0:Parameter LOG_RCP_Receipt_PositionID of type Guid
                    resultItem.LOG_RCP_Receipt_PositionID = reader.GetGuid(0);
                    //1:Parameter Receipt_Header_RefID of type Guid
                    resultItem.Receipt_Header_RefID = reader.GetGuid(1);
                    //2:Parameter ReceiptPosition_Product_RefID of type Guid
                    resultItem.ReceiptPosition_Product_RefID = reader.GetGuid(2);
                    //3:Parameter LOG_RCP_Receipt_Position_QualityControlItem of type Guid
                    resultItem.LOG_RCP_Receipt_Position_QualityControlItem = reader.GetGuid(3);
                    //4:Parameter Receipt_Position_RefID of type Guid
                    resultItem.Receipt_Position_RefID = reader.GetGuid(4);
                    //5:Parameter Quantity of type double
                    resultItem.Quantity = reader.GetDouble(5);
                    //6:Parameter BatchNumber of type String
                    resultItem.BatchNumber = reader.GetString(6);
                    //7:Parameter SerialKey of type String
                    resultItem.SerialKey = reader.GetString(7);
                    //8:Parameter ExpiryDate of type DateTime
                    resultItem.ExpiryDate = reader.GetDate(8);
                    //9:Parameter Target_WRH_Shelf_RefID of type Guid
                    resultItem.Target_WRH_Shelf_RefID = reader.GetGuid(9);

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

            returnStatus.Result = results.ToArray();
            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_L3WH_GRPaQCIfH_0905_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L3WH_GRPaQCIfH_0905 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_L3WH_GRPaQCIfH_0905_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3WH_GRPaQCIfH_0905 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L3WH_GRPaQCIfH_0905_Array functionReturn = new FR_L3WH_GRPaQCIfH_0905_Array();

            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_Get_ReceiptPositions_and_QualityControlItems_for_HeaderID", ex);
            }
            return(functionReturn);
        }
コード例 #4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L3WH_GRPaQCIfH_0905_Array Invoke(string ConnectionString, P_L3WH_GRPaQCIfH_0905 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }