/// <summary>
 /// 根据常用SQL编码删除常用SQL
 /// </summary>
 /// <param name="CommonlyUsedSQLCode">常用SQL编码</param>
 /// <returns>string:删除成功/删除失败/没有匹配项/报错信息</returns>
 public static string delCommonlyUsedSQLCodeNameValue(string CommonlyUsedSQLCode)
 {
     try
     {
         string[] str = getCommonlyUsedSQLAllCodes();
         foreach (var item in str)
         {
             if (item == CommonlyUsedSQLCode)
             {
                 if (RWConfig.DelappSettingsValue(CommonlyUsedSQLCode, ConfigPath) == true)
                 {
                     List <string> list = str.ToList();
                     list.Remove(item);
                     str = list.ToArray();
                     string result = String.Join(";", str);
                     RWConfig.SetappSettingsValue("CommonlyUsedSQL", result, ConfigPath);
                     return(CommonlyUsedSQLCode + " 删除成功!");
                 }
                 else
                 {
                     return(CommonlyUsedSQLCode + " 删除失败!");
                 }
             }
         }
         return("没有匹配项!");
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
Пример #2
0
 /// <summary>
 /// 删除appSettings配置
 /// </summary>
 /// <param name="Key">appSettings键</param>
 /// <returns>true, false</returns>
 public static bool delappSettings(string key)
 {
     try
     {
         if (!string.IsNullOrEmpty(RWConfig.GetappSettingsValue(key, CONFIGPATH)))
         {
             RWConfig.DelappSettingsValue(key, CONFIGPATH);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }