/// <summary> /// 实体信息 /// </summary> private MAtlasWeb GetModel(DataRow row) { MAtlasWeb model = new MAtlasWeb(); model.ID = Convert.ToInt32(row["ID"]); model.WID = Convert.ToInt32(row["WID"]); model.ArticleID = Convert.ToInt64(row["ArticleID"]); model.WName = Convert.ToString(row["WName"]); model.Title = Convert.ToString(row["Title"]); return(model); }
private SqlCommand GetCommand(MAtlasWeb model) { SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(new SqlParameter(ID, SqlDbType.Int)); cmd.Parameters.Add(new SqlParameter(WID, SqlDbType.Int)); cmd.Parameters.Add(new SqlParameter(ArticleID, SqlDbType.BigInt)); cmd.Parameters[ID].Value = model.ID; cmd.Parameters[WID].Value = model.WID; cmd.Parameters[ArticleID].Value = model.ArticleID; return(cmd); }
/// <summary> /// 修改 /// </summary> public int Update(MAtlasWeb model, string ConnStr) { StringBuilder sql = new StringBuilder(); sql.Append(" INSERT Web_AtlasWeb"); sql.Append(" SET"); sql.Append(" WID = @WID, "); sql.Append(" ArticleID = @ArticleID "); sql.Append("WHERE ID = @ID "); SqlCommand cmd = GetCommand(model); DbHelperSQL.RunSqlText(sql.ToString(), cmd, 3600, ConnStr); return(Convert.ToInt32(cmd.Parameters[ID].Value)); }
/// <summary> /// 增加 /// </summary> public int Insert(MAtlasWeb model, string ConnStr) { StringBuilder sql = new StringBuilder(); sql.Append(" INSERT Web_AtlasWeb ("); sql.Append(" WID,ArticleID )"); sql.Append(" SELECT"); sql.Append(" @WID,@ArticleID"); sql.Append(" SELECT @ID=@@IDENTITY"); SqlCommand cmd = GetCommand(model); DbHelperSQL.RunSqlText(sql.ToString(), cmd, 3600, ConnStr); return(Convert.ToInt32(cmd.Parameters[ID].Value)); }
/// <summary> /// 根据 主键编号 更新 /// </summary> public int Update(MAtlasWeb model) { return(dal.Update(model, ConnStr)); }
/// <summary> /// 增加 /// </summary> public long Insert(MAtlasWeb model) { return(dal.Insert(model, ConnStr)); }