示例#1
0
 public bool CreateDb(out string errorMessage, out string errorMessageShort)
 {
     if (aggregatorTestDb.CreateDatabase(out errorMessage, out errorMessageShort))
     {
         return(aggregatorDb.CreateDatabase(out errorMessage, out errorMessageShort));
     }
     return(false);
 }
示例#2
0
 public bool CreateDb(out string errorMessage, out string errorMessageShort)
 {
     // If only DDL connection fails then this database needs to be upgraded from mAPI 1.2
     if (ShouldUpgradeFromV12())
     {
         if (!UpgradeFromV12(out errorMessage, out errorMessageShort))
         {
             return(false);
         }
     }
     return(mapiDb.CreateDatabase(out errorMessage, out errorMessageShort));
 }
        /// <summary>
        /// 如果本地数据库不存在则创建它
        /// </summary>
        public void CreateDB()
        {
            #region 如果本地数据库不存在则创建它
            CreateDB createDb = new CreateDB();

            //获取本地连接信息
            int k = createDb.IsExitDB();
            //不存在数据库活着数据库没有附加上去
            if (k == 0)
            {
                if (File.Exists("C:\\RepastErp_data.mdf"))
                {
                    File.Delete("C:\\RepastErp_data.mdf");
                }
                if (File.Exists("C:\\RepastErp_log.ldf"))
                {
                    File.Delete("C:\\RepastErp_log.ldf");
                }

                if (!createDb.CreateDatabase())
                {
                    MessageBox.Show("创建数据库失败!");
                    Application.Exit();
                }
            }
            //本地信息配置有错误
            else if (k == 2)
            {
                MessageBox.Show("创建数据库失败!有可能是本地数据库据端口、用户名及密码配置错误。配置完后重新启动系统。");
                Environment.Exit(0);
            }
            //存在数据库
            else
            {
            }
            #endregion
        }
示例#4
0
        private bool UpgradeFromV12(out string errorMessage, out string errorMessageShort)
        {
            logger.LogInformation("Upgrading database from mAPI version 1.2.0");

            return(mapiDbUpgradeV12.CreateDatabase(out errorMessage, out errorMessageShort));
        }