///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5CO_RCO_2302_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5CO_RCO_2302[] Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5CO_RCO_2302_Array functionReturn = new FR_L5CO_RCO_2302_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_Reject_CustomerOrder", ex);
            }
            return(functionReturn);
        }
        protected static FR_L5CO_RCO_2302_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5CO_RCO_2302[] Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5CO_RCO_2302_Array();
            List <L5CO_RCO_2302> rejectedOrders = new List <L5CO_RCO_2302>();
            foreach (var param in Parameter)
            {
                L5CO_RCO_2302 rejectedProcurementOrder = new L5CO_RCO_2302();
                var           orderedStatusID          = ORM_ORD_CUO_CustomerOrder_Status.Query.Search(Connection, Transaction,
                                                                                                       new ORM_ORD_CUO_CustomerOrder_Status.Query
                {
                    GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(ECustomerOrderStatus.Rejected),
                    Tenant_RefID             = securityTicket.TenantID,
                    IsDeleted = false
                }).SingleOrDefault().ORD_CUO_CustomerOrder_StatusID;

                var customerOrderQuery = new ORM_ORD_CUO_CustomerOrder_Header.Query();
                customerOrderQuery.ORD_CUO_CustomerOrder_HeaderID = param.CustomerOrderHeaderID;
                customerOrderQuery.Tenant_RefID = securityTicket.TenantID;
                var foundCustomerOrder = ORM_ORD_CUO_CustomerOrder_Header.Query.Search(Connection, Transaction, customerOrderQuery).SingleOrDefault();

                foundCustomerOrder.Current_CustomerOrderStatus_RefID = orderedStatusID;
                foundCustomerOrder.IsCustomerOrderFinalized          = true;
                foundCustomerOrder.Save(Connection, Transaction);
                ORM_USR_Account account = new ORM_USR_Account();
                account.Load(Connection, Transaction, securityTicket.AccountID);

                ORM_ORD_CUO_CustomerOrder_StatusHistory newStatusInHistory = new ORM_ORD_CUO_CustomerOrder_StatusHistory();
                newStatusInHistory.CustomerOrder_Header_RefID = foundCustomerOrder.ORD_CUO_CustomerOrder_HeaderID;
                newStatusInHistory.StatusHistoryComment       = param.Message;
                newStatusInHistory.Tenant_RefID = securityTicket.TenantID;
                newStatusInHistory.CustomerOrder_Status_RefID            = orderedStatusID;
                newStatusInHistory.PerformedBy_BusinessParticipant_RefID = account.BusinessParticipant_RefID;

                //saving new status in history and customer order header
                newStatusInHistory.Save(Connection, Transaction);
                rejectedProcurementOrder.ProcurementOrderITL = foundCustomerOrder.ProcurementOrderITL;
                rejectedProcurementOrder.ProcuringTenatID    = foundCustomerOrder.OrderingCustomer_BusinessParticipant_RefID.ToString();
                rejectedProcurementOrder.Message             = param.Message;
                rejectedOrders.Add(rejectedProcurementOrder);
            }
            returnValue.Result = rejectedOrders.ToArray();
            //Put your code here
            return(returnValue);

            #endregion UserCode
        }