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

            FR_CAS_GiASEfCID_1127 functionReturn = new FR_CAS_GiASEfCID_1127();

            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_is_Aftercares_Status_Editable_for_CaseID", ex);
            }
            return(functionReturn);
        }
        protected static FR_CAS_GiASEfCID_1127 Execute(DbConnection Connection, DbTransaction Transaction, P_CAS_GiASEfCID_1127 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_CAS_GiASEfCID_1127();
            returnValue.Result = new CAS_GiASEfCID_1127();
            //Put your code here

            var relevant_aftercares = ORM_HEC_CAS_Case_RelevantPlannedAction.Query.Search(Connection, Transaction, new ORM_HEC_CAS_Case_RelevantPlannedAction.Query()
            {
                Case_RefID   = Parameter.CaseID,
                Tenant_RefID = securityTicket.TenantID
            });

            if (relevant_aftercares.Count == 1)
            {
                returnValue.Result.IsEditable = true;
            }
            else
            {
                var fs_statuses = cls_Get_Case_TransmitionCode_for_CaseID.Invoke(Connection, Transaction, new P_CAS_GCTCfCID_1427()
                {
                    CaseID = Parameter.CaseID
                }, securityTicket).Result.Where(fs => fs.fs_key == "aftercare").ToArray();
                if (fs_statuses.Length > 1)
                {
                    returnValue.Result.IsEditable = !fs_statuses.Select(fs =>
                    {
                        return(fs.fs_status != 8);
                    }).Any(fs => fs);
                }
                else
                {
                    returnValue.Result.IsEditable = false;
                }
            }


            return(returnValue);

            #endregion UserCode
        }