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

            FR_L5A_GAATfAID_1530 functionReturn = new FR_L5A_GAATfAID_1530();

            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_AllAppointment_Task_for_AppointmentID", ex);
            }
            return(functionReturn);
        }
        protected static FR_L5A_GAATfAID_1530 Execute(DbConnection Connection, DbTransaction Transaction, P_L5A_GAATfAID_1530 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L5A_GAATfAID_1530();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_MyHealthClub_TaskTemplate.Atomic.Retrieval.SQL.cls_Get_AllAppointment_Task_for_AppointmentID.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, "AppointmentID", Parameter.AppointmentID);



            List <L5A_GAATfAID_1530_raw> results = new List <L5A_GAATfAID_1530_raw>();
            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[] { "PPS_TSK_TaskID", "InstantiatedFrom_TaskTemplate_RefID", "DisplayName", "PlannedStartDate", "PlannedDuration_in_sec", "PPS_TSK_Task_StaffBookingsID", "PPS_TSK_Task_RefID", "CMN_BPT_EMP_Employee_RefID", "CreatedFrom_TaskTemplate_RequiredStaff_RefID", "PPS_TSK_Task_OfficeBookingID", "PPS_TSK_Task_RefID_Office", "CMN_STR_Office_RefID", "PPS_TSK_Task_DeviceBookingID", "PPS_TSK_Task_RefID_Device", "PPS_DEV_Device_Instance_RefID", "HEC_APP_AppointmentID", "Ext_PPS_TSK_Task_RefID", "HEC_ACT_PlannedActionID", "Patient_RefID" });
                while (reader.Read())
                {
                    L5A_GAATfAID_1530_raw resultItem = new L5A_GAATfAID_1530_raw();
                    //0:Parameter PPS_TSK_TaskID of type Guid
                    resultItem.PPS_TSK_TaskID = reader.GetGuid(0);
                    //1:Parameter InstantiatedFrom_TaskTemplate_RefID of type Guid
                    resultItem.InstantiatedFrom_TaskTemplate_RefID = reader.GetGuid(1);
                    //2:Parameter DisplayName of type String
                    resultItem.DisplayName = reader.GetString(2);
                    //3:Parameter PlannedStartDate of type DateTime
                    resultItem.PlannedStartDate = reader.GetDate(3);
                    //4:Parameter PlannedDuration_in_sec of type String
                    resultItem.PlannedDuration_in_sec = reader.GetString(4);
                    //5:Parameter PPS_TSK_Task_StaffBookingsID of type Guid
                    resultItem.PPS_TSK_Task_StaffBookingsID = reader.GetGuid(5);
                    //6:Parameter PPS_TSK_Task_RefID of type Guid
                    resultItem.PPS_TSK_Task_RefID = reader.GetGuid(6);
                    //7:Parameter CMN_BPT_EMP_Employee_RefID of type Guid
                    resultItem.CMN_BPT_EMP_Employee_RefID = reader.GetGuid(7);
                    //8:Parameter CreatedFrom_TaskTemplate_RequiredStaff_RefID of type Guid
                    resultItem.CreatedFrom_TaskTemplate_RequiredStaff_RefID = reader.GetGuid(8);
                    //9:Parameter PPS_TSK_Task_OfficeBookingID of type Guid
                    resultItem.PPS_TSK_Task_OfficeBookingID = reader.GetGuid(9);
                    //10:Parameter PPS_TSK_Task_RefID_Office of type Guid
                    resultItem.PPS_TSK_Task_RefID_Office = reader.GetGuid(10);
                    //11:Parameter CMN_STR_Office_RefID of type Guid
                    resultItem.CMN_STR_Office_RefID = reader.GetGuid(11);
                    //12:Parameter PPS_TSK_Task_DeviceBookingID of type Guid
                    resultItem.PPS_TSK_Task_DeviceBookingID = reader.GetGuid(12);
                    //13:Parameter PPS_TSK_Task_RefID_Device of type Guid
                    resultItem.PPS_TSK_Task_RefID_Device = reader.GetGuid(13);
                    //14:Parameter PPS_DEV_Device_Instance_RefID of type Guid
                    resultItem.PPS_DEV_Device_Instance_RefID = reader.GetGuid(14);
                    //15:Parameter HEC_APP_AppointmentID of type Guid
                    resultItem.HEC_APP_AppointmentID = reader.GetGuid(15);
                    //16:Parameter Ext_PPS_TSK_Task_RefID of type Guid
                    resultItem.Ext_PPS_TSK_Task_RefID = reader.GetGuid(16);
                    //17:Parameter HEC_ACT_PlannedActionID of type Guid
                    resultItem.HEC_ACT_PlannedActionID = reader.GetGuid(17);
                    //18:Parameter Patient_RefID of type Guid
                    resultItem.Patient_RefID = reader.GetGuid(18);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw new Exception("Exception occured durng data retrieval in method cls_Get_AllAppointment_Task_for_AppointmentID", ex);
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = L5A_GAATfAID_1530_raw.Convert(results).FirstOrDefault();

            return(returnStatus);
        }