public CreateDataBaseResponse CreateDataBase(CreateDataBaseRequest request)
        {
            CreateDataBaseResponse response = new CreateDataBaseResponse();

            if (null != request)
            {
                try
                {
                    if (request.SqlScriptFiles.Count > 0)
                    {
                        CreataDataSqlScript(request.SqlScriptFiles);
                    }
                    else
                    {
                        response.ResponseSucceed = false;
                        response.Message         = "无脚本文件";
                    }
                }
                catch (Exception ex)
                {
                    string message = "操作失败。" + ex.Message;
                    response.ResponseSucceed = false;
                    response.Message         = message;
                    LoggingFactory.GetLogger().WriteDebugLogger(message);
                }
            }

            return(response);
        }
        private bool CreateDataBase()
        {
            bool success = true;

            IDataBaseConfigService dataBaseConfigService =
                IocContainerFactory.GetUnityContainer().Resolve <IDataBaseConfigService>();
            IApplicationSettings applicationSettings =
                IocContainerFactory.GetUnityContainer().Resolve <IApplicationSettings>();

            string creatadataBaseSqcritFileRelativePath
                = applicationSettings.CreateDataBaseSqcritFilePath;

            if (!string.IsNullOrWhiteSpace(creatadataBaseSqcritFileRelativePath))
            {
                string dataBaseSqcritFileAbsolutePath =
                    System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory,
                                           creatadataBaseSqcritFileRelativePath);

                CreateDataBaseRequest request = new CreateDataBaseRequest();
                request.SqlScriptFiles.Add(dataBaseSqcritFileAbsolutePath);
                CreateDataBaseResponse response = dataBaseConfigService.CreateDataBase(request);

                if (response.ResponseSucceed)
                {
                    success = true;
                }
                else
                {
                    success = false;
                    MessageBox.Show(response.Message);
                }
            }
            else
            {
                success = false;
                MessageBox.Show("无法获取初始化脚本文件!");
            }

            return(success);
        }