///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L3CA_GCPERPfR_1151 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L3CA_GCPERPfR_1151 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L3CA_GCPERPfR_1151 functionReturn = new FR_L3CA_GCPERPfR_1151(); 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_CatalogProductExtensionRequest_Products_for_RequestID", ex); } return(functionReturn); }
protected static FR_L3CA_GCPERPfR_1151 Execute(DbConnection Connection, DbTransaction Transaction, P_L3CA_GCPERPfR_1151 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L3CA_GCPERPfR_1151(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL3_APOCatalog.Atomic.Retrieval.SQL.cls_Get_CatalogProductExtensionRequest_Products_for_RequestID.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, "RequestID", Parameter.RequestID); List <L3CA_GCPERPfR_1151_raw> results = new List <L3CA_GCPERPfR_1151_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[] { "Request_Answer", "IsAnswerSent", "IfAnswerSent_Date", "CMN_BPT_CTM_CatalogProductExtensionRequest_ProductID", "CMN_PRO_Product_RefID", "Comment", "Product_Name_DictID", "Product_Description_DictID", "Product_Number", "PriceAmount", "ProductITL" }); while (reader.Read()) { L3CA_GCPERPfR_1151_raw resultItem = new L3CA_GCPERPfR_1151_raw(); //0:Parameter Request_Answer of type String resultItem.Request_Answer = reader.GetString(0); //1:Parameter IsAnswerSent of type bool resultItem.IsAnswerSent = reader.GetBoolean(1); //2:Parameter IfAnswerSent_Date of type DateTime resultItem.IfAnswerSent_Date = reader.GetDate(2); //3:Parameter CMN_BPT_CTM_CatalogProductExtensionRequest_ProductID of type Guid resultItem.CMN_BPT_CTM_CatalogProductExtensionRequest_ProductID = reader.GetGuid(3); //4:Parameter CMN_PRO_Product_RefID of type Guid resultItem.CMN_PRO_Product_RefID = reader.GetGuid(4); //5:Parameter Comment of type String resultItem.Comment = reader.GetString(5); //6:Parameter Product_Name of type Dict resultItem.Product_Name = reader.GetDictionary(6); resultItem.Product_Name.SourceTable = "cmn_pro_products"; loader.Append(resultItem.Product_Name); //7:Parameter Product_Description of type Dict resultItem.Product_Description = reader.GetDictionary(7); resultItem.Product_Description.SourceTable = "cmn_pro_products"; loader.Append(resultItem.Product_Description); //8:Parameter Product_Number of type String resultItem.Product_Number = reader.GetString(8); //9:Parameter PriceAmount of type Double resultItem.PriceAmount = reader.GetDouble(9); //10:Parameter ProductITL of type String resultItem.ProductITL = reader.GetString(10); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_Get_CatalogProductExtensionRequest_Products_for_RequestID", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = L3CA_GCPERPfR_1151_raw.Convert(results).FirstOrDefault(); return(returnStatus); }