protected void BindInfo(int id) { ShowShop.BLL.Accessories.CommentForm bll = new ShowShop.BLL.Accessories.CommentForm(); ShowShop.Model.Accessories.CommentForm model = bll.GetModelID(id); if (model != null) { this.txtName.Text = model.Filed; this.txtDataValue.Text = model.Datavalue; this.ddlType.SelectedValue = model.Type.ToString(); this.rdolstIsRequire.SelectedValue = model.IsRequire.ToString(); if (model.Type.ToString() == "4" || model.Type.ToString() == "5") { this.trDatavalue.Style.Value = "display:none"; } ViewState["ID"] = model.ID; } }
/// <summary> /// 列表 /// </summary> /// <returns></returns> protected string GetList() { ChangeHope.WebPage.Table table = new ChangeHope.WebPage.Table(); ShowShop.BLL.Accessories.CommentForm data = new ShowShop.BLL.Accessories.CommentForm(); ChangeHope.DataBase.DataByPage dataPage = data.GetList(); //第一步先添加表头 table.AddHeadCol("5%", "序号"); table.AddHeadCol("15%", "属性名称"); table.AddHeadCol("25%", "所属值"); table.AddHeadCol("10%", "所属类型"); table.AddHeadCol("10%", "是否必填"); table.AddHeadCol("10%", "操作"); 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["filed"].ToString()); table.AddCol(dataPage.DataReader["datavalue"].ToString().Replace("\n",",")); table.AddCol(Type(dataPage.DataReader["type"].ToString())); table.AddCol(string.Format("<img src='../images/{0}.gif'/>", dataPage.DataReader["isrequire"].ToString())); table.AddCol(string.Format("<a href=commentform_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 Save() { ShowShop.BLL.Accessories.CommentForm bll = new ShowShop.BLL.Accessories.CommentForm(); ShowShop.Model.Accessories.CommentForm model = new ShowShop.Model.Accessories.CommentForm(); model.Filed = this.txtName.Text; model.Datavalue = this.txtDataValue.Text; model.IsRequire = ChangeHope.Common.StringHelper.StringToInt(this.rdolstIsRequire.SelectedValue); model.Type = ChangeHope.Common.StringHelper.StringToInt(this.ddlType.SelectedValue); if (ViewState["ID"] != null) { model.ID = ChangeHope.Common.StringHelper.StringToInt(ViewState["ID"].ToString()); bll.Update(model); this.ltlMsg.Text = "操作成功,已保存该信息"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } else { bll.Add(model); this.ltlMsg.Text = "操作成功,已保存该信息"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } }
private void del(int id) { ShowShop.BLL.Accessories.CommentForm bll = new ShowShop.BLL.Accessories.CommentForm(); bll.Delete(id); Response.Write("ok"); }