protected override List <object> GetDataSource()
        {
            ProductCategoryBLL     bll   = new ProductCategoryBLL(AppSettings.Current.ConnStr);
            List <ProductCategory> items = null;

            if (SearchCondition == null)
            {
                items = bll.GetItems(null).QueryObjects;
            }
            else
            {
                items = bll.GetItems(SearchCondition).QueryObjects;
            }
            return(items.Select(p => (object)p).ToList());
        }
Beispiel #2
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init()
        {
            ProductCategoryBLL     bll   = new ProductCategoryBLL(AppSettings.Current.ConnStr);
            List <ProductCategory> items = bll.GetItems(null).QueryObjects;

            this.Items.Clear();
            if (items.Count > 0)
            {
                items = (from item in items
                         orderby item.Name descending
                         select item).ToList();
                items.Insert(0, new ProductCategory());
                this.DataSource = items;
            }
            this.DropDownStyle = ComboBoxStyle.DropDownList;
        }