///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_L6CO_GCPOFPID_1432_Array Invoke(string ConnectionString, P_L6CO_GCPOFPID_1432 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L6CO_GCPOFPID_1432_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L6CO_GCPOFPID_1432 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L6CO_GCPOFPID_1432_Array functionReturn = new FR_L6CO_GCPOFPID_1432_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 ex; } return(functionReturn); }
protected static FR_L6CO_GCPOFPID_1432_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L6CO_GCPOFPID_1432 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L6CO_GCPOFPID_1432_Array(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL6_Lucentis_CustomerOrder.Atomic.Retrieval.SQL.cls_Get_CustomerPreOrder_For_PracticeID.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, "PharmacyID", Parameter.PharmacyID); List <L6CO_GCPOFPID_1432_raw> results = new List <L6CO_GCPOFPID_1432_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[] { "IfSheduled_Date", "FirstName", "LastName", "PracticeName", "HEC_Patient_TreatmentID", "ArticlID", "HEC_Patient_Treatment_RequiredProductID", "Articles_Name_DictID", "BoundTo_CustomerOrderPosition_RefID", "HEC_DoctorID", "DoctorFirstName", "DoctorLastname", "DoctorTitle" }); while (reader.Read()) { L6CO_GCPOFPID_1432_raw resultItem = new L6CO_GCPOFPID_1432_raw(); //0:Parameter IfSheduled_Date of type DateTime resultItem.IfSheduled_Date = reader.GetDate(0); //1:Parameter FirstName of type String resultItem.FirstName = reader.GetString(1); //2:Parameter LastName of type String resultItem.LastName = reader.GetString(2); //3:Parameter PracticeName of type String resultItem.PracticeName = reader.GetString(3); //4:Parameter HEC_Patient_TreatmentID of type Guid resultItem.HEC_Patient_TreatmentID = reader.GetGuid(4); //5:Parameter ArticlID of type Guid resultItem.ArticlID = reader.GetGuid(5); //6:Parameter HEC_Patient_Treatment_RequiredProductID of type Guid resultItem.HEC_Patient_Treatment_RequiredProductID = reader.GetGuid(6); //7:Parameter Articles_Name_DictID of type Dict resultItem.Articles_Name_DictID = reader.GetDictionary(7); resultItem.Articles_Name_DictID.SourceTable = "cmn_pro_products"; loader.Append(resultItem.Articles_Name_DictID); //8:Parameter BoundTo_CustomerOrderPosition_RefID of type Guid resultItem.BoundTo_CustomerOrderPosition_RefID = reader.GetGuid(8); //9:Parameter HEC_DoctorID of type Guid resultItem.HEC_DoctorID = reader.GetGuid(9); //10:Parameter DoctorFirstName of type String resultItem.DoctorFirstName = reader.GetString(10); //11:Parameter DoctorLastname of type String resultItem.DoctorLastname = reader.GetString(11); //12:Parameter DoctorTitle of type String resultItem.DoctorTitle = reader.GetString(12); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw ex; } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = L6CO_GCPOFPID_1432_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_L6CO_GCPOFPID_1432_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L6CO_GCPOFPID_1432 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }