public int Update(PicWallInfo model) { string strSql = SQL_UPDATE + PK_PARA_SET; DbParameter[] paras = makeParameterForUpdate(model); return(Db.Helper.ExecuteNonQuery(strSql, paras)); }
protected void btnSubmit_Click(object sender, EventArgs e) { string name = tbName.Text.Trim(); string cover = tbCoverPath.Text.Trim(); if (name.ValidateIsNullOrEmpty("请输入商品名称!")) { return; } if (cover.ValidateIsNullOrEmpty("请上传照片!")) { return; } var model = new TMS.PicWallInfo(); model.AddTime = DateTime.Now; model.AddUserName = CurrentAdmin.UserName; model.AddUserRealName = CurrentAdmin.RealName; model.BigPicPath = ""; model.CoverPath = cover; model.IsTop = 0; model.Name = name; model.Remarks = ""; model.SortOrder = 0; PicWallBLL.AddPhoto(model); tbName.Text = ""; tbCoverPath.Text = ""; MessageBox.Show("添加成功!"); }
public int Update(PicWallInfo model, DbTransaction tran) { string strSql = SQL_UPDATE + PK_PARA_SET; DbParameter[] para = makeParameterForUpdate(model); return(Db.Helper.ExecuteNonQuery(tran, strSql, para)); }
private void fillModel(DbDataReader dr, PicWallInfo model) { model.ID = dr.GetInt32(0); model.Name = dr.GetString(1); model.CoverPath = dr.GetString(2); model.BigPicPath = dr.GetString(3); model.Remarks = dr.GetString(4); model.AddUserName = dr.GetString(5); model.AddUserRealName = dr.GetString(6); model.AddTime = dr.GetDateTime(7); model.SortOrder = dr.GetInt32(8); model.IsTop = dr.GetInt32(9); model.ExtraFields = FieldsHelper.XmlDeserialize(dr.GetString(10)); }
private DbParameter[] makeParameterForAdd(PicWallInfo model) { DbParameter[] paras = { Db.Helper.MakeInParameter("@Name", model.Name), Db.Helper.MakeInParameter("@CoverPath", model.CoverPath), Db.Helper.MakeInParameter("@BigPicPath", model.BigPicPath), Db.Helper.MakeInParameter("@Remarks", model.Remarks), Db.Helper.MakeInParameter("@AddUserName", model.AddUserName), Db.Helper.MakeInParameter("@AddUserRealName", model.AddUserRealName), Db.Helper.MakeInParameter("@AddTime", model.AddTime), Db.Helper.MakeInParameter("@SortOrder", model.SortOrder), Db.Helper.MakeInParameter("@IsTop", model.IsTop), Db.Helper.MakeInParameter("@ExtraFields", FieldsHelper.XmlSerialize(model.ExtraFields)) }; return(paras); }
public int Add(PicWallInfo model) { DbParameter[] paras = makeParameterForAdd(model); return(Db.Helper.ExecuteNonQuery(SQL_ADD, paras)); }
public int Add(PicWallInfo model, DbTransaction tran) { DbParameter[] para = makeParameterForAdd(model); return(Db.Helper.ExecuteNonQuery(tran, SQL_ADD, para)); }