protected void BandInfo(int id) { ShowShop.BLL.Product.ProductBrand bll = new ShowShop.BLL.Product.ProductBrand(); ShowShop.Model.Product.ProductBrand model = bll.GetModelID(id); this.txtName.Text = model.Name; this.txtSort.Text = model.Sort.ToString(); ViewState["ID"] = model.ID; }
protected void BindProductBrand() { ShowShop.BLL.Product.ProductBrand bll = new ShowShop.BLL.Product.ProductBrand(); ChangeHope.DataBase.DataByPage dataPage = bll.GetList(); this.w_d_pro_BrandID.Items.Add(new ListItem("--所有品牌--", "")); if (dataPage.DataReader != null) { while (dataPage.DataReader.Read()) { this.w_d_pro_BrandID.Items.Add(new ListItem(dataPage.DataReader["name"].ToString(), dataPage.DataReader["bid"].ToString())); } } }
/// <summary> /// 列表 /// </summary> /// <returns></returns> protected string GetList() { ShowShop.Common.SysParameter sp = new ShowShop.Common.SysParameter(); ChangeHope.WebPage.Table table = new ChangeHope.WebPage.Table(); ShowShop.BLL.Product.ProductBrand data = new ShowShop.BLL.Product.ProductBrand(); ChangeHope.DataBase.DataByPage dataPage = data.GetList(); //第一步先添加表头 table.AddHeadCol("5%", "序号"); table.AddHeadCol("25%", "品牌名称"); table.AddHeadCol("25%", "排序"); table.AddHeadCol("25%", "操作"); table.AddRow(); //添加表的内容 if (dataPage.DataReader != null) { int curpage = ChangeHope.WebPage.PageRequest.GetInt("pageindex"); if (curpage < 0) { curpage = 1; } int count = 0; while (dataPage.DataReader.Read()) { count++; string No = (15 * (curpage - 1) + count).ToString(); table.AddCol(No); table.AddCol(dataPage.DataReader["name"].ToString()); table.AddCol(string.Format("<input id='sort{0}' value='{1}' size='5' onblur='Sort({0},{1})'/>", dataPage.DataReader["bid"].ToString(), dataPage.DataReader["sort"].ToString())); table.AddCol(string.Format("<a href=productbrand_edit.aspx?id={0}>编辑</a> <a href='#' onclick='Del({0})'>删除</a>", dataPage.DataReader["bid"].ToString())); table.AddRow(); } } string view = table.GetTable() + dataPage.PageToolBar; dataPage.Dispose(); dataPage = null; return view; }
/// <summary> /// 保存信息 /// </summary> protected void Save() { ShowShop.Common.SysParameter sp = new ShowShop.Common.SysParameter(); ShowShop.BLL.Product.ProductBrand bll = new ShowShop.BLL.Product.ProductBrand(); ShowShop.Model.Product.ProductBrand model = new ShowShop.Model.Product.ProductBrand(); model.Name = txtName.Text.Trim(); if (string.IsNullOrEmpty(txtSort.Text.Trim())) { model.Sort = 0; } else { model.Sort = Convert.ToInt32(txtSort.Text.Trim()); } if (ViewState["ID"] != null) { model.ID = int.Parse(ViewState["ID"].ToString()); bll.Update(model); ChangeHope.WebPage.BasePage.PageRight("信息已修改。", "productbrand_list.aspx"); } else { int bId = bll.Add(model); if (bId > 0) { ChangeHope.WebPage.BasePage.PageRight("信息已保存,您还可以继续添加。", "productbrand_edit.aspx"); } } }
private void sort(int id, int Sort) { ShowShop.BLL.Product.ProductBrand bll = new ShowShop.BLL.Product.ProductBrand(); bll.Amend(id, "sort", Sort); Response.Write("ok"); }
private void del(int id) { ShowShop.BLL.Product.ProductBrand bll = new ShowShop.BLL.Product.ProductBrand(); ShowShop.Model.Product.ProductBrand model = bll.GetModelID(id); if (model != null) { bll.Delete(id); } Response.Write("ok"); }