///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5AWSSC_GASC_1413_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5AWSSC_GASC_1413 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5AWSSC_GASC_1413_Array functionReturn = new FR_L5AWSSC_GASC_1413_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_ShoppingCarts", ex); } return(functionReturn); }
protected static FR_L5AWSSC_GASC_1413_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5AWSSC_GASC_1413 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { var returnStatus = new FR_L5AWSSC_GASC_1413_Array(); DbCommand command = Connection.CreateCommand(); command.Connection = Connection; command.Transaction = Transaction; var commandLocation = "CL5_APOWebShop_ShoppingCart.Atomic.Retrieval.SQL.cls_Get_All_ShoppingCarts.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, "NumberOfLastDays", Parameter.NumberOfLastDays); command.CommandText = System.Text.RegularExpressions.Regex.Replace(command.CommandText, "=[ \t]*@Status_GlobalPropertyMatchingID_List", " IN $$Status_GlobalPropertyMatchingID_List$$"); CSV2Core_MySQL.Support.DBSQLSupport.AppendINStatement(command, "$Status_GlobalPropertyMatchingID_List$", Parameter.Status_GlobalPropertyMatchingID_List); CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ProductNameContains", Parameter.ProductNameContains); List <L5AWSSC_GASC_1413> results = new List <L5AWSSC_GASC_1413>(); 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[] { "ORD_PRC_ShoppingCartID", "IsProcurementOrderCreated", "InternalIdentifier", "ShoppingCart_CreationDate", "CMN_STR_OfficeID", "Office_Name_DictID", "Office_InternalName", "ProcurementOrder_Date", "ProcurementOrderStatus", "Status_GlobalPropertyMatchingID" }); while (reader.Read()) { L5AWSSC_GASC_1413 resultItem = new L5AWSSC_GASC_1413(); //0:Parameter ORD_PRC_ShoppingCartID of type Guid resultItem.ORD_PRC_ShoppingCartID = reader.GetGuid(0); //1:Parameter IsProcurementOrderCreated of type bool resultItem.IsProcurementOrderCreated = reader.GetBoolean(1); //2:Parameter InternalIdentifier of type String resultItem.InternalIdentifier = reader.GetString(2); //3:Parameter ShoppingCart_CreationDate of type DateTime resultItem.ShoppingCart_CreationDate = reader.GetDate(3); //4:Parameter CMN_STR_OfficeID of type Guid resultItem.CMN_STR_OfficeID = reader.GetGuid(4); //5:Parameter Office_Name of type Dict resultItem.Office_Name = reader.GetDictionary(5); resultItem.Office_Name.SourceTable = "cmn_str_offices"; loader.Append(resultItem.Office_Name); //6:Parameter Office_InternalName of type String resultItem.Office_InternalName = reader.GetString(6); //7:Parameter ProcurementOrder_Date of type DateTime resultItem.ProcurementOrder_Date = reader.GetDate(7); //8:Parameter ProcurementOrderStatus of type String resultItem.ProcurementOrderStatus = reader.GetString(8); //9:Parameter Status_GlobalPropertyMatchingID of type String resultItem.Status_GlobalPropertyMatchingID = reader.GetString(9); results.Add(resultItem); } } catch (Exception ex) { reader.Close(); throw new Exception("Exception occured durng data retrieval in method cls_Get_All_ShoppingCarts", ex); } reader.Close(); //Load all the dictionaries from the datatables loader.Load(); returnStatus.Result = results.ToArray(); return(returnStatus); }