/// <summary> /// 最新 的排序号 /// </summary> /// <returns></returns> public static int NewCateId() { List <int> intList = new List <int>(); List <Hi.Model.BD_GoodsCategory> goodsCategoryList = new Hi.BLL.BD_GoodsCategory().GetAllList(); if (goodsCategoryList != null && goodsCategoryList.Count > 0) { intList.AddRange(goodsCategoryList.Select(item => Convert.ToInt32(string.IsNullOrEmpty(item.SortIndex) ? "0" : item.SortIndex))); return(intList.Max() != 0 ? intList.Max() + 1 : 1000); } else { return(1000); } }
public void BindGoodsCategory() { List <Hi.Model.BD_GoodsCategory> ClassList = new Hi.BLL.BD_GoodsCategory().GetList(" id,CategoryName ", " dr=0 and IsEnabled=1 and Parentid=0 and Compid='" + ViewState["Compid"] + "' ", " createdate "); string.Join(",", ClassList.Select(p => p.ID)); if (ClassList.Count > 0) { Hi.Model.BD_GoodsCategory DefaultClass = new Hi.Model.BD_GoodsCategory(); DefaultClass.CategoryName = "全 部"; DefaultClass.ID = 0; DefaultClass.CompID = ClassList[0].CompID; DefaultClass.ParentId = 0; DefaultClass.IsEnabled = 1; ClassList.Insert(0, DefaultClass); } Rpt_GoodsClass.DataSource = ClassList; Rpt_GoodsClass.DataBind(); }