Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Hi.Model.BD_CategoryAttribute model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update [BD_CategoryAttribute] set ");
            strSql.Append("[CompID]=@CompID,");
            strSql.Append("[CategoryID]=@CategoryID,");
            strSql.Append("[AttributeID]=@AttributeID,");
            strSql.Append("[ts]=@ts,");
            strSql.Append("[dr]=@dr,");
            strSql.Append("[modifyuser]=@modifyuser");
            strSql.Append(" where [ID]=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",          SqlDbType.Int),
                new SqlParameter("@CompID",      SqlDbType.Int),
                new SqlParameter("@CategoryID",  SqlDbType.Int),
                new SqlParameter("@AttributeID", SqlDbType.Int),
                new SqlParameter("@ts",          SqlDbType.DateTime),
                new SqlParameter("@dr",          SqlDbType.SmallInt),
                new SqlParameter("@modifyuser",  SqlDbType.Int)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.CompID;
            parameters[2].Value = model.CategoryID;
            parameters[3].Value = model.AttributeID;
            parameters[4].Value = model.ts;
            parameters[5].Value = model.dr;
            parameters[6].Value = model.modifyuser;

            return(SqlHelper.ExecuteSql(SqlHelper.LocalSqlServer, strSql.ToString(), parameters) > 0);
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Hi.Model.BD_CategoryAttribute model, SqlTransaction Tran)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into [BD_CategoryAttribute](");
            strSql.Append("[CompID],[CategoryID],[AttributeID],[ts],[modifyuser])");
            strSql.Append(" values (");
            strSql.Append("@CompID,@CategoryID,@AttributeID,@ts,@modifyuser)");
            strSql.Append(";select @@Identity");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CompID",      SqlDbType.Int),
                new SqlParameter("@CategoryID",  SqlDbType.Int),
                new SqlParameter("@AttributeID", SqlDbType.Int),
                new SqlParameter("@ts",          SqlDbType.DateTime),
                new SqlParameter("@modifyuser",  SqlDbType.Int)
            };
            parameters[0].Value = model.CompID;
            parameters[1].Value = model.CategoryID;
            parameters[2].Value = model.AttributeID;
            parameters[3].Value = model.ts;
            parameters[4].Value = model.modifyuser;
            // return SqlHelper.GetInt(SqlHelper.GetSingle(SqlHelper.LocalSqlServer, strSql.ToString(), parameters));
            if (Tran != null)
            {
                return(SqlHelper.GetInt(SqlHelper.GetSingle(strSql.ToString(), Tran, parameters)));
            }
            return(SqlHelper.GetInt(SqlHelper.GetSingle(SqlHelper.LocalSqlServer, strSql.ToString(), parameters)));
        }
Esempio n. 3
0
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 private Hi.Model.BD_CategoryAttribute GetModel(DataRow r)
 {
     Hi.Model.BD_CategoryAttribute model = new Hi.Model.BD_CategoryAttribute();
     model.ID          = SqlHelper.GetInt(r["ID"]);
     model.CompID      = SqlHelper.GetInt(r["CompID"]);
     model.CategoryID  = SqlHelper.GetInt(r["CategoryID"]);
     model.AttributeID = SqlHelper.GetInt(r["AttributeID"]);
     model.ts          = SqlHelper.GetDateTime(r["ts"]);
     model.dr          = SqlHelper.GetInt(r["dr"]);
     model.modifyuser  = SqlHelper.GetInt(r["modifyuser"]);
     return(model);
 }
Esempio n. 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hi.Model.BD_CategoryAttribute model, System.Data.SqlClient.SqlTransaction Tran)
 {
     return(dal.Update(model, Tran));
 }
Esempio n. 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Hi.Model.BD_CategoryAttribute model, System.Data.SqlClient.SqlTransaction Tran)
 {
     return(dal.Add(model, Tran));
 }