protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3SC_SSCA_1433 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here
            if (Parameter.StockItems.Count() > 0)
            {
                foreach (var item in Parameter.StockItems)
                {
                    var shelfContent = new ORM_LOG_WRH_Shelf_Content();
                    shelfContent.Load(Connection, Transaction, item.ShelfContentID);

                    if (shelfContent != null)
                    {
                        var oldQuantity = shelfContent.Quantity_Current;

                        shelfContent.Quantity_Current = item.CountedQuantity;
                        shelfContent.Save(Connection, Transaction);

                        var shelfContentAdjustment = new ORM_LOG_WRH_Shelf_ContentAdjustment();
                        shelfContentAdjustment.LOG_WRH_Shelf_ContentAdjustmentID = Guid.NewGuid();
                        shelfContentAdjustment.ShelfContent_RefID    = item.ShelfContentID;
                        shelfContentAdjustment.QuantityChangedAmount = item.CountedQuantity - oldQuantity;
                        shelfContentAdjustment.QuantityChangedDate   = DateTime.Now;
                        shelfContentAdjustment.IsManualCorrection    = item.IsManualCorrection;
                        shelfContentAdjustment.IfManualCorrection_InventoryChangeReason_RefID = item.InventoryChangeReason;
                        shelfContentAdjustment.PerformedAt_Date          = DateTime.Now;
                        shelfContentAdjustment.PerformedBy_Account_RefID = securityTicket.AccountID;
                        shelfContentAdjustment.Creation_Timestamp        = DateTime.Now;
                        shelfContentAdjustment.Tenant_RefID = securityTicket.TenantID;
                        shelfContentAdjustment.Save(Connection, Transaction);

                        ORM_LOG_WRH_Shelf_Content_AdjustmentHistory adjustmentHistory = new ORM_LOG_WRH_Shelf_Content_AdjustmentHistory();
                        adjustmentHistory.LOG_WRH_Shelf_Content_AdjustmentHistoryID = Guid.NewGuid();
                        adjustmentHistory.Shelf_Content_RefID      = item.ShelfContentID;
                        adjustmentHistory.ContentAdjustments_RefID = shelfContentAdjustment.LOG_WRH_Shelf_ContentAdjustmentID;
                        adjustmentHistory.Tenant_RefID             = securityTicket.TenantID;
                        adjustmentHistory.Creation_Timestamp       = DateTime.Now;
                        adjustmentHistory.Save(Connection, Transaction);
                    }
                }
            }



            return(returnValue);

            #endregion UserCode
        }
 ///<summary>
 /// Ivokes the method with the given Connection, leaving it open if no exceptions occured
 ///<summary>
 public static FR_Guid Invoke(DbConnection Connection, P_L3SC_SSCA_1433 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, null, null, Parameter, securityTicket));
 }
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_Guid Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3SC_SSCA_1433 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_Guid functionReturn = new FR_Guid();

            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_Save_ShelfContentAdjustment", ex);
            }
            return(functionReturn);
        }