Пример #1
0
        public void ShowFunctionList(string strFuncName, Window frmParent)
        {
            string sourceUrl = SQLApp.GetIniFile(strFileName, "SourceCode", "SourceUrl");
            bool   isReturn  = false;

            if (string.IsNullOrEmpty(sourceUrl) || !Directory.Exists(sourceUrl))
            {
                isReturn = true;
                FolderBrowserDialog folder = new FolderBrowserDialog();
                if (folder.ShowDialog() == DialogResult.OK)
                {
                    SQLApp.SetIniFile(strFileName, "SourceCode", "SourceUrl", folder.SelectedPath);
                    isReturn = false;
                }
            }
            if (isReturn)
            {
                return;
            }
            List <string>             lstFuncs       = SQLApp.GetKeysIniFile(strCfgScriptName, strFuncName, 3000);
            List <FunctionListObject> lstObjectFuncs = new List <FunctionListObject>();

            lstFuncs.ForEach(x =>
            {
                string caption = SQLApp.GetIniFile(strCfgScriptName, "Captions", x);
                if (string.IsNullOrEmpty(caption))
                {
                    caption = string.Join(" ", x.ToUpper().Split('_'));
                }
                lstObjectFuncs.Add(new FunctionListObject {
                    Name = x, Text = caption
                });
            });
            PromptForm._frmParent = frmParent;
            string           value         = string.Empty;
            MessageBoxResult messageResult = PromptForm.ShowCombobox("Function List In Source", "Function Name", lstObjectFuncs.Select(x => x.Text).ToArray(), ref value);

            if (messageResult == MessageBoxResult.OK)
            {
                FunctionListObject functionObj  = lstObjectFuncs.Find(x => x.Text.Equals(value));
                string             strKey       = (functionObj != null) ? functionObj.Name : string.Empty;
                string             functionName = SQLApp.GetIniFile(strCfgScriptName, strFuncName, strKey);
                if (functionName.StartsWith("Cmd"))
                {
                    functionObj.FuncName = functionName;
                    ExecutedScriptCommand(functionObj, frmParent);
                }
                else
                {
                    CallMethodName(functionName, frmParent);
                }
            }
        }
Пример #2
0
 public void SetServerHistoryConfig(string strSVOld)
 {
     SQLApp.SetIniFile(strFileName, "LoginHistory", "ServerOld", strSVOld);
 }
Пример #3
0
 public void SetDBHistoryConfig(int idx, string strDBOld)
 {
     SQLApp.SetIniFile(strFileName, section, ServerDBOld + (idx + 1), strDBOld);
 }
Пример #4
0
        public void GetConfigConnectSQL(string status, int idx = 0)
        {
            string cnt   = SQLApp.GetIniFile(strFileName, section, serverCnt);
            int    index = Convert.ToInt32(cnt);

            switch (status)
            {
            case "Add":
            case "Edit":
                string           strDesc = SQLApp.GetIniFile(strFileName, section, ServerDesc + idx);
                MessageBoxResult result  = PromptForm.ShowText("Description", "Description", ref strDesc);
                if (result == MessageBoxResult.Cancel)
                {
                    return;
                }
                string strServer = SQLApp.GetIniFile(strFileName, section, ServerName + idx);
                result = PromptForm.ShowText("Server", "Server", ref strServer);
                if (result == MessageBoxResult.Cancel)
                {
                    return;
                }
                string strUser = SQLApp.GetIniFile(strFileName, section, ServerUID + idx);
                result = PromptForm.ShowText("User", "User", ref strUser);
                if (result == MessageBoxResult.Cancel)
                {
                    return;
                }
                string strPass = SQLApp.GetIniFile(strFileName, section, ServerPWD + idx);
                result = PromptForm.ShowText("Pass", "Pass", ref strPass);
                if (result == MessageBoxResult.Cancel)
                {
                    return;
                }

                if (!string.IsNullOrEmpty(strDesc) && !string.IsNullOrEmpty(strServer) && !string.IsNullOrEmpty(strUser))
                {
                    if (status == "Add")
                    {
                        index += 1;
                        SQLApp.SetIniFile(strFileName, section, serverCnt, index.ToString());
                    }
                    else
                    {
                        index = idx;
                    }
                    SQLApp.SetIniFile(strFileName, section, ServerDesc + index, strDesc);
                    SQLApp.SetIniFile(strFileName, section, ServerName + index, strServer);
                    SQLApp.SetIniFile(strFileName, section, ServerUID + index, strUser);
                    SQLApp.SetIniFile(strFileName, section, ServerPWD + index, strPass);
                    SQLApp.SetIniFile(strFileName, section, ServerDBOld + index, "");
                }
                break;

            case "Del":
                SQLApp.SetIniFile(strFileName, section, serverCnt, (index - 1).ToString());
                SQLApp.SetIniFile(strFileName, section, ServerDesc + idx, null);
                SQLApp.SetIniFile(strFileName, section, ServerName + idx, null);
                SQLApp.SetIniFile(strFileName, section, ServerUID + idx, null);
                SQLApp.SetIniFile(strFileName, section, ServerPWD + idx, null);
                SQLApp.SetIniFile(strFileName, section, ServerDBOld + idx, null);
                break;
            }
        }
Пример #5
0
 public void SetThemeName(string themeName)
 {
     SQLApp.SetIniFile(StrFileName, StrThemeApp, StrThemeName, themeName);
 }