protected static FR_L6MRMS_GARSI_2117_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L6MRMS_GARSI_2117 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L6MRMS_GARSI_2117_Array(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL6_MRMS_Backoffice.Atomic.Retrieval.SQL.cls_Get_All_Reading_Session_Items.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, "ReadingSessionId", Parameter.ReadingSessionId); List <L6MRMS_GARSI_2117_raw> results = new List <L6MRMS_GARSI_2117_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[] { "MeasurementID", "MeterSerialNumber", "ContractNumber", "OwnerFirstName", "OwnerLastName", "StreetName", "StreetNumber", "City", "City_PostalCode", "RouteName", "SequenceInRoute", "MRS_RUT_RouteID", "MRS_RUN_MeasurementRun_RouteID", "BoundTo_Account_RefID", "MRS_RUN_Measurement_TariffID", "MRS_RUN_Measurement_ValueID", "MeasuredAt_Time", "MeasurementValue", "Tariff_GlobalPropertyMatchingID", "AcqusitionTypeGPM", "MeasurementTariffName_DictID" }); while (reader.Read()) { L6MRMS_GARSI_2117_raw resultItem = new L6MRMS_GARSI_2117_raw(); //0:Parameter MeasurementID of type Guid resultItem.MeasurementID = reader.GetGuid(0); //1:Parameter MeterSerialNumber of type string resultItem.MeterSerialNumber = reader.GetString(1); //2:Parameter ContractNumber of type string resultItem.ContractNumber = reader.GetString(2); //3:Parameter OwnerFirstName of type string resultItem.OwnerFirstName = reader.GetString(3); //4:Parameter OwnerLastName of type string resultItem.OwnerLastName = reader.GetString(4); //5:Parameter StreetName of type string resultItem.StreetName = reader.GetString(5); //6:Parameter StreetNumber of type string resultItem.StreetNumber = reader.GetString(6); //7:Parameter City of type string resultItem.City = reader.GetString(7); //8:Parameter City_PostalCode of type string resultItem.City_PostalCode = reader.GetString(8); //9:Parameter RouteName of type string resultItem.RouteName = reader.GetString(9); //10:Parameter SequenceInRoute of type int resultItem.SequenceInRoute = reader.GetInteger(10); //11:Parameter MRS_RUT_RouteID of type Guid resultItem.MRS_RUT_RouteID = reader.GetGuid(11); //12:Parameter MRS_RUN_MeasurementRun_RouteID of type Guid resultItem.MRS_RUN_MeasurementRun_RouteID = reader.GetGuid(12); //13:Parameter BoundTo_Account_RefID of type Guid resultItem.BoundTo_Account_RefID = reader.GetGuid(13); //14:Parameter MRS_RUN_Measurement_TariffID of type Guid resultItem.MRS_RUN_Measurement_TariffID = reader.GetGuid(14); //15:Parameter MRS_RUN_Measurement_ValueID of type Guid resultItem.MRS_RUN_Measurement_ValueID = reader.GetGuid(15); //16:Parameter MeasuredAt_Time of type DateTime resultItem.MeasuredAt_Time = reader.GetDate(16); //17:Parameter MeasurementValue of type double resultItem.MeasurementValue = reader.GetDouble(17); //18:Parameter Tariff_GlobalPropertyMatchingID of type string resultItem.Tariff_GlobalPropertyMatchingID = reader.GetString(18); //19:Parameter AcqusitionTypeGPM of type string resultItem.AcqusitionTypeGPM = reader.GetString(19); //20:Parameter MeasurementTariffName of type Dict resultItem.MeasurementTariffName = reader.GetDictionary(20); resultItem.MeasurementTariffName.SourceTable = "mrs_run_measurement_tariffs"; loader.Append(resultItem.MeasurementTariffName); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_Get_All_Reading_Session_Items", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = L6MRMS_GARSI_2117_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_L6MRMS_GARSI_2117_Array Invoke(DbConnection Connection, DbTransaction Transaction, P_L6MRMS_GARSI_2117 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L6MRMS_GARSI_2117_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L6MRMS_GARSI_2117 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L6MRMS_GARSI_2117_Array functionReturn = new FR_L6MRMS_GARSI_2117_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_All_Reading_Session_Items", ex); } return(functionReturn); }
///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_L6MRMS_GARSI_2117_Array Invoke(string ConnectionString, P_L6MRMS_GARSI_2117 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }