Пример #1
0
        public static DbUtility GetDbUtility(DbProviderType dbProviderType)
        {
            if (null == dbUtility)
            {
                SQLConnectControl sqlConnectControl = new SQLConnectControl();
                SQLConnModel      sqlConn           = new SQLConnModel();

                sqlConn   = sqlConnectControl.InitConnectConfigDB();
                dbUtility = new DbUtility(sqlConn, dbProviderType);
            }

            return(dbUtility);
        }
Пример #2
0
        public static DbUtility GetDefaultDbUtility()
        {
            if (null == dbUtility)
            {
                SQLConnectControl sqlConnectControl = new SQLConnectControl();
                SQLConnModel      sqlConnModel      = new SQLConnModel();

                sqlConnModel = sqlConnectControl.InitConnectConfigDB();
                dbUtility    = new DbUtility(sqlConnModel, DbProviderType.MySql);
            }

            return(dbUtility);
        }
        private bool TestConnetDataBaseAndSave(string ip, string account, string password)
        {
            bool connetSuccess = true;

            try
            {
                if (TestConnetDataBaseButNotSave(ip, account, password))
                {
                    SQLConnectControl sqlConnectControl = new SQLConnectControl();
                    sqlConnectControl.SaveConnectConfigDB(this.sqlConnModel);
                }
                else
                {
                    connetSuccess = false;
                }
            }
            catch (Exception)
            {
                connetSuccess = false;
                throw;
            }

            return(connetSuccess);
        }