/// <summary> /// 获取SQL字符串 /// </summary> /// <param name="level">对象</param> /// <returns></returns> private string GetThreatLevelSqlString(ThreatLevel level) { string sql = string.Empty; if (level != null) { sql = string.Format(level.Id <= 0 ? "insert into t_base_threatlevels (level_num, level_value) values ({0}, {1})" : "update t_base_threatlevels set level_value = {1} where level_num = {0}", level.Id, level.Name); } return(sql); }
/// <summary> /// 保存信息 /// </summary> /// <param name="level">对象</param> /// <returns></returns> public int SaveThreatLevel(ThreatLevel level) { return(this.provider.ExecuteSql(this.GetThreatLevelSqlString(level))); }