protected static FR_L5DI_GRPfMPID_0955 Execute(DbConnection Connection, DbTransaction Transaction, P_L5DI_GRPfMPID_0955 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L5DI_GRPfMPID_0955(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL5_MyHealthClub_Diagnosis.Atomic.Retrieval.SQL.cls_Get_ReferralPractice_for_MedicalPractiseID.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, "MedicalPractiseID", Parameter.MedicalPractiseID); List <L5DI_GRPfMPID_0955_raw> results = new List <L5DI_GRPfMPID_0955_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[] { "ContactPersonTitle", "ContactPersonFirstName", "ContactPersonLastName", "Street_Name", "Street_Number", "Town", "HEC_MedicalPractiseID", "OrganizationalUnit_Name_DictID", "Default_PhoneNumber", "Contact_Website_URL", "HEC_MedicalPractice_OfferedServiceID", "HEC_MedicalServiceID", "ServiceName_DictID", "HEC_MedicalPractice_TypeID", "MedicalPracticeType_Name_DictID" }); while (reader.Read()) { L5DI_GRPfMPID_0955_raw resultItem = new L5DI_GRPfMPID_0955_raw(); //0:Parameter ContactPersonTitle of type String resultItem.ContactPersonTitle = reader.GetString(0); //1:Parameter ContactPersonFirstName of type String resultItem.ContactPersonFirstName = reader.GetString(1); //2:Parameter ContactPersonLastName of type String resultItem.ContactPersonLastName = reader.GetString(2); //3:Parameter Street_Name of type String resultItem.Street_Name = reader.GetString(3); //4:Parameter Street_Number of type String resultItem.Street_Number = reader.GetString(4); //5:Parameter Town of type String resultItem.Town = reader.GetString(5); //6:Parameter HEC_MedicalPractiseID of type Guid resultItem.HEC_MedicalPractiseID = reader.GetGuid(6); //7:Parameter OrganizationalUnit_Name of type Dict resultItem.OrganizationalUnit_Name = reader.GetDictionary(7); resultItem.OrganizationalUnit_Name.SourceTable = "cmn_bpt_ctm_organizationalunits"; loader.Append(resultItem.OrganizationalUnit_Name); //8:Parameter Default_PhoneNumber of type String resultItem.Default_PhoneNumber = reader.GetString(8); //9:Parameter Contact_Website_URL of type String resultItem.Contact_Website_URL = reader.GetString(9); //10:Parameter HEC_MedicalPractice_OfferedServiceID of type Guid resultItem.HEC_MedicalPractice_OfferedServiceID = reader.GetGuid(10); //11:Parameter HEC_MedicalServiceID of type Guid resultItem.HEC_MedicalServiceID = reader.GetGuid(11); //12:Parameter ServiceName of type Dict resultItem.ServiceName = reader.GetDictionary(12); resultItem.ServiceName.SourceTable = "hec_medicalservices"; loader.Append(resultItem.ServiceName); //13:Parameter HEC_MedicalPractice_TypeID of type Guid resultItem.HEC_MedicalPractice_TypeID = reader.GetGuid(13); //14:Parameter MedicalPracticeType_Name of type Dict resultItem.MedicalPracticeType_Name = reader.GetDictionary(14); resultItem.MedicalPracticeType_Name.SourceTable = "hec_medicalpractice_types"; loader.Append(resultItem.MedicalPracticeType_Name); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_Get_ReferralPractice_for_MedicalPractiseID", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = L5DI_GRPfMPID_0955_raw.Convert(results).FirstOrDefault(); 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_L5DI_GRPfMPID_0955 Invoke(DbConnection Connection, DbTransaction Transaction, P_L5DI_GRPfMPID_0955 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5DI_GRPfMPID_0955 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5DI_GRPfMPID_0955 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5DI_GRPfMPID_0955 functionReturn = new FR_L5DI_GRPfMPID_0955(); 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_ReferralPractice_for_MedicalPractiseID", ex); } return(functionReturn); }
///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_L5DI_GRPfMPID_0955 Invoke(string ConnectionString, P_L5DI_GRPfMPID_0955 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }