/// <summary>
        /// 获取最后连接字符串MSSQL/MySQL
        /// </summary>
        /// <param name="sqlType">数据库类型,MSSQL/MySQL</param>
        /// <returns>数组 string[] sqlType, int sqlType, string Host, bool isPort, string Port, string Database, string Username, string Password</returns>
        public static string[] getLastConnectionStrings(string sqlType)
        {
            string temp = RWConfig.GetappSettingsValue("LastConnectionStringsFor" + sqlType, ConfigPath);

            string[] result = temp.Split(';');
            return(result);
        }
        /// <summary>
        /// 根据快捷插入模块编码获取快捷插入模块名称、值
        /// </summary>
        public static string[] getQuickInsertModelNameValueByCode(string QuickInsertModelCode)
        {
            string[] result = { };
            string   str    = RWConfig.GetappSettingsValue(QuickInsertModelCode, ConfigPath);

            result = str.Split(';');
            return(result);
        }
        /// <summary>
        /// 根据配置文件中的Key获取对应Value
        /// </summary>
        /// <param name="ConfigKey">配置文件中的Key</param>
        /// <returns>返回Key对应Value,数组</returns>
        public static string[] getConfigValueByKey(string ConfigKey)
        {
            string[] result = { };
            string   str    = RWConfig.GetappSettingsValue(ConfigKey, ConfigPath);

            result = str.Split(';');
            return(result);
        }
 /// <summary>
 /// 获取配置文件中快捷插入配置
 /// </summary>
 public static void getQuickInsertSettingsByappSettings()
 {
     QuickInsert                 = RWConfig.GetappSettingsValue("QuickInsert", ConfigPath);
     QuickInsert_IDIncrement     = RWConfig.GetappSettingsValue("QuickInsert_IDIncrement", ConfigPath);
     QuickInsert_RandomNum       = RWConfig.GetappSettingsValue("QuickInsert_RandomNum", ConfigPath);
     QuickInsert_NewID           = RWConfig.GetappSettingsValue("QuickInsert_NewID", ConfigPath);
     QuickInsert_NewDateTime     = RWConfig.GetappSettingsValue("QuickInsert_NewDateTime", ConfigPath);
     QuickInsert_SameNewID       = RWConfig.GetappSettingsValue("QuickInsert_SameNewID", ConfigPath);
     QuickInsert_RandomStr       = RWConfig.GetappSettingsValue("QuickInsert_RandomStr", ConfigPath);
     QuickInsert_IDIncrementPlus = RWConfig.GetappSettingsValue("QuickInsert_IDIncrementPlus", ConfigPath);
 }
 /// <summary>
 /// 获取配置文件中右侧常用按钮的Text值
 /// </summary>
 public static void getDefaultBtnNameByappSettings()
 {
     btnname1 = RWConfig.GetappSettingsValue("btnname1", "./ToolsCollectionForProgram.exe");
     btnname2 = RWConfig.GetappSettingsValue("btnname2", "./ToolsCollectionForProgram.exe");
     btnname3 = RWConfig.GetappSettingsValue("btnname3", "./ToolsCollectionForProgram.exe");
     btnname4 = RWConfig.GetappSettingsValue("btnname4", "./ToolsCollectionForProgram.exe");
     btnname5 = RWConfig.GetappSettingsValue("btnname5", "./ToolsCollectionForProgram.exe");
     btnname6 = RWConfig.GetappSettingsValue("btnname6", "./ToolsCollectionForProgram.exe");
     btnname7 = RWConfig.GetappSettingsValue("btnname7", "./ToolsCollectionForProgram.exe");
     btnname8 = RWConfig.GetappSettingsValue("btnname8", "./ToolsCollectionForProgram.exe");
     btnname9 = RWConfig.GetappSettingsValue("btnname9", "./ToolsCollectionForProgram.exe");
 }
Example #6
0
 private void getDefaultAppSettings()
 {
     appsetting1   = RWConfig.GetappSettingsValue("1", "./ANDOperationForBase.exe");
     appsetting2   = RWConfig.GetappSettingsValue("2", "./ANDOperationForBase.exe");
     appsetting4   = RWConfig.GetappSettingsValue("4", "./ANDOperationForBase.exe");
     appsetting8   = RWConfig.GetappSettingsValue("8", "./ANDOperationForBase.exe");
     appsetting16  = RWConfig.GetappSettingsValue("16", "./ANDOperationForBase.exe");
     appsetting32  = RWConfig.GetappSettingsValue("32", "./ANDOperationForBase.exe");
     appsetting64  = RWConfig.GetappSettingsValue("64", "./ANDOperationForBase.exe");
     appsetting128 = RWConfig.GetappSettingsValue("128", "./ANDOperationForBase.exe");
     appsetting256 = RWConfig.GetappSettingsValue("256", "./ANDOperationForBase.exe");
     appsetting512 = RWConfig.GetappSettingsValue("512", "./ANDOperationForBase.exe");
 }
 /// <summary>
 /// 获取配置文件中常用SQL配置所有配置编码
 /// </summary>
 public static string[] getCommonlyUsedSQLAllCodes()
 {
     string[] result = { };
     CommonlyUsedSQL = RWConfig.GetappSettingsValue("CommonlyUsedSQL", ConfigPath);
     if (string.IsNullOrEmpty(CommonlyUsedSQL))
     {
         setDefaultCommonlyUsedSQLIfIsNullOrEmptyByappSettings();
         getCommonlyUsedSQLByappSettings();
     }
     else
     {
         result = CommonlyUsedSQL.Split(';');
     }
     return(result);
 }
 /// <summary>
 /// 获取配置文件中快捷插入配置所有配置编码
 /// </summary>
 public static string[] getQuickInsertSettingsAllCodes()
 {
     string[] result = { };
     QuickInsert = RWConfig.GetappSettingsValue("QuickInsert", ConfigPath);
     if (string.IsNullOrEmpty(QuickInsert))
     {
         setDefaultQuickInsertSettingsIfIsNullOrEmptyByappSettings();
         getQuickInsertSettingsByappSettings();
     }
     else
     {
         result = QuickInsert.Split(';');
     }
     return(result);
 }
Example #9
0
        /// <summary>
        /// 查询appSettings配置,并对键值以分号分割
        /// </summary>
        /// <param name="Key">appSettings键</param>
        /// <returns>appSettings值,以分号分割,返回数组</returns>
        public static string[] getappSettingsSplitBySemicolon(string key)
        {
            string[] result = { };
            string   values = RWConfig.GetappSettingsValue(key, CONFIGPATH);

            for (int i = 0; i < 2; i++)
            {
                if (string.IsNullOrEmpty(values))
                {
                    init();
                }
                else
                {
                    result = values.Split(';');
                    break;
                }
            }
            return(result);
        }
Example #10
0
 /// <summary>
 /// 修改appSettings配置
 /// </summary>
 /// <param name="Key">appSettings键</param>
 /// <param name="Value">appSettings值</param>
 /// <returns>true, false</returns>
 public static bool editappSettings(string key, string value)
 {
     try
     {
         if (!string.IsNullOrEmpty(RWConfig.GetappSettingsValue(key, CONFIGPATH)))
         {
             RWConfig.SetappSettingsValue(key, value, CONFIGPATH);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
        /// <summary>
        /// 根据常用SQL编码获取常用SQL名称、语句
        /// </summary>
        public static string[] getCommonlyUsedSQLNameValueByCode(string CommonlyUsedSQLCode)
        {
            string[] result = { };
            string   str    = RWConfig.GetappSettingsValue(CommonlyUsedSQLCode, ConfigPath);

            result = str.Split(';');
            //数组转list,去除元素中结尾是空的元素
            List <string> list = result.ToList();

            for (int i = 0; i < list.Count; i++)
            {
                if (string.IsNullOrEmpty(list[list.Count - 1]))
                {
                    list.RemoveAt(list.Count - 1);
                }
            }
            result = list.ToArray();
            return(result);
        }
        /// <summary>
        /// 新增常用SQL配置
        /// </summary>
        /// <param name="Code">常用SQL编码</param>
        /// <param name="Name">常用SQL名称</param>
        /// <param name="Value">常用SQL语句</param>
        /// <returns>string:新增成功/新增失败/新增项已存在,新增失败/报错信息</returns>
        public static string setCommonlyUsedSQLCodeNameValue(string Code, string Name, string Value)
        {
            try
            {
                if (string.IsNullOrEmpty(Code) || string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Value))
                {
                    return("常用SQL编码/名称/语句不能为空!");
                }
                else
                {
                    string[] str = getQuickInsertSettingsAllCodes();
                    foreach (var item in str)
                    {
                        if (item == Code)
                        {
                            return("在快捷插入配置编码中已存在相同编码,请确认!");
                        }
                    }

                    str = getCommonlyUsedSQLAllCodes();
                    foreach (var item in str)
                    {
                        if (item == Code)
                        {
                            return("在常用SQL配置编码中已存在相同编码,请确认!");
                        }
                    }

                    CommonlyUsedSQL = RWConfig.GetappSettingsValue("CommonlyUsedSQL", ConfigPath);
                    RWConfig.SetappSettingsValue(Code, Name + ";" + Value, ConfigPath);
                    RWConfig.SetappSettingsValue("CommonlyUsedSQL", CommonlyUsedSQL + ";" + Code, ConfigPath);
                    return("新增成功");
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Example #13
0
        /// <summary>
        /// 查询appSettings配置
        /// </summary>
        /// <param name="Key">appSettings键</param>
        /// <returns>appSettings值</returns>
        public static string getappSettings(string key)
        {
            string result = RWConfig.GetappSettingsValue(key, CONFIGPATH);

            return(result);
        }
        /// <summary>
        /// 获取最后连接数据库类型
        /// </summary>
        /// <returns>返回数据库类型,MSSQL/MySQL</returns>
        public static string getLastConnectionType()
        {
            string result = RWConfig.GetappSettingsValue("LastConnectionType", ConfigPath);

            return(result);
        }
 /// <summary>
 /// 获取配置文件中常用SQL配置
 /// </summary>
 public static void getCommonlyUsedSQLByappSettings()
 {
     CommonlyUsedSQL         = RWConfig.GetappSettingsValue("CommonlyUsedSQL", ConfigPath);
     CommonlyUsedSQL_Default = RWConfig.GetappSettingsValue("CommonlyUsedSQL_Default", ConfigPath);
 }