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"; } }
/// <summary> /// 返回数据 /// </summary> /// <param name="row"></param> /// <returns></returns> public ShowShop.Model.Accessories.CommentForm GetModel(System.Data.DataRow row) { ShowShop.Model.Accessories.CommentForm model = new ShowShop.Model.Accessories.CommentForm(); if (row != null) { model.ID = int.Parse(row["id"].ToString()); model.Filed = row["filed"].ToString(); model.Datavalue = row["datavalue"].ToString(); model.IsRequire = int.Parse(row["isrequire"].ToString()); model.Type = int.Parse(row["type"].ToString()); return model; } else { return null; } }