public override void DataBind() { this.Items.Clear(); Maticsoft.BLL.Shop.Products.BrandInfo info = new Maticsoft.BLL.Shop.Products.BrandInfo(); foreach (Maticsoft.Model.Shop.Products.BrandInfo info2 in info.GetBrands()) { base.Items.Add(new ListItem(info2.BrandName, info2.BrandId.ToString())); } }
private void GetBrandsKVList(HttpContext context) { List<Maticsoft.Model.Shop.Products.BrandInfo> brands; JsonObject obj2 = new JsonObject(); Maticsoft.BLL.Shop.Products.BrandInfo info = new Maticsoft.BLL.Shop.Products.BrandInfo(); int productTypeId = Globals.SafeInt(context.Request.Form["ProductTypeId"], -1); if (productTypeId < 1) { brands = info.GetBrands(); } else { brands = info.GetModelListByProductTypeId(productTypeId, -1); } JsonArray data = new JsonArray(); brands.ForEach(delegate (Maticsoft.Model.Shop.Products.BrandInfo info) { data.Add(new JsonObject(new string[] { "BrandId", "BrandName" }, new object[] { info.BrandId, info.BrandName })); }); obj2.Put("STATUS", "SUCCESS"); obj2.Put("DATA", data); context.Response.Write(obj2.ToString()); }