public object SetupConstring(int dbType, string dbserverName, string port, string DBName, string user, string password, string filename = null) { bool IsInstallDB = true; var CmsInstallDir = APP.GetDicstring("CmsInstallDir"); var CmsInstallLockFileName = APP.GetDicstring("CmsInstallLockFileName"); var pyDir = Path.Combine(APPCommon.AppContentDir, CmsInstallDir); if (!Directory.Exists(pyDir)) { Directory.CreateDirectory(pyDir); } var lockfilePath = Path.Combine(pyDir, CmsInstallLockFileName); FileInfo fileInfo = new FileInfo(lockfilePath); if (!fileInfo.Exists) { IsInstallDB = false; } var dbtype = dbType;//0 sqlite,1 mssql 2 mysql var connectionString = string.Empty; if (!IsInstallDB) { switch (dbtype) { case 0: connectionString = filename; break; case 1: connectionString = "Data Source={dbserverName};Initial Catalog={DBName};Port={port};User ID={user};Password={password};Connect Timeout=3000;Max Pool Size =2024;"; break; case 2: connectionString = "Server={dbserverName};Port={port};Database={DBName}; User={user};Password={password};"; break; } } return(new { isok = false, msg = "Already installed" }); }