/// <summary> /// Get a list of sorted AlphabeticalListOfProducts /// </summary> /// <param name="trans">Transaction to run select within</param> /// <returns>Arraylist of AlphabeticalListOfProducts</returns> public static IList <AlphabeticalListOfProductInfo> GetAlphabeticalListOfProductsSorted(string sortExpression, System.Data.SqlClient.SqlTransaction trans) { if (string.IsNullOrEmpty(sortExpression)) { return(GetAlphabeticalListOfProducts(trans)); } System.ComponentModel.ListSortDirection listSortDirection = System.ComponentModel.ListSortDirection.Ascending; string[] sortExpressionParams = sortExpression.Split(' '); string sortFieldName = sortExpressionParams[0]; if (sortExpressionParams.Length > 1) { string direction = sortExpressionParams[1]; if (direction.ToUpper() == "DESC") { listSortDirection = System.ComponentModel.ListSortDirection.Descending; } } // Run a search against the data store List <AlphabeticalListOfProductInfo> alphabeticalListOfProducts = (List <AlphabeticalListOfProductInfo>)dal.GetAlphabeticalListOfProducts(trans); Model.SortComparer <AlphabeticalListOfProductInfo> comparer = new Model.SortComparer <AlphabeticalListOfProductInfo>(sortFieldName, listSortDirection); alphabeticalListOfProducts.Sort(comparer); return((IList <AlphabeticalListOfProductInfo>)alphabeticalListOfProducts); }
/// <summary> /// Get a filted list of AlphabeticalListOfProducts /// </summary> /// <param name="fieldName">Database Field to filter on</param> /// <param name="operatorValue">SQL boolean operator (like, =, <, >, <>, >=, <=)</param> /// <param name="fieldValue">Data to search for</param> /// <returns>Arraylist of AlphabeticalListOfProducts</returns> public static IList <AlphabeticalListOfProductInfo> GetAlphabeticalListOfProductsByFilter(string fieldName, string operatorValue, string fieldValue, string sortExpression) { // Return new if the string is empty if (string.IsNullOrEmpty(fieldName) || string.IsNullOrEmpty(operatorValue) || string.IsNullOrEmpty(fieldValue)) { return(GetAlphabeticalListOfProductsSorted(sortExpression)); } if (string.IsNullOrEmpty(sortExpression)) { return(dal.GetAlphabeticalListOfProductsByFilter(fieldName, operatorValue, fieldValue)); } System.ComponentModel.ListSortDirection listSortDirection = System.ComponentModel.ListSortDirection.Ascending; string[] sortExpressionParams = sortExpression.Split(' '); string sortFieldName = sortExpressionParams[0]; if (sortExpressionParams.Length > 1) { string direction = sortExpressionParams[1]; if (direction.ToUpper() == "DESC") { listSortDirection = System.ComponentModel.ListSortDirection.Descending; } } // Run a search against the data store List <AlphabeticalListOfProductInfo> alphabeticalListOfProducts = (List <AlphabeticalListOfProductInfo>)dal.GetAlphabeticalListOfProductsByFilter(fieldName, operatorValue, fieldValue); Model.SortComparer <AlphabeticalListOfProductInfo> comparer = new Model.SortComparer <AlphabeticalListOfProductInfo>(sortFieldName, listSortDirection); alphabeticalListOfProducts.Sort(comparer); return((IList <AlphabeticalListOfProductInfo>)alphabeticalListOfProducts); }
/// <summary> /// Get a filted list of AlphabeticalListOfProducts /// </summary> /// <param name="fieldName">Database Field to filter on</param> /// <param name="operatorValue">SQL boolean operator (like, =, <, >, <>, >=, <=)</param> /// <param name="fieldValue">Data to search for</param> /// <returns>Arraylist of AlphabeticalListOfProducts</returns> public static IList<AlphabeticalListOfProductInfo> GetAlphabeticalListOfProductsByFilter(string fieldName, string operatorValue, string fieldValue, string sortExpression) { // Return new if the string is empty if (string.IsNullOrEmpty(fieldName) || string.IsNullOrEmpty(operatorValue) || string.IsNullOrEmpty(fieldValue)) { return GetAlphabeticalListOfProductsSorted(sortExpression); } if (string.IsNullOrEmpty(sortExpression)) { return dal.GetAlphabeticalListOfProductsByFilter(fieldName, operatorValue, fieldValue); } System.ComponentModel.ListSortDirection listSortDirection = System.ComponentModel.ListSortDirection.Ascending; string[] sortExpressionParams = sortExpression.Split(' '); string sortFieldName = sortExpressionParams[0]; if (sortExpressionParams.Length > 1) { string direction = sortExpressionParams[1]; if (direction.ToUpper() == "DESC") { listSortDirection = System.ComponentModel.ListSortDirection.Descending; } } // Run a search against the data store List<AlphabeticalListOfProductInfo> alphabeticalListOfProducts = (List<AlphabeticalListOfProductInfo>) dal.GetAlphabeticalListOfProductsByFilter(fieldName, operatorValue, fieldValue); Model.SortComparer<AlphabeticalListOfProductInfo> comparer = new Model.SortComparer<AlphabeticalListOfProductInfo>(sortFieldName, listSortDirection); alphabeticalListOfProducts.Sort(comparer); return (IList<AlphabeticalListOfProductInfo>) alphabeticalListOfProducts; }
/// <summary> /// Get a list of sorted AlphabeticalListOfProducts /// </summary> /// <param name="trans">Transaction to run select within</param> /// <returns>Arraylist of AlphabeticalListOfProducts</returns> public static IList<AlphabeticalListOfProductInfo> GetAlphabeticalListOfProductsSorted(string sortExpression, System.Data.SqlClient.SqlTransaction trans) { if (string.IsNullOrEmpty(sortExpression)) { return GetAlphabeticalListOfProducts(trans); } System.ComponentModel.ListSortDirection listSortDirection = System.ComponentModel.ListSortDirection.Ascending; string[] sortExpressionParams = sortExpression.Split(' '); string sortFieldName = sortExpressionParams[0]; if (sortExpressionParams.Length > 1) { string direction = sortExpressionParams[1]; if (direction.ToUpper() == "DESC") { listSortDirection = System.ComponentModel.ListSortDirection.Descending; } } // Run a search against the data store List<AlphabeticalListOfProductInfo> alphabeticalListOfProducts = (List<AlphabeticalListOfProductInfo>) dal.GetAlphabeticalListOfProducts(trans); Model.SortComparer<AlphabeticalListOfProductInfo> comparer = new Model.SortComparer<AlphabeticalListOfProductInfo>(sortFieldName, listSortDirection); alphabeticalListOfProducts.Sort(comparer); return (IList<AlphabeticalListOfProductInfo>) alphabeticalListOfProducts; }