Ejemplo n.º 1
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_GRPaARQfA_1501_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L5SR_GRPaARQfA_1501 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
Ejemplo n.º 2
0
        protected static FR_L5SR_GRPaARQfA_1501_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5SR_GRPaARQfA_1501 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5SR_GRPaARQfA_1501_Array();

            var param = new P_L5SR_GRPfA_1343()
            {
                BatchNumber    = Parameter.BatchNumber,
                ExpirationDate = Parameter.ExpirationDate,
                ProductID      = Parameter.ProductID
            };
            var stockReceipts = cls_Get_ReceiptPositions_for_Article.Invoke(Connection, Transaction, param, securityTicket).Result;

            var activeResQuantitiesParam = new P_L3SO_GARQfMCFPSH_1450()
            {
                ProductTrackingInstanceList = stockReceipts.Select(i => i.LOG_ProductTrackingInstance_RefID).ToArray()
            };

            var activeReservedQuantities = cls_Get_ActiveReservedQuantities_for_ManuallyClearedForPickingShippmentHeaders.Invoke(Connection, Transaction, activeResQuantitiesParam, securityTicket).Result;

            var result = new List <L5SR_GRPaARQfA_1501>();

            foreach (var item in stockReceipts)
            {
                var temp = activeReservedQuantities.SingleOrDefault(i => i.LOG_ProductTrackingInstance_RefID == item.LOG_ProductTrackingInstance_RefID);


                result.Add(new L5SR_GRPaARQfA_1501()
                {
                    ReceiptPosition          = item,
                    ActiveReservedQuantities = (temp == null) ? 0: temp.ReservedQuantityFromTrackingInstance
                });
            }

            returnValue.Result = result.ToArray();
            return(returnValue);

            #endregion UserCode
        }
Ejemplo n.º 3
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L5SR_GRPaARQfA_1501_Array Invoke(string ConnectionString, P_L5SR_GRPaARQfA_1501 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }
Ejemplo n.º 4
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5SR_GRPaARQfA_1501_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5SR_GRPaARQfA_1501 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5SR_GRPaARQfA_1501_Array functionReturn = new FR_L5SR_GRPaARQfA_1501_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_ActiveReservedQuantities_for_Article", ex);
            }
            return(functionReturn);
        }