/// <summary> /// 增加一条数据 /// </summary> public int Add(GameType model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into usta_GameType("); strSql.Append("gameTypeTitle,allowSexType,updateTime,groupCapability,gameCategoryId)"); strSql.Append(" values ("); strSql.Append("@gameTypeTitle,@allowSexType,@updateTime,@groupCapability,@gameCategoryId)"); SqlParameter[] parameters = { new SqlParameter("@gameTypeTitle", SqlDbType.NVarChar,50), new SqlParameter("@allowSexType", SqlDbType.NVarChar,10), new SqlParameter("@updateTime", SqlDbType.DateTime), new SqlParameter("@groupCapability", SqlDbType.TinyInt,1), new SqlParameter("@gameCategoryId", SqlDbType.Int,4)}; parameters[0].Value = model.gameTypeTitle; parameters[1].Value = model.allowSexType; parameters[2].Value = model.updateTime; parameters[3].Value = model.groupCapability; parameters[4].Value = model.gameCategoryId; return SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql.ToString(), parameters); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(GameType model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update usta_GameType set "); strSql.Append("gameTypeTitle=@gameTypeTitle,"); strSql.Append("allowSexType=@allowSexType,"); strSql.Append("groupCapability=@groupCapability,"); strSql.Append("gameCategoryId=@gameCategoryId,"); strSql.Append("updateTime=@updateTime"); strSql.Append(" where gameTypeId=@gameTypeId"); SqlParameter[] parameters = { new SqlParameter("@gameTypeTitle", SqlDbType.NVarChar,50), new SqlParameter("@allowSexType", SqlDbType.NVarChar,10), new SqlParameter("@groupCapability", SqlDbType.TinyInt,1), new SqlParameter("@updateTime", SqlDbType.DateTime), new SqlParameter("@gameTypeId", SqlDbType.Int,4), new SqlParameter("@gameCategoryId", SqlDbType.Int,4)}; parameters[0].Value = model.gameTypeTitle; parameters[1].Value = model.allowSexType; parameters[2].Value = model.groupCapability; parameters[3].Value = model.updateTime; parameters[4].Value = model.gameTypeId; parameters[5].Value = model.gameCategoryId; return SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql.ToString(), parameters); }