Esempio n. 1
0
        //public static void GetConfigConnectSQL(string status, int idx = 0)
        //{
        //    string cnt = SQLApp.GetIniFile(strFileName, section, serverCnt);
        //    int index = Convert.ToInt32(cnt);
        //    string strDesc = SQLApp.GetIniFile(strFileName, section, _serverDesc + idx);
        //    DialogResult result = PromptForm.ShowText("Description", "Description", ref strDesc);
        //    if (result == DialogResult.Cancel) return;
        //    string strServer = SQLApp.GetIniFile(strFileName, section, _serverName + idx);
        //    result = PromptForm.ShowText("Server", "Server", ref strServer);
        //    if (result == DialogResult.Cancel) return;
        //    string strUser = SQLApp.GetIniFile(strFileName, section, _serverUID + idx);
        //    result = PromptForm.ShowText("User", "User", ref strUser);
        //    if (result == DialogResult.Cancel) return;
        //    string strPass = SQLApp.GetIniFile(strFileName, section, _serverPWD + idx);
        //    result = PromptForm.ShowText("Pass", "Pass", ref strPass);
        //    if (result == DialogResult.Cancel) return;
        //    if (status == "add")
        //    {
        //        if (!string.IsNullOrEmpty(strDesc) && !string.IsNullOrEmpty(strServer) && !string.IsNullOrEmpty(strUser) && !string.IsNullOrEmpty(strPass))
        //        {
        //            index += 1;
        //            SQLApp.SetIniFile(strFileName, section, serverCnt, index.ToString());
        //            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, "");
        //        }
        //    }
        //    else if (status == "edit")
        //    {
        //        if (!string.IsNullOrEmpty(strDesc) && !string.IsNullOrEmpty(strServer) && !string.IsNullOrEmpty(strUser) && !string.IsNullOrEmpty(strPass))
        //        {
        //            SQLApp.SetIniFile(strFileName, section, _serverDesc + idx, strDesc);
        //            SQLApp.SetIniFile(strFileName, section, _serverName + idx, strServer);
        //            SQLApp.SetIniFile(strFileName, section, _serverUID + idx, strUser);
        //            SQLApp.SetIniFile(strFileName, section, _serverPWD + idx, strPass);
        //        }
        //    }
        //    else
        //    {
        //        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);
        //    }
        //}
        #endregion

        #region Load config
        public static void LoadConfigIniFromServer(Control cbbData)
        {
            try
            {
                #region Code mới lấy thông tin từ file config

                string        count = SQLApp.GetIniFile(strFileName, section, serverCnt);
                List <string> lst   = new List <string>();
                for (int i = 0; i < Convert.ToInt32(count); i++)
                {
                    lst.Add(SQLApp.GetIniFile(strFileName, section, _serverDesc + (i + 1)));
                }
                if (cbbData is System.Windows.Forms.ComboBox)
                {
                    ((System.Windows.Forms.ComboBox)cbbData).Items.Clear();
                    ((System.Windows.Forms.ComboBox)cbbData).Items.AddRange(lst.ToArray());
                }
                else if (cbbData is DevExpress.XtraEditors.ComboBox)
                {
                    ((DevExpress.XtraEditors.ComboBox)cbbData).Properties.Items.Clear();
                    ((DevExpress.XtraEditors.ComboBox)cbbData).Properties.Items.AddRange(lst);
                }
                else if (cbbData is ComboBoxEdit)
                {
                    ((ComboBoxEdit)cbbData).Properties.Items.Clear();
                    ((ComboBoxEdit)cbbData).Properties.Items.AddRange(lst);
                }
                #endregion
            }
            catch
            {
            }
        }
Esempio n. 2
0
        public static string[] LoadDatabaseByServer(int idx = -1)
        {
            List <string> lst = new List <string>();

            try
            {
                if (idx != -1)
                {
                    strServer   = SQLApp.GetIniFile(strFileName, section, _serverName + (idx + 1));
                    strUserName = SQLApp.GetIniFile(strFileName, section, _serverUID + (idx + 1));
                    strPassWord = SQLApp.GetIniFile(strFileName, section, _serverPWD + (idx + 1));
                    strDBOld    = SQLApp.GetIniFile(strFileName, section, _serverDBOld + (idx + 1));

                    SQLDBUtil.SwitchConnection(SQLDBUtil.ConnectionType, strServer, strDBOld, strUserName, strPassWord);
                    DataTable dtSource = SQLDBUtil.GetDataTableByDataSet(SQLDBUtil.GetAllDatabases());
                    if (dtSource != null)
                    {
                        lst = dtSource.Select().Select(x => x["name"].ToString()).ToList();
                    }
                }
            }
            catch
            {
                return(null);
            }
            return(lst.ToArray());
        }
Esempio n. 3
0
        public static int GetAnimateWindowTime()
        {
            int dwTime = 5000;

            dwTime = Convert.ToInt32(SQLApp.GetIniFile(strFileName, "AnimateWindow", "AnimateTime"));
            return(dwTime);
        }
Esempio n. 4
0
 public static string GetServerHistoryConfig()
 {
     return(SQLApp.GetIniFile(strFileName, "LoginHistory", "ServerOld"));
 }
Esempio n. 5
0
 public static void SetServerHistoryConfig(string strSVOld)
 {
     SQLApp.SetIniFile(strFileName, "LoginHistory", "ServerOld", strSVOld);
 }
Esempio n. 6
0
 public static void SetDBHistoryConfig(int idx, string strDBOld)
 {
     SQLApp.SetIniFile(strFileName, section, _serverDBOld + (idx + 1), strDBOld);
 }
Esempio n. 7
0
 public static string GetDBHistoryConfig(int idx)
 {
     return(SQLApp.GetIniFile(strFileName, section, _serverDBOld + (idx + 1)));
 }
Esempio n. 8
0
 public static string GetDescriptionConfig(int idx)
 {
     return(SQLApp.GetIniFile(strFileName, section, _serverDesc + (idx + 1)));
 }
Esempio n. 9
0
 public static string GetPassWordConfig(int idx)
 {
     return(SQLApp.GetIniFile(strFileName, section, _serverPWD + (idx + 1)));
 }
Esempio n. 10
0
 public static string GetUserNameConfig(int idx)
 {
     return(SQLApp.GetIniFile(strFileName, section, _serverUID + (idx + 1)));
 }