protected static FR_L6TR_GTCIbID_2148_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L6TR_GTCIbID_2148 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L6TR_GTCIbID_2148_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL6_Lucenits_Treatments.Atomic.Retrieval.SQL.cls_Get_TreatmentsCompleteInfo_by_IDs.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;

            command.CommandText = System.Text.RegularExpressions.Regex.Replace(command.CommandText, "=[ \t]*@TreatmentIDs", " IN $$TreatmentIDs$$");
            CSV2Core_MySQL.Support.DBSQLSupport.AppendINStatement(command, "$TreatmentIDs$", Parameter.TreatmentIDs);


            List <L6TR_GTCIbID_2148_raw> results = new List <L6TR_GTCIbID_2148_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[] { "IsTreatmentDeleted", "HEC_Patient_TreatmentID", "TreatmentPractice_RefID", "IsTreatmentPerformed", "IfTreatmentPerformed_ByDoctor_RefID", "IfTreatmentPerformed_Date", "IsTreatmentFollowup", "IfTreatmentFollowup_FromTreatment_RefID", "IsScheduled", "IfSheduled_Date", "IsTreatmentBilled", "IfTreatmentBilled_Date", "Treatment_Comment", "IsTreatmentOfLeftEye", "IsTreatmentOfRightEye", "HEC_Patient_RefID", "IfSheduled_ForDoctor_RefID", "BIL_BillPositionID", "BillPosition_ProductNumber", "PositionNumber", "External_PositionCode", "External_PositionType", "External_PositionReferenceField", "PositionValue_IncludingTax", "PositionValue_BeforeTax", "BIL_BillPosition_TransmitionStatusID", "TransmitionCode", "PrimaryComment", "SecondaryComment", "Creation_Timestamp", "TransmittedOnDate", "IsActive", "HEC_Patient_Treatment_RelevantDiagnosisID", "HEC_DIA_Diagnosis_StateID", "HEC_DIA_PotentialDiagnosisID", "Doctor_RefID", "ICD10_Code", "DiagnosisState_Name_DictID", "DiagnosisState_Abbreviation", "Creation_Date", "DiagnosedOnDate", "PotentialDiagnosis_Name_DictID", "CMN_PRO_ProductID", "Product_Number", "Quantity", "Product_Name_DictID" });
                while (reader.Read())
                {
                    L6TR_GTCIbID_2148_raw resultItem = new L6TR_GTCIbID_2148_raw();
                    //0:Parameter IsTreatmentDeleted of type bool
                    resultItem.IsTreatmentDeleted = reader.GetBoolean(0);
                    //1:Parameter HEC_Patient_TreatmentID of type Guid
                    resultItem.HEC_Patient_TreatmentID = reader.GetGuid(1);
                    //2:Parameter TreatmentPractice_RefID of type Guid
                    resultItem.TreatmentPractice_RefID = reader.GetGuid(2);
                    //3:Parameter IsTreatmentPerformed of type bool
                    resultItem.IsTreatmentPerformed = reader.GetBoolean(3);
                    //4:Parameter IfTreatmentPerformed_ByDoctor_RefID of type Guid
                    resultItem.IfTreatmentPerformed_ByDoctor_RefID = reader.GetGuid(4);
                    //5:Parameter IfTreatmentPerformed_Date of type DateTime
                    resultItem.IfTreatmentPerformed_Date = reader.GetDate(5);
                    //6:Parameter IsTreatmentFollowup of type bool
                    resultItem.IsTreatmentFollowup = reader.GetBoolean(6);
                    //7:Parameter IfTreatmentFollowup_FromTreatment_RefID of type Guid
                    resultItem.IfTreatmentFollowup_FromTreatment_RefID = reader.GetGuid(7);
                    //8:Parameter IsScheduled of type bool
                    resultItem.IsScheduled = reader.GetBoolean(8);
                    //9:Parameter IfSheduled_Date of type DateTime
                    resultItem.IfSheduled_Date = reader.GetDate(9);
                    //10:Parameter IsTreatmentBilled of type bool
                    resultItem.IsTreatmentBilled = reader.GetBoolean(10);
                    //11:Parameter IfTreatmentBilled_Date of type DateTime
                    resultItem.IfTreatmentBilled_Date = reader.GetDate(11);
                    //12:Parameter Treatment_Comment of type String
                    resultItem.Treatment_Comment = reader.GetString(12);
                    //13:Parameter IsTreatmentOfLeftEye of type bool
                    resultItem.IsTreatmentOfLeftEye = reader.GetBoolean(13);
                    //14:Parameter IsTreatmentOfRightEye of type bool
                    resultItem.IsTreatmentOfRightEye = reader.GetBoolean(14);
                    //15:Parameter HEC_Patient_RefID of type Guid
                    resultItem.HEC_Patient_RefID = reader.GetGuid(15);
                    //16:Parameter IfSheduled_ForDoctor_RefID of type Guid
                    resultItem.IfSheduled_ForDoctor_RefID = reader.GetGuid(16);
                    //17:Parameter BIL_BillPositionID of type Guid
                    resultItem.BIL_BillPositionID = reader.GetGuid(17);
                    //18:Parameter BillPosition_ProductNumber of type string
                    resultItem.BillPosition_ProductNumber = reader.GetString(18);
                    //19:Parameter PositionNumber of type string
                    resultItem.PositionNumber = reader.GetString(19);
                    //20:Parameter External_PositionCode of type string
                    resultItem.External_PositionCode = reader.GetString(20);
                    //21:Parameter External_PositionType of type string
                    resultItem.External_PositionType = reader.GetString(21);
                    //22:Parameter External_PositionReferenceField of type string
                    resultItem.External_PositionReferenceField = reader.GetString(22);
                    //23:Parameter PositionValue_IncludingTax of type double
                    resultItem.PositionValue_IncludingTax = reader.GetDouble(23);
                    //24:Parameter PositionValue_BeforeTax of type double
                    resultItem.PositionValue_BeforeTax = reader.GetDouble(24);
                    //25:Parameter BIL_BillPosition_TransmitionStatusID of type Guid
                    resultItem.BIL_BillPosition_TransmitionStatusID = reader.GetGuid(25);
                    //26:Parameter TransmitionCode of type int
                    resultItem.TransmitionCode = reader.GetInteger(26);
                    //27:Parameter PrimaryComment of type string
                    resultItem.PrimaryComment = reader.GetString(27);
                    //28:Parameter SecondaryComment of type string
                    resultItem.SecondaryComment = reader.GetString(28);
                    //29:Parameter Creation_Timestamp of type DateTime
                    resultItem.Creation_Timestamp = reader.GetDate(29);
                    //30:Parameter TransmittedOnDate of type DateTime
                    resultItem.TransmittedOnDate = reader.GetDate(30);
                    //31:Parameter IsActive of type bool
                    resultItem.IsActive = reader.GetBoolean(31);
                    //32:Parameter HEC_Patient_Treatment_RelevantDiagnosisID of type Guid
                    resultItem.HEC_Patient_Treatment_RelevantDiagnosisID = reader.GetGuid(32);
                    //33:Parameter HEC_DIA_Diagnosis_StateID of type Guid
                    resultItem.HEC_DIA_Diagnosis_StateID = reader.GetGuid(33);
                    //34:Parameter HEC_DIA_PotentialDiagnosisID of type Guid
                    resultItem.HEC_DIA_PotentialDiagnosisID = reader.GetGuid(34);
                    //35:Parameter Doctor_RefID of type Guid
                    resultItem.Doctor_RefID = reader.GetGuid(35);
                    //36:Parameter ICD10_Code of type String
                    resultItem.ICD10_Code = reader.GetString(36);
                    //37:Parameter DiagnosisState_Name of type Dict
                    resultItem.DiagnosisState_Name             = reader.GetDictionary(37);
                    resultItem.DiagnosisState_Name.SourceTable = "hec_dia_diagnosis_states";
                    loader.Append(resultItem.DiagnosisState_Name);
                    //38:Parameter DiagnosisState_Abbreviation of type String
                    resultItem.DiagnosisState_Abbreviation = reader.GetString(38);
                    //39:Parameter Creation_Date of type DateTime
                    resultItem.Creation_Date = reader.GetDate(39);
                    //40:Parameter DiagnosedOnDate of type DateTime
                    resultItem.DiagnosedOnDate = reader.GetDate(40);
                    //41:Parameter PotentialDiagnosis_Name_DictID of type Dict
                    resultItem.PotentialDiagnosis_Name_DictID             = reader.GetDictionary(41);
                    resultItem.PotentialDiagnosis_Name_DictID.SourceTable = "hec_dia_potentialdiagnoses";
                    loader.Append(resultItem.PotentialDiagnosis_Name_DictID);
                    //42:Parameter CMN_PRO_ProductID of type Guid
                    resultItem.CMN_PRO_ProductID = reader.GetGuid(42);
                    //43:Parameter Product_Number of type string
                    resultItem.Product_Number = reader.GetString(43);
                    //44:Parameter Quantity of type double
                    resultItem.Quantity = reader.GetDouble(44);
                    //45:Parameter Product_Name of type Dict
                    resultItem.Product_Name             = reader.GetDictionary(45);
                    resultItem.Product_Name.SourceTable = "cmn_pro_products";
                    loader.Append(resultItem.Product_Name);

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

            returnStatus.Result = L6TR_GTCIbID_2148_raw.Convert(results).ToArray();
            return(returnStatus);
        }
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L6TR_GTCIbID_2148_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L6TR_GTCIbID_2148 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L6TR_GTCIbID_2148_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L6TR_GTCIbID_2148 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L6TR_GTCIbID_2148_Array functionReturn = new FR_L6TR_GTCIbID_2148_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_TreatmentsCompleteInfo_by_IDs", ex);
            }
            return(functionReturn);
        }
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L6TR_GTCIbID_2148_Array Invoke(string ConnectionString, P_L6TR_GTCIbID_2148 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }