/// <summary> /// 更新一条数据 /// </summary> public bool Update(FTDataAccess.Model.ProductHeightDefModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update ProductHeightDef set "); strSql.Append("heightSeq=@heightSeq,"); strSql.Append("mark=@mark"); strSql.Append(" where productHeight=@productHeight "); SqlParameter[] parameters = { new SqlParameter("@heightSeq", SqlDbType.Int, 4), new SqlParameter("@mark", SqlDbType.NVarChar, 200), new SqlParameter("@productHeight", SqlDbType.Int, 4) }; parameters[0].Value = model.heightSeq; parameters[1].Value = model.mark; parameters[2].Value = model.productHeight; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(FTDataAccess.Model.ProductHeightDefModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into ProductHeightDef("); strSql.Append("productHeight,heightSeq,mark)"); strSql.Append(" values ("); strSql.Append("@productHeight,@heightSeq,@mark)"); SqlParameter[] parameters = { new SqlParameter("@productHeight", SqlDbType.Int, 4), new SqlParameter("@heightSeq", SqlDbType.Int, 4), new SqlParameter("@mark", SqlDbType.NVarChar, 200) }; parameters[0].Value = model.productHeight; parameters[1].Value = model.heightSeq; parameters[2].Value = model.mark; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public FTDataAccess.Model.ProductHeightDefModel DataRowToModel(DataRow row) { FTDataAccess.Model.ProductHeightDefModel model = new FTDataAccess.Model.ProductHeightDefModel(); if (row != null) { if (row["productHeight"] != null && row["productHeight"].ToString() != "") { model.productHeight = int.Parse(row["productHeight"].ToString()); } if (row["heightSeq"] != null && row["heightSeq"].ToString() != "") { model.heightSeq = int.Parse(row["heightSeq"].ToString()); } if (row["mark"] != null) { model.mark = row["mark"].ToString(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public FTDataAccess.Model.ProductHeightDefModel GetModel(int productHeight) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 productHeight,heightSeq,mark from ProductHeightDef "); strSql.Append(" where productHeight=@productHeight "); SqlParameter[] parameters = { new SqlParameter("@productHeight", SqlDbType.Int, 4) }; parameters[0].Value = productHeight; FTDataAccess.Model.ProductHeightDefModel model = new FTDataAccess.Model.ProductHeightDefModel(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }