protected static FR_P_PA_GPDfPID_1124 Execute(DbConnection Connection, DbTransaction Transaction, P_P_PA_GPDfPID_1124 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_P_PA_GPDfPID_1124(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "MMDocConnectDBMethods.Patient.Atomic.Retrieval.SQL.cls_Get_Patient_Details_for_PatientID.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, "PatientID", Parameter.PatientID); List <P_PA_GPDfPID_1124_raw> results = new List <P_PA_GPDfPID_1124_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[] { "name", "patient_first_name", "patient_last_name", "birthday", "insurance_id", "insurance_status", "gender", "health_insurance_provider", "contractID", "HealthInsuranceProviderID", "HealthInsurance_IKNumber", "id", "contract_number", "participation_consent_issue_date", "ValidThrough", "HEC_CRT_InsuranceToBrokerContract_ParticipatingPatientID" }); while (reader.Read()) { P_PA_GPDfPID_1124_raw resultItem = new P_PA_GPDfPID_1124_raw(); //0:Parameter name of type String resultItem.name = reader.GetString(0); //1:Parameter patient_first_name of type String resultItem.patient_first_name = reader.GetString(1); //2:Parameter patient_last_name of type String resultItem.patient_last_name = reader.GetString(2); //3:Parameter birthday of type DateTime resultItem.birthday = reader.GetDate(3); //4:Parameter insurance_id of type String resultItem.insurance_id = reader.GetString(4); //5:Parameter insurance_status of type String resultItem.insurance_status = reader.GetString(5); //6:Parameter gender of type int resultItem.gender = reader.GetInteger(6); //7:Parameter health_insurance_provider of type String resultItem.health_insurance_provider = reader.GetString(7); //8:Parameter contractID of type Guid resultItem.contractID = reader.GetGuid(8); //9:Parameter HealthInsuranceProviderID of type Guid resultItem.HealthInsuranceProviderID = reader.GetGuid(9); //10:Parameter HealthInsurance_IKNumber of type String resultItem.HealthInsurance_IKNumber = reader.GetString(10); //11:Parameter id of type Guid resultItem.id = reader.GetGuid(11); //12:Parameter contract_number of type int resultItem.contract_number = reader.GetInteger(12); //13:Parameter participation_consent_issue_date of type DateTime resultItem.participation_consent_issue_date = reader.GetDate(13); //14:Parameter ValidThrough of type DateTime resultItem.ValidThrough = reader.GetDate(14); //15:Parameter HEC_CRT_InsuranceToBrokerContract_ParticipatingPatientID of type Guid resultItem.HEC_CRT_InsuranceToBrokerContract_ParticipatingPatientID = reader.GetGuid(15); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_Get_Patient_Details_for_PatientID", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = P_PA_GPDfPID_1124_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_P_PA_GPDfPID_1124 Invoke(DbConnection Connection, DbTransaction Transaction, P_P_PA_GPDfPID_1124 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_P_PA_GPDfPID_1124 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_P_PA_GPDfPID_1124 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_P_PA_GPDfPID_1124 functionReturn = new FR_P_PA_GPDfPID_1124(); 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_Patient_Details_for_PatientID", ex); } return(functionReturn); }
///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_P_PA_GPDfPID_1124 Invoke(string ConnectionString, P_P_PA_GPDfPID_1124 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }