/// <summary> /// 得到 T_AttrSKU 数据实体 /// </summary> /// <param name="dr">dr</param> /// <returns>T_AttrSKU 数据实体</returns> public T_AttrSKUEntity Populate_T_AttrSKUEntity_FromDr(IDataReader dr) { T_AttrSKUEntity Obj = new T_AttrSKUEntity(); Obj.Id = ((dr["Id"]) == DBNull.Value)?0:Convert.ToInt32(dr["Id"]); Obj.ClsId = ((dr["ClsId"]) == DBNull.Value)?0:Convert.ToInt32(dr["ClsId"]); Obj.AttrName = dr["AttrName"].ToString(); Obj.AttrDesc = dr["AttrDesc"].ToString(); return(Obj); }
/// <summary> /// 向数据表T_AttrSKU更新一条记录。 /// </summary> /// <param name="_T_AttrSKUModel">_T_AttrSKUModel</param> /// <returns>影响的行数</returns> public int Update(T_AttrSKUEntity _T_AttrSKUModel) { string sqlStr = "update T_AttrSKU set [ClsId]=@ClsId,[AttrName]=@AttrName,[AttrDesc]=@AttrDesc where Id=@Id"; SqlParameter[] _param = { new SqlParameter("@Id", SqlDbType.Int), new SqlParameter("@ClsId", SqlDbType.Int), new SqlParameter("@AttrName", SqlDbType.VarChar), new SqlParameter("@AttrDesc", SqlDbType.VarChar) }; _param[0].Value = _T_AttrSKUModel.Id; _param[1].Value = _T_AttrSKUModel.ClsId; _param[2].Value = _T_AttrSKUModel.AttrName; _param[3].Value = _T_AttrSKUModel.AttrDesc; return(SqlHelper.ExecuteNonQuery(WebConfig.WfxRW, CommandType.Text, sqlStr, _param)); }
/// <summary> /// 向数据库中插入一条新记录。带事务 /// </summary> /// <param name="sp">事务对象</param> /// <param name="_T_AttrSKUModel">T_AttrSKU实体</param> /// <returns>新插入记录的编号</returns> public int Insert(SqlTransaction sp, T_AttrSKUEntity _T_AttrSKUModel) { string sqlStr = "insert into T_AttrSKU([ClsId],[AttrName],[AttrDesc]) values(@ClsId,@AttrName,@AttrDesc) select @@identity"; int res; SqlParameter[] _param = { new SqlParameter("@ClsId", SqlDbType.Int), new SqlParameter("@AttrName", SqlDbType.VarChar), new SqlParameter("@AttrDesc", SqlDbType.VarChar) }; _param[0].Value = _T_AttrSKUModel.ClsId; _param[1].Value = _T_AttrSKUModel.AttrName; _param[2].Value = _T_AttrSKUModel.AttrDesc; res = Convert.ToInt32(SqlHelper.ExecuteScalar(sp, CommandType.Text, sqlStr, _param)); return(res); }
/// <summary> /// 得到 T_AttrSKU 数据实体 /// </summary> /// <param name="row">row</param> /// <returns>T_AttrSKU 数据实体</returns> public T_AttrSKUEntity Populate_T_AttrSKUEntity_FromDr(DataRow row) { T_AttrSKUEntity Obj = new T_AttrSKUEntity(); if (row != null) { Obj.Id = ((row["Id"]) == DBNull.Value)?0:Convert.ToInt32(row["Id"]); Obj.ClsId = ((row["ClsId"]) == DBNull.Value)?0:Convert.ToInt32(row["ClsId"]); Obj.AttrName = row["AttrName"].ToString(); Obj.AttrDesc = row["AttrDesc"].ToString(); } else { return(null); } return(Obj); }
/// <summary> /// 根据ID,返回一个T_AttrSKU对象 /// </summary> /// <param name="id">id</param> /// <returns>T_AttrSKU对象</returns> public T_AttrSKUEntity Get_T_AttrSKUEntity(int id) { T_AttrSKUEntity _obj = null; SqlParameter[] _param = { new SqlParameter("@Id", SqlDbType.Int) }; _param[0].Value = id; string sqlStr = "select * from T_AttrSKU with(nolock) where Id=@Id"; using (SqlDataReader dr = SqlHelper.ExecuteReader(WebConfig.WfxRW, CommandType.Text, sqlStr, _param)) { while (dr.Read()) { _obj = Populate_T_AttrSKUEntity_FromDr(dr); } } return(_obj); }
public void Update(T_AttrSKUEntity t_attrSKUEntity) { t_attrSKUdal.Update(t_attrSKUEntity); }
public int Insert(T_AttrSKUEntity t_attrSKUEntity) { return(t_attrSKUdal.Insert(t_attrSKUEntity)); }