///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L3AS_GDPfAP_1711_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3AS_GDPfAP_1711 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L3AS_GDPfAP_1711_Array functionReturn = new FR_L3AS_GDPfAP_1711_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_DistributionPrices_for_AssortmentProduct", ex); } return(functionReturn); }
protected static FR_L3AS_GDPfAP_1711_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L3AS_GDPfAP_1711 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L3AS_GDPfAP_1711_Array(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL3_Assortment.Atomic.Retrieval.SQL.cls_Get_DistributionPrices_for_AssortmentProduct.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, "ProductID", Parameter.ProductID); List <L3AS_GDPfAP_1711_raw> results = new List <L3AS_GDPfAP_1711_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[] { "CMN_PRO_ASS_AssortmentProductID", "VariantName_DictID", "IsStandardProductVariant", "CMN_PRO_ASS_AssortmentVariantID", "CMN_PRO_ASS_DistributionPriceID", "CMN_PRO_ASS_DistributionPrice_ValueID", "DefaultPointValue", "ValidFrom", "ValidThrough", "CMN_Price_RefID", "DefaultCurrency", "CMN_Price_ValueID", "PriceValue_Currency_RefID", "PriceValue_Amount" }); while (reader.Read()) { L3AS_GDPfAP_1711_raw resultItem = new L3AS_GDPfAP_1711_raw(); //0:Parameter CMN_PRO_ASS_AssortmentProductID of type Guid resultItem.CMN_PRO_ASS_AssortmentProductID = reader.GetGuid(0); //1:Parameter VariantName_DictID of type Dict resultItem.VariantName_DictID = reader.GetDictionary(1); resultItem.VariantName_DictID.SourceTable = "cmn_pro_product_variants"; loader.Append(resultItem.VariantName_DictID); //2:Parameter IsStandardProductVariant of type bool resultItem.IsStandardProductVariant = reader.GetBoolean(2); //3:Parameter CMN_PRO_ASS_AssortmentVariantID of type Guid resultItem.CMN_PRO_ASS_AssortmentVariantID = reader.GetGuid(3); //4:Parameter CMN_PRO_ASS_DistributionPriceID of type Guid resultItem.CMN_PRO_ASS_DistributionPriceID = reader.GetGuid(4); //5:Parameter CMN_PRO_ASS_DistributionPrice_ValueID of type Guid resultItem.CMN_PRO_ASS_DistributionPrice_ValueID = reader.GetGuid(5); //6:Parameter DefaultPointValue of type double resultItem.DefaultPointValue = reader.GetDouble(6); //7:Parameter ValidFrom of type DateTime resultItem.ValidFrom = reader.GetDate(7); //8:Parameter ValidThrough of type DateTime resultItem.ValidThrough = reader.GetDate(8); //9:Parameter CMN_Price_RefID of type Guid resultItem.CMN_Price_RefID = reader.GetGuid(9); //10:Parameter DefaultCurrency of type Guid resultItem.DefaultCurrency = reader.GetGuid(10); //11:Parameter CMN_Price_ValueID of type Guid resultItem.CMN_Price_ValueID = reader.GetGuid(11); //12:Parameter PriceValue_Currency_RefID of type Guid resultItem.PriceValue_Currency_RefID = reader.GetGuid(12); //13:Parameter PriceValue_Amount of type Double resultItem.PriceValue_Amount = reader.GetDouble(13); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_Get_DistributionPrices_for_AssortmentProduct", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = L3AS_GDPfAP_1711_raw.Convert(results).ToArray(); return(returnStatus); }