///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5AR_GAfSCfT_0938 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5AR_GAfSCfT_0938 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5AR_GAfSCfT_0938 functionReturn = new FR_L5AR_GAfSCfT_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_Articles_for_SearchCriteria_for_Tenant", ex); } return(functionReturn); }
protected static FR_L5AR_GAfSCfT_0938 Execute(DbConnection Connection, DbTransaction Transaction, P_L5AR_GAfSCfT_0938 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5AR_GAfSCfT_0938(); if (Parameter.SearchCriteria != null) { Parameter.SearchCriteria = Parameter.SearchCriteria.Replace("%", "\\%"); Parameter.SearchCriteria = "%" + Parameter.SearchCriteria.ToUpper() + "%"; } P_L5AR_GNoAfT_0936 numberOfArticelsParameter = new P_L5AR_GNoAfT_0936(); numberOfArticelsParameter.LanguageID = Parameter.LanguageID; numberOfArticelsParameter.SearchCriteria = Parameter.SearchCriteria; L5AR_GNoAfT_0936 numberOfArticles = new L5AR_GNoAfT_0936(); numberOfArticles = cls_Get_Number_of_Articles_for_Tenant.Invoke(Connection, Transaction, numberOfArticelsParameter, securityTicket).Result; P_L5AR_GAfT_1108 ArticleListParameter = new P_L5AR_GAfT_1108(); ArticleListParameter.LanguageID = Parameter.LanguageID; ArticleListParameter.ActivePage = Parameter.ActivePage; ArticleListParameter.PageSize = Parameter.PageSize; ArticleListParameter.SearchCriteria = Parameter.SearchCriteria; ArticleListParameter.OrderByCriteria = Parameter.OrderByCriteria; if (Parameter.ActivePage != 0) { ArticleListParameter.ActivePage = Parameter.ActivePage - 1; } List <L5AR_GAfT_1108> articleList = new List <L5AR_GAfT_1108>(); if ((numberOfArticles.NumberOfProducts - (Parameter.ActivePage + Parameter.PageSize)) > 0 || (numberOfArticles.NumberOfProducts - (Parameter.ActivePage + Parameter.PageSize)) == 0) { articleList = cls_Get_Articles_for_Tenant.Invoke(Connection, Transaction, ArticleListParameter, securityTicket).Result.ToList(); } else { int itemsLeft = numberOfArticles.NumberOfProducts - Parameter.ActivePage; if (itemsLeft > 0) { ArticleListParameter.PageSize = itemsLeft; articleList = cls_Get_Articles_for_Tenant.Invoke(Connection, Transaction, ArticleListParameter, securityTicket).Result.ToList(); } else { articleList = null; } } L5AR_GAfSCfT_0938 result = new L5AR_GAfSCfT_0938(); result.AritclesList = articleList.ToArray(); result.NumberOfArticles = numberOfArticles; returnValue.Result = result; return(returnValue); #endregion UserCode }