///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5RS_GRSPfT_1636_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5RS_GRSPfT_1636 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5RS_GRSPfT_1636_Array functionReturn = new FR_L5RS_GRSPfT_1636_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_ReturnShipmentPositions_for_TenantID", ex); } return(functionReturn); }
protected static FR_L5RS_GRSPfT_1636_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5RS_GRSPfT_1636 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5RS_GRSPfT_1636_Array(); var shipmentPositions = cls_Get_ReturnShipmentPositions.Invoke(Connection, Transaction, Parameter.SearchParam, securityTicket).Result; #region Get Articles var parameterProductIds = new P_L3AR_GAfAL_0942(); parameterProductIds.ProductID_List = shipmentPositions.Select(s => s.CMN_PRO_Product_RefID).ToArray(); var articles = new L3AR_GAfAL_0942[0]; if (parameterProductIds.ProductID_List.Length != 0) { articles = cls_Get_Articles_for_ArticleList.Invoke(Connection, Transaction, parameterProductIds, securityTicket).Result; } #endregion #region Set Return Value var returnElements = new List <L5RS_GRSPfT_1636>(); foreach (var shipmentPosition in shipmentPositions) { var returnElement = new L5RS_GRSPfT_1636 { Article = articles.FirstOrDefault(a => a.CMN_PRO_ProductID == shipmentPosition.CMN_PRO_Product_RefID), Position = shipmentPosition }; returnElements.Add(returnElement); } returnValue.Result = returnElements.ToArray(); #endregion //Put your code here return(returnValue); #endregion UserCode }