示例#1
0
        protected static FR_L5SR_GQCIfRHId_1359_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5SR_GQCIfRHId_1359 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L5SR_GQCIfRHId_1359_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_APOLogistic_StockReceipt.Atomic.Retrieval.SQL.cls_Get_QualityControlItems_for_ReceiptHeaderID.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, "HeaderID", Parameter.HeaderID);



            List <L5SR_GQCIfRHId_1359> results = new List <L5SR_GQCIfRHId_1359>();
            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_Position_QualityControlItem", "Quantity", "BatchNumber", "ExpiryDate", "Product_Name_DictID", "Product_Number", "LOG_WRH_ShelfID", "CoordinateCodeArea", "CoordinateCodeWarehouse", "CoordinateCodeRack", "CoordinateCodeShelf", "LOG_RCP_Receipt_HeaderID", "ProductID", "ReceiptNumber" });
                while (reader.Read())
                {
                    L5SR_GQCIfRHId_1359 resultItem = new L5SR_GQCIfRHId_1359();
                    //0:Parameter LOG_RCP_Receipt_Position_QualityControlItem of type Guid
                    resultItem.LOG_RCP_Receipt_Position_QualityControlItem = reader.GetGuid(0);
                    //1:Parameter Quantity of type String
                    resultItem.Quantity = reader.GetString(1);
                    //2:Parameter BatchNumber of type String
                    resultItem.BatchNumber = reader.GetString(2);
                    //3:Parameter ExpiryDate of type DateTime
                    resultItem.ExpiryDate = reader.GetDate(3);
                    //4:Parameter Product_Name of type Dict
                    resultItem.Product_Name             = reader.GetDictionary(4);
                    resultItem.Product_Name.SourceTable = "cmn_pro_products";
                    loader.Append(resultItem.Product_Name);
                    //5:Parameter Product_Number of type String
                    resultItem.Product_Number = reader.GetString(5);
                    //6:Parameter LOG_WRH_ShelfID of type Guid
                    resultItem.LOG_WRH_ShelfID = reader.GetGuid(6);
                    //7:Parameter CoordinateCodeArea of type String
                    resultItem.CoordinateCodeArea = reader.GetString(7);
                    //8:Parameter CoordinateCodeWarehouse of type String
                    resultItem.CoordinateCodeWarehouse = reader.GetString(8);
                    //9:Parameter CoordinateCodeRack of type String
                    resultItem.CoordinateCodeRack = reader.GetString(9);
                    //10:Parameter CoordinateCodeShelf of type String
                    resultItem.CoordinateCodeShelf = reader.GetString(10);
                    //11:Parameter LOG_RCP_Receipt_HeaderID of type Guid
                    resultItem.LOG_RCP_Receipt_HeaderID = reader.GetGuid(11);
                    //12:Parameter ProductID of type Guid
                    resultItem.ProductID = reader.GetGuid(12);
                    //13:Parameter ReceiptNumber of type String
                    resultItem.ReceiptNumber = reader.GetString(13);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw new Exception("Exception occured durng data retrieval in method cls_Get_QualityControlItems_for_ReceiptHeaderID", 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_L5SR_GQCIfRHId_1359_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L5SR_GQCIfRHId_1359 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_L5SR_GQCIfRHId_1359_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5SR_GQCIfRHId_1359 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

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