///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L3VA_GAVfP_1300_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3VA_GAVfP_1300 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L3VA_GAVfP_1300_Array functionReturn = new FR_L3VA_GAVfP_1300_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_Variants_for_Product", ex); } return(functionReturn); }
protected static FR_L3VA_GAVfP_1300_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L3VA_GAVfP_1300 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L3VA_GAVfP_1300_Array(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL3_Variant.Atomic.Retrieval.SQL.cls_Get_All_Variants_for_Product.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 <L3VA_GAVfP_1300_raw> results = new List <L3VA_GAVfP_1300_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_Product_VariantID", "ProductVariantITL", "VariantName_DictID", "IsStandardProductVariant", "IsImportedFromExternalCatalog", "IsProductAvailableForOrdering", "IsObsolete", "CMN_PRO_Dimension_ValueID", "DimensionValue_Text_DictID", "DimensionValue_OrderSequence", "CMN_PRO_DimensionID", "Abbreviation", "DimensionName_DictID", "Dimension_OrderSequence", "IsDimensionTemplate" }); while (reader.Read()) { L3VA_GAVfP_1300_raw resultItem = new L3VA_GAVfP_1300_raw(); //0:Parameter CMN_PRO_Product_VariantID of type Guid resultItem.CMN_PRO_Product_VariantID = reader.GetGuid(0); //1:Parameter ProductVariantITL of type string resultItem.ProductVariantITL = reader.GetString(1); //2:Parameter VariantName of type Dict resultItem.VariantName = reader.GetDictionary(2); resultItem.VariantName.SourceTable = "cmn_pro_product_variants"; loader.Append(resultItem.VariantName); //3:Parameter IsStandardProductVariant of type bool resultItem.IsStandardProductVariant = reader.GetBoolean(3); //4:Parameter IsImportedFromExternalCatalog of type bool resultItem.IsImportedFromExternalCatalog = reader.GetBoolean(4); //5:Parameter IsProductAvailableForOrdering of type bool resultItem.IsProductAvailableForOrdering = reader.GetBoolean(5); //6:Parameter IsObsolete of type bool resultItem.IsObsolete = reader.GetBoolean(6); //7:Parameter CMN_PRO_Dimension_ValueID of type Guid resultItem.CMN_PRO_Dimension_ValueID = reader.GetGuid(7); //8:Parameter DimensionValue_Text of type Dict resultItem.DimensionValue_Text = reader.GetDictionary(8); resultItem.DimensionValue_Text.SourceTable = "cmn_pro_dimension_values"; loader.Append(resultItem.DimensionValue_Text); //9:Parameter DimensionValue_OrderSequence of type int resultItem.DimensionValue_OrderSequence = reader.GetInteger(9); //10:Parameter CMN_PRO_DimensionID of type Guid resultItem.CMN_PRO_DimensionID = reader.GetGuid(10); //11:Parameter Abbreviation of type string resultItem.Abbreviation = reader.GetString(11); //12:Parameter DimensionName of type Dict resultItem.DimensionName = reader.GetDictionary(12); resultItem.DimensionName.SourceTable = "cmn_pro_dimensions"; loader.Append(resultItem.DimensionName); //13:Parameter Dimension_OrderSequence of type int resultItem.Dimension_OrderSequence = reader.GetInteger(13); //14:Parameter IsDimensionTemplate of type bool resultItem.IsDimensionTemplate = reader.GetBoolean(14); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_Get_All_Variants_for_Product", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = L3VA_GAVfP_1300_raw.Convert(results).ToArray(); return(returnStatus); }