protected void Save() { ShowShop.Model.Accessories.Top_Searches tsmodel= new ShowShop.Model.Accessories.Top_Searches(); ShowShop.BLL.Accessories.Top_Searches tsbll= new ShowShop.BLL.Accessories.Top_Searches(); tsmodel.Name = this.txtName.Text; tsmodel.Sort =int.Parse(this.txtSort.Text); tsmodel.IsShow =int.Parse(this.rdolstIsShow.SelectedValue); if (ViewState["id"] == null) { if (tsbll.Add(tsmodel) > 0) { this.txtName.Text = string.Empty; this.ltlMsg.Text = "操作成功,已保存该信息"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } } else { tsmodel.ID = Convert.ToInt32(ViewState["id"].ToString()); if (tsbll.Update(tsmodel) > 0) { this.ltlMsg.Text = "操作成功,已修改该信息"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } } }
protected void BindInfo(int id) { ShowShop.BLL.Accessories.Top_Searches tsbll = new ShowShop.BLL.Accessories.Top_Searches(); ShowShop.Model.Accessories.Top_Searches tsmodel = tsbll.GetModelID(id); if (tsmodel != null) { this.txtName.Text = tsmodel.Name; this.txtSort.Text = tsmodel.Sort.ToString(); this.rdolstIsShow.SelectedValue = tsmodel.IsShow.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.Accessories.Top_Searches data = new ShowShop.BLL.Accessories.Top_Searches(); ChangeHope.DataBase.DataByPage dataPage = data.GetList(); //第一步先添加表头 table.AddHeadCol("10%", "序号"); table.AddHeadCol("40%", "名称"); table.AddHeadCol("15%", "排序"); table.AddHeadCol("20%", "状态"); 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."+No); table.AddCol("<span style='cursor:hand');\">" + dataPage.DataReader["name"].ToString() + "</span>"); table.AddCol(string.Format("<input id='sort{0}' value='{1}' size='5' onblur='Sort({0},{1})'/>", dataPage.DataReader["id"].ToString(), dataPage.DataReader["sort"].ToString())); table.AddCol(string.Format("<img src='../images/{0}.gif'/>", dataPage.DataReader["isshow"].ToString())); table.AddCol(string.Format("<a href=topsearchesseting_edit.aspx?id={0}>编辑</a> <a href='#' onclick='Del({0})'>删除</a>", dataPage.DataReader["id"].ToString())); table.AddRow(); } } string view = table.GetTable() + dataPage.PageToolBar; dataPage.Dispose(); dataPage = null; return view; }
private void sort(int id, int Sort) { ShowShop.BLL.Accessories.Top_Searches bll = new ShowShop.BLL.Accessories.Top_Searches(); if (bll.Amend(id, "sort", Sort) > 0) { Response.Write("ok"); } }
private void del(int id) { ShowShop.BLL.Accessories.Top_Searches bll = new ShowShop.BLL.Accessories.Top_Searches(); bll.Delete(id); Response.Write("ok"); }