///<summary> /// Opens the connection/transaction for the given connectionString, and closes them when complete ///<summary> public static FR_L5PR_GPfSCfT_0938 Invoke(string ConnectionString, P_L5PR_GPfSCfT_0938 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(null, null, ConnectionString, Parameter, securityTicket)); }
///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5PR_GPfSCfT_0938 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5PR_GPfSCfT_0938 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5PR_GPfSCfT_0938 functionReturn = new FR_L5PR_GPfSCfT_0938(); 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_Products_for_SearchCriteria_for_Tenant", ex); } return(functionReturn); }
protected static FR_L5PR_GPfSCfT_0938 Execute(DbConnection Connection, DbTransaction Transaction, P_L5PR_GPfSCfT_0938 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5PR_GPfSCfT_0938(); P_L5PR_GNoPfT_1442 numberOfArticelsParameter = new P_L5PR_GNoPfT_1442(); numberOfArticelsParameter.LanguageID = Parameter.LanguageID; numberOfArticelsParameter.SearchCriteria = Parameter.SearchCriteria; L5PR_GNoPfT_1442 numberOfProducts = new L5PR_GNoPfT_1442(); numberOfProducts = cls_Get_Number_of_Products_for_Tenant.Invoke(Connection, Transaction, numberOfArticelsParameter, securityTicket).Result; P_L5PR_GPfT_1439 ProductListParameter = new P_L5PR_GPfT_1439(); ProductListParameter.LanguageID = Parameter.LanguageID; ProductListParameter.ActivePage = Parameter.ActivePage; ProductListParameter.PageSize = Parameter.PageSize; ProductListParameter.SearchCriteria = Parameter.SearchCriteria; ProductListParameter.ExcludedProducts = Parameter.ExcludedProducts; if (Parameter.ActivePage != 0) { ProductListParameter.ActivePage = Parameter.ActivePage - 1; } List <L5PR_GPfT_1439> productList = new List <L5PR_GPfT_1439>(); if ((numberOfProducts.NumberOfProducts - (Parameter.ActivePage + Parameter.PageSize)) > 0 || (numberOfProducts.NumberOfProducts - (Parameter.ActivePage + Parameter.PageSize)) == 0) { productList = cls_Get_Products_for_Tenant.Invoke(Connection, Transaction, ProductListParameter, securityTicket).Result.ToList(); } else { int itemsLeft = numberOfProducts.NumberOfProducts - Parameter.ActivePage; if (itemsLeft > 0) { ProductListParameter.PageSize = itemsLeft; productList = cls_Get_Products_for_Tenant.Invoke(Connection, Transaction, ProductListParameter, securityTicket).Result.ToList(); } else { productList = null; } } L5PR_GPfSCfT_0938 result = new L5PR_GPfSCfT_0938(); result.ProductList = productList != null?productList.ToArray() : new List <L5PR_GPfT_1439>().ToArray(); result.NumberOfProducts = numberOfProducts; returnValue.Result = result; return(returnValue); #endregion UserCode }
///<summary> /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured ///<summary> public static FR_L5PR_GPfSCfT_0938 Invoke(DbConnection Connection, DbTransaction Transaction, P_L5PR_GPfSCfT_0938 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { return(Invoke(Connection, Transaction, null, Parameter, securityTicket)); }