我目前有一个数组"Brand Products"
,我正在尝试根据name
从数据库中获取它们后的字母顺序对其进行排序,该列表当前使用以下内容填充:
protected override object[] GetCollection()
{
Brand brand = ItemLocator.LocateItem(this.Parent, typeof(Brand)) as Brand;
ICriteria criteria = CoreHttpModule.Session.CreateCriteria(typeof(Product));
criteria.Add(NHibernate.Expression.Expression.Eq("Brand", brand));
criteria.Add(NHibernate.Expression.Expression.Eq("IsVisibleOnWebsite", true));
IList<Product> productList = criteria.List<Product>();
IList<Product> filteredLroductList = new List<Product>();
for (int i = 0; i < productList.Count; i++)
{
if (productList[i].Parent != null)
{
filteredLroductList.Add(productList[i]);
}
}
object[] filteredProductListArray = new object[filteredLroductList.Count];
for (int i = 0; i < filteredLroductList.Count; i++)
{
filteredProductListArray.SetValue(filteredLroductList[i], i);
}
return filteredProductListArray;
}