///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5RS_GRSPwAfP_1526_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5RS_GRSPwAfP_1526 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5RS_GRSPwAfP_1526_Array functionReturn = new FR_L5RS_GRSPwAfP_1526_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_with_Articles_for_PositionIDs", ex); } return(functionReturn); }
protected static FR_L5RS_GRSPwAfP_1526_Array Execute(DbConnection Connection, DbTransaction Transaction, P_L5RS_GRSPwAfP_1526 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_L5RS_GRSPwAfP_1526_Array(); #region Get Return Shipment Positions var returnShipmentPositions = cls_Get_ReturnShipmentPositions_for_PositionIDs.Invoke(Connection, Transaction, Parameter.SearchCriteria, securityTicket).Result; #endregion #region Get Articles var articleIDs = returnShipmentPositions.Select(rsp => rsp.CMN_PRO_Product_RefID).Distinct().ToArray <Guid>(); var articles = new L3AR_GAfAL_0942[0]; var prices = new L3PR_GSPfPIL_1645[0]; if (articleIDs.Length != 0) { var parameterArticles = new P_L3AR_GAfAL_0942 { ProductID_List = articleIDs }; articles = cls_Get_Articles_for_ArticleList.Invoke(Connection, Transaction, parameterArticles, securityTicket).Result; var parameterPrices = new P_L3PR_GSPfPIL_1645 { ProductIDList = articleIDs }; prices = cls_Get_StandardPrices_for_ProductIDList.Invoke(Connection, Transaction, parameterPrices, securityTicket).Result; } #endregion #region Set Return Value var returnElements = new List <L5RS_GRSPwAfP_1526>(); foreach (var position in returnShipmentPositions) { var returnElement = new L5RS_GRSPwAfP_1526 { Article = articles.FirstOrDefault(a => a.CMN_PRO_ProductID == position.CMN_PRO_Product_RefID), Price = prices.FirstOrDefault(a => a.ProductID == position.CMN_PRO_Product_RefID), Position = position }; returnElements.Add(returnElement); } returnValue.Result = returnElements.ToArray(); #endregion return(returnValue); #endregion UserCode }