public int Update(LineCatInfo model, DbTransaction tran) { string strSql = SQL_UPDATE + PK_PARA_SET; DbParameter[] para = makeParameterForUpdate(model); return(Db.Helper.ExecuteNonQuery(tran, strSql, para)); }
public int Update(LineCatInfo model) { string strSql = SQL_UPDATE + PK_PARA_SET; DbParameter[] paras = makeParameterForUpdate(model); return(Db.Helper.ExecuteNonQuery(strSql, paras)); }
protected void btnConfirm_Click(object sender, EventArgs e) { int parentID = ddlParent.SelectedValue.ToArrowInt(); string catName = tbName.Text.Trim(); int sortOrder = tbSortOrder.Text.Trim().ToArrowInt(); if (catName.ValidateIsNullOrEmpty("请输入分类名称!")) { return; } var model = new TMS.LineCatInfo(); model.IsDel = 0; model.Name = catName; model.Remarks = ""; model.SortOrder = sortOrder; model.ParentID = parentID; model.IsHotSell = 0; model.IsHotSort = 0; model.IsSearchWord = 0; model.IsShowIndex = 0; model.HitTimes = 0; LineBLL.AddLineCat(model); tbName.Text = ""; tbSortOrder.Text = ""; string id = ddlParent.SelectedValue; BindParent(); ddlParent.SelectedValue = id; BindData(); MessageBox.Show("添加成功!"); }
private void fillModel(DbDataReader dr, LineCatInfo model) { model.ID = dr.GetInt32(0); model.Name = dr.GetString(1); model.ParentID = dr.GetInt32(2); model.IsDel = dr.GetInt32(3); model.SortOrder = dr.GetInt32(4); if (!dr.IsDBNull(5)) { model.Remarks = dr.GetString(5); } model.ExtraFields = FieldsHelper.XmlDeserialize(dr.GetString(6)); model.IsShowIndex = dr.GetInt32(7); model.IsHotSell = dr.GetInt32(8); model.IsHotSort = dr.GetInt32(9); model.IsSearchWord = dr.GetInt32(10); model.HitTimes = dr.GetInt32(11); }
private DbParameter[] makeParameterForAdd(LineCatInfo model) { DbParameter[] paras = { Db.Helper.MakeInParameter("@Name", model.Name), Db.Helper.MakeInParameter("@ParentID", model.ParentID), Db.Helper.MakeInParameter("@IsDel", model.IsDel), Db.Helper.MakeInParameter("@SortOrder", model.SortOrder), Db.Helper.MakeInParameter("@Remarks", model.Remarks), Db.Helper.MakeInParameter("@ExtraFields", FieldsHelper.XmlSerialize(model.ExtraFields)), Db.Helper.MakeInParameter("@IsShowIndex", model.IsShowIndex), Db.Helper.MakeInParameter("@IsHotSell", model.IsHotSell), Db.Helper.MakeInParameter("@IsHotSort", model.IsHotSort), Db.Helper.MakeInParameter("@IsSearchWord", model.IsSearchWord), Db.Helper.MakeInParameter("@HitTimes", model.HitTimes) }; return(paras); }
public int Add(LineCatInfo model) { DbParameter[] paras = makeParameterForAdd(model); return(Db.Helper.ExecuteNonQuery(SQL_ADD, paras)); }
public int Add(LineCatInfo model, DbTransaction tran) { DbParameter[] para = makeParameterForAdd(model); return(Db.Helper.ExecuteNonQuery(tran, SQL_ADD, para)); }