///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_PA_GPDfPID_1101 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_PA_GPDfPID_1101 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_PA_GPDfPID_1101 functionReturn = new FR_PA_GPDfPID_1101(); 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_PatientEdit_Data_for_PatientID", ex); } return(functionReturn); }
protected static FR_PA_GPDfPID_1101 Execute(DbConnection Connection, DbTransaction Transaction, P_PA_GPDfPID_1101 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_PA_GPDfPID_1101(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "MMDocConnectDBMethods.Patient.Atomic.Retrieval.SQL.cls_Get_PatientEdit_Data_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 <PA_GPDfPID_1101> results = new List <PA_GPDfPID_1101>(); 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[] { "id", "first_name", "last_name", "birthday", "sex", "insurance_id", "health_insurance_provider_id", "valid_from", "contract_id", "insurance_status", "participation_id", "hip_ik_number", "hip_name", "hip_display_name" }); while (reader.Read()) { PA_GPDfPID_1101 resultItem = new PA_GPDfPID_1101(); //0:Parameter id of type Guid resultItem.id = reader.GetGuid(0); //1:Parameter first_name of type String resultItem.first_name = reader.GetString(1); //2:Parameter last_name of type String resultItem.last_name = reader.GetString(2); //3:Parameter birthday of type DateTime resultItem.birthday = reader.GetDate(3); //4:Parameter sex of type int resultItem.sex = reader.GetInteger(4); //5:Parameter insurance_id of type String resultItem.insurance_id = reader.GetString(5); //6:Parameter health_insurance_provider_id of type Guid resultItem.health_insurance_provider_id = reader.GetGuid(6); //7:Parameter valid_from of type DateTime resultItem.valid_from = reader.GetDate(7); //8:Parameter contract_id of type Guid resultItem.contract_id = reader.GetGuid(8); //9:Parameter insurance_status of type String resultItem.insurance_status = reader.GetString(9); //10:Parameter participation_id of type Guid resultItem.participation_id = reader.GetGuid(10); //11:Parameter hip_ik_number of type String resultItem.hip_ik_number = reader.GetString(11); //12:Parameter hip_name of type String resultItem.hip_name = reader.GetString(12); //13:Parameter hip_display_name of type String resultItem.hip_display_name = reader.GetString(13); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_Get_PatientEdit_Data_for_PatientID", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = results.FirstOrDefault(); return(returnStatus); }