Exemplo n.º 1
0
        protected virtual bool Save(KindKey entityId, KindItem datablob)
        {
            //we create if does not exist
            var saveStatus = false;

            using (var conn = new SqlConnection(_db.ConnectionString))
                using (var command = new SqlCommand(string.Format(insertSql, _tableName.Value), conn))
                {
                    try
                    {
                        conn.Open();
                        //check if our table tables, create if it doesn't
                        command.CommandText = string.Format(insertSql, _tableName.Value);
                        command.Parameters.AddWithValue("@id", entityId.Value);
                        command.Parameters.AddWithValue("@datablob", datablob.Value);
                        saveStatus = command.ExecuteNonQuery() > 0;
                    }
                    catch (SqlException ex)
                    {
                        if (MainLogger != null)
                        {
                            MainLogger.Log(string.Format(
                                               "Error opening database connection{0}{1}", Environment.NewLine, ex.ToString()));
                        }
                        return(false);
                    }

                    conn.Close();
                }
            return(saveStatus);
        }
        internal T GetLatestEntity()
        {
            T entity = null;

            using (var conn = new SqlConnection(_db.ConnectionString))
                using (var command = new SqlCommand(string.Format(insertSql, _tableName.Value), conn))
                {
                    try
                    {
                        conn.Open();
                        //check if our table tables, create if it doesn't
                        command.CommandText = string.Format(
                            "select top 1 * from {0} order by editdate desc", _tableName.Value);
                        using (var reader = command.ExecuteReader())
                        {
                            entity = getEntities(reader).FirstOrDefault();
                        }
                    }
                    catch (SqlException ex)
                    {
                        if (MainLogger != null)
                        {
                            MainLogger.Log(string.Format(
                                               "Error opening database connection{0}{1}", Environment.NewLine, ex.ToString()));
                        }
                        return(null);
                    }
                    conn.Close();
                }
            return(entity);
        }
Exemplo n.º 3
0
        public int Save(string identifierKey)
        {
            var _db      = new LocalDB();
            int toReturn = -1;

            //we create if does not exist
            using (var conn = new SqlConnection(_db.ConnectionString))
                using (var command = new SqlCommand(string.Format(_insertSql), conn))
                {
                    try
                    {
                        conn.Open();
                        command.Parameters.AddWithValue("@stringid", identifierKey);
                        var res = Convert.ToInt32(command.ExecuteScalar());
                        toReturn = res;
                    }
                    catch (SqlException ex)
                    {
                        if (MainLogger != null)
                        {
                            MainLogger.Log(string.Format(
                                               "Error opening database connection{0}{1}", Environment.NewLine, ex.ToString()));
                        }
                        return(-1);
                    }
                    conn.Close();
                }
            return(toReturn);
        }
Exemplo n.º 4
0
        private void HandleException(IHttpContext context, Exception ex)
        {
            IResponse response = context.Response;
            IRequest  request  = context.Request;

            if (response.OutputStream != null)
            {
                using (StreamWriter sw = new StreamWriter(response.OutputStream))
                {
                    string description = "({0})"._Format(ex.Message);
                    response.StatusCode        = (int)HttpStatusCode.InternalServerError;
                    response.StatusDescription = description;
                    sw.WriteLine("<!DOCTYPE html>");
                    Tag html = new Tag("html");
                    html.Child(new Tag("body")
                               .Child(new Tag("h1").Text("Internal Server Exception"))
                               .Child(new Tag("p").Text(description))
                               );
                    sw.WriteLine(html.ToHtmlString());
                    sw.Flush();
                }
            }
            MainLogger.AddEntry("An error occurred handling the request: ({0})\r\n*** Request Details {1}***\r\n{2}\r\n\r\n{3}",
                                ex,
                                request.GetClientIp(),
                                ex.Message,
                                request.TryPropertiesToString(),
                                Args.GetMessageAndStackTrace(ex));
        }
Exemplo n.º 5
0
        public virtual void Initialize()
        {
            if (!this.IsInitialized)
            {
                OnInitializing();
                LoadConf();

                Subscribe(MainLogger);
                SubscribeResponders(MainLogger);

                MainLogger.AddEntry("{0} initializing: \r\n{1}", this.GetType().Name, this.PropertiesToString());

                InitializeCommonSchemas();

                InitializeResponders();

                InitializeUserManagers();

                InitializeApps();

                ConfigureHttpServer();

                RegisterWorkspaceDaos();

                OnInitialized();
            }
            else
            {
                MainLogger.AddEntry("Initialize called but the {0} was already initialized", LogEventType.Warning, this.GetType().Name);
            }
        }
Exemplo n.º 6
0
        protected void TryAddAdditionalLoggers(BamConf conf)
        {
            Type[]    loggerTypes;
            ILogger[] loggers = new ILogger[] { };
            try
            {
                loggers = conf.GetAdditionalLoggers(out loggerTypes);
            }
            catch (Exception ex)
            {
                MainLogger.AddEntry("An error occurred getting additional loggers: {0}", ex, ex.Message);
            }

            loggers.Each(logger =>
            {
                try
                {
                    AddLogger(logger);
                }
                catch (Exception ex)
                {
                    MainLogger.AddEntry("An error occurred trying to add a logger: {0}", ex, ex.Message);
                }
            });

            AdditionalLoggers = loggers;
        }
Exemplo n.º 7
0
        private void HandleResponderNotFound(IHttpContext context)
        {
            IResponse response = context.Response;
            IRequest  request  = context.Request;

            string path          = request.Url.ToString();
            string messageFormat = "No responder was found for the path: {0}";
            string description   = "Responder not found";

            using (StreamWriter sw = new StreamWriter(response.OutputStream))
            {
                response.StatusCode        = (int)HttpStatusCode.NotFound;
                response.StatusDescription = description;
                sw.WriteLine("<!DOCTYPE html>");
                Tag html = new Tag("html");
                html.Child(new Tag("body")
                           .Child(new Tag("h1").Text(description))
                           .Child(new Tag("p").Text(string.Format(messageFormat, path)))
                           );
                sw.WriteLine(html.ToHtmlString());
                sw.Flush();
                sw.Close();
            }
            string logMessageFormat = "[ClientIp: {0}] No responder found for the path: {1}";

            MainLogger.AddEntry(logMessageFormat, LogEventType.Warning, request.GetClientIp(), path);
        }
Exemplo n.º 8
0
 public void SaveLog()
 {
     if (Options.Instance.UpdateLog)
     {
         MainLogger.Save(Path.Combine(Options.Instance.UpdateLogDirectory, Options.Instance.UpdateLogFileName));
     }
 }
Exemplo n.º 9
0
        public void Update()
        {
            if (!Check())
            {
                return;
            }

            try
            {
                string zipFileName = Path.Combine(Application.StartupPath, "update.zip");
                // Opens existing zip file
                ZipStorer zip = ZipStorer.Open(zipFileName, FileAccess.Read);

                // Read all directory contents
                List <ZipStorer.ZipFileEntry> zipFiles = zip.ReadCentralDir();

                // Extract all files in target directory
                foreach (ZipStorer.ZipFileEntry entry in zipFiles)
                {
                    if (zip.ExtractFile(entry, Path.Combine(Application.StartupPath, Path.GetFileName(entry.FilenameInZip))))
                    {
                        MainLogger.Append("Extracted: " + entry.FilenameInZip, LogMessageType.Info);
                    }
                    else
                    {
                        MainLogger.Append("Extract failed: " + entry.FilenameInZip, LogMessageType.Info);
                    }
                }

                zip.Close();

                File.Delete(zipFileName);
            }
            catch (Exception) { }
        }
Exemplo n.º 10
0
        public Initializer(string settingsProfileName)
        {
            new FileChecker();

            var di = DiContainer.Container;

            _logger  = di.Locate <MainLogger>();
            Settings = di.Locate <Settings>();
            if (!string.IsNullOrEmpty(settingsProfileName))
            {
                Settings.ConfigFileName = Settings.ConfigFileName.Replace(".ini", $".{settingsProfileName}.ini");
            }

            Settings.Load();

            var saver = di.Locate <MainSaver>();

            if (Settings.Get <bool>(_names.Console))
            {
                _logger.AddLogger(new ConsoleLogger(Settings));
            }
            else
            {
                _logger.AddLogger(new EmptyLogger());
            }

            _logger.AddLogger(new FileLogger(saver, Settings));
#if !DEBUG
            _logger.AddLogger(new SentryLogger());
#endif
            _logger.Log("Created DI container", LogLevel.Basic);
        }
Exemplo n.º 11
0
        public void Write(string message, Exception ex = null, Dictionary <string, object> parameters = null)
        {
            var props = new LoggingEventData
            {
                TimeStampUtc = DateTime.UtcNow,
                Message      = message
            };

            if (ex != null)
            {
                props.Level   = Level.Error;
                props.Message = ex.ToString();
            }
            else
            {
                props.Level = Level.Info;
            }

            if (parameters != null)
            {
                props.Properties = new PropertiesDictionary();
                foreach (var pr in parameters)
                {
                    props.Properties[pr.Key] = pr.Value;
                }
            }

            MainLogger.Log(new LoggingEvent(props));
        }
Exemplo n.º 12
0
        private void HandleException(IHttpContext context, Exception ex)
        {
            IResponse response = context.Response;
            IRequest  request  = context.Request;

            if (response.OutputStream != null)
            {
                using (StreamWriter sw = new StreamWriter(response.OutputStream))
                {
                    string description = "({0})"._Format(ex.Message);
                    response.StatusCode        = (int)HttpStatusCode.InternalServerError;
                    response.StatusDescription = description;
                    sw.Write(@"<!DOCTYPE html>
<html>
<body>
<h1>Internal Server Exception</h1>
<p>" + description + "</p></body></html>");
                    sw.Flush();
                }
            }
            MainLogger.AddEntry("An error occurred handling the request: ({0})\r\n*** Request Details {1}***\r\n{2}\r\n\r\n{3}",
                                ex,
                                request.GetClientIp(),
                                ex.Message,
                                request.TryPropertiesToString(),
                                ex.GetMessageAndStackTrace());
        }
Exemplo n.º 13
0
        public async Task <bool> SaveAsync(IProgressEx Progress)
        {
            if ((await ComponentSet.SaveAsync(Progress)) == false)
            {
                return(false);
            }

            if ((await ViewSet.SaveAsync(Progress)) == false)
            {
                return(false);
            }

            try
            {
                XDocument xDoc = new XDocument();

                xDoc.Add(this.Xml);

                xDoc.Save(_projectFilePath);

                _hasChanges = false;
            }
            catch (Exception ex)
            {
                MainLogger.Log(ex);
                return(false);
            }

            return(true);
        }
Exemplo n.º 14
0
        private void HandleResponderNotFound(IHttpContext context)
        {
            IResponse response = context.Response;
            IRequest  request  = context.Request;

            string path          = request.Url.ToString();
            string messageFormat = "No responder was found for the path: {0}";
            string description   = "Responder not found";

            using (StreamWriter sw = new StreamWriter(response.OutputStream))
            {
                response.StatusCode        = (int)HttpStatusCode.NotFound;
                response.StatusDescription = description;
                sw.Write(@"<!DOCTYPE html>
<html>
<body>
<h1>" + description + @"</h1>
<p>" + string.Format(messageFormat, path) + @"</p>
</body>
</html>");
                sw.Flush();
                sw.Close();
            }
            string logMessageFormat = "[ClientIp: {0}] No responder found for the path: {1}";

            MainLogger.AddEntry(logMessageFormat, LogEventType.Warning, request.GetClientIp(), path);
        }
Exemplo n.º 15
0
        public Initializer()
        {
            new FileChecker();

            var di = DiContainer.Container;

            _logger = di.Locate <MainLogger>();
            var saver = di.Locate <MainSaver>();

            Settings = di.Locate <Settings>();

            Settings.Load();

            if (Settings.Get <bool>(_names.Console))
            {
                _logger.AddLogger(new ConsoleLogger(Settings));
            }
            else
            {
                _logger.AddLogger(new EmptyLogger());
            }

            _logger.AddLogger(new FileLogger(saver, Settings));
#if !DEBUG
            _logger.AddLogger(new SentryLogger());
#endif
            _logger.Log("Created DI container", LogLevel.Basic);
        }
Exemplo n.º 16
0
 public Engine()
 {
     this.reader          = new Reader();
     this.logConsole      = new LogConsole();
     this.MainLogger      = new MainLogger();
     this.appenderFactory = new AppenderFactory();
     this.logFactory      = new LogFactory();
 }
Exemplo n.º 17
0
 private void EnsureDefaults()
 {
     if (this.MaxThreads <= 0)
     {
         this.MaxThreads = 50;
         MainLogger.AddEntry("Set MaxThreads to default value {0}", this.MaxThreads);
     }
 }
Exemplo n.º 18
0
        public void Load(string FilePath, IProgressEx Progress = null)
        {
            _hasChanges = false;

            _projectFilePath = FilePath;

            ProjectBasePath = Path.GetDirectoryName(_projectFilePath);

            MainLogger.Log(String.Format("Loading Project File '{0}'...", Path.GetFileName(_projectFilePath)), 0,
                           LogMessageType.Information, LogReceiver.Console | LogReceiver.StatusBar);

            XDocument xDoc = XDocument.Load(FilePath);

            // Deserializing the project from XML document
            this.Xml = xDoc.Element("Project");

            // Base directory where the components are stored
            ComponentSet.BaseDir = Path.Combine(ApplicationBasePath, _COMPONENTS_DIR);

            // Optional project directory where the components are stored
            ComponentSet.ProjectDir = Path.Combine(ProjectBasePath, _COMPONENTS_DIR);

            ComponentSet.VerboseLoad = IsVerboseLoad();

            // Loading components
            ComponentSet.Load(Progress);

            CheckComponents();

            // If views are defined, load them
            if (ViewSet != null)
            {
                ViewSet.VerboseLoad    = ComponentSet.VerboseLoad;
                ViewSet.Components     = ComponentSet;
                ViewSet.BaseDir        = Path.Combine(ApplicationBasePath, _VIEWS_DIR);
                ViewSet.ProjectBaseDir = Path.Combine(ProjectBasePath, _VIEWS_DIR);
                ViewSet.Load(Progress);
            }

            if (ComponentSet.HasExceptions || ViewSet.HasExceptions)
            {
                MainLogger.Log(string.Format("Project '{0}' has loaded with problems!", Properties["Title"]), 0,
                               LogMessageType.Exclamation, LogReceiver.Console | LogReceiver.StatusBar | LogReceiver.MessageBox);
            }
            else
            {
                MainLogger.Log(string.Format("Project '{0}' loaded successfully!", Properties["Title"]), 0,
                               LogMessageType.Success, LogReceiver.Console | LogReceiver.StatusBar);
            }

            _target = (ITarget)ComponentSet["Target"].Plugin;

            _loaded = true;
        }
Exemplo n.º 19
0
        public ITemplateManager GetAppTemplateRenderer(string appName)
        {
            Dictionary <string, AppContentResponder> container = ContentResponder.AppContentResponders;

            if (container.ContainsKey(appName))
            {
                return(container[appName].AppTemplateManager);
            }
            else
            {
                MainLogger.AddEntry("Unable to retrieve AppDustRenderer for the specified app name: {0}", LogEventType.Warning, appName);
                return(null);
            }
        }
Exemplo n.º 20
0
 /// <summary>
 /// Initialize server level schemas
 /// </summary>
 protected virtual void InitializeCommonSchemas()
 {
     OnSchemasInitializing();
     SchemaInitializers.Each(schemaInitializer =>
     {
         OnSchemaInitializing(schemaInitializer);
         if (!schemaInitializer.Initialize(MainLogger, out Exception ex))
         {
             MainLogger.AddEntry("An error occurred initializing schema ({0}): {1}", ex, schemaInitializer.SchemaName, ex.Message);
         }
         OnSchemaInitialized(schemaInitializer);
     });
     OnSchemasInitialized();
 }
Exemplo n.º 21
0
 protected virtual void InitializeUserManagers()
 {
     ContentResponder.AppConfigs.Each(appConfig =>
     {
         try
         {
             UserManager mgr             = appConfig.GetUserManager();
             mgr.ApplicationNameProvider = new BamApplicationNameProvider(appConfig);
             AddAppService(appConfig.Name, mgr);
         }
         catch (Exception ex)
         {
             MainLogger.AddEntry("An error occurred initializing user manager for app ({0}): {1}", ex, appConfig.Name, ex.Message);
         }
     });
 }
Exemplo n.º 22
0
        private ResultObject Save(T entity)
        {
            ResultObject toReturn = new ResultObject();
            //we create if does not exist
            var entityIdInt = _identifierMap.Save(entity.EntityId);
            var idInt       = _identifierMap.Save(entity.Id);

            using (var conn = new SqlConnection(_db.ConnectionString))
                using (var command = new SqlCommand(string.Format(insertSql, _tableName.Value), conn))
                {
                    try
                    {
                        conn.Open();
                        //check if our table tables, create if it doesn't
                        command.CommandText = string.Format(insertSql, _tableName.Value);
                        command.Parameters.AddWithValue("@id", entity.Id);
                        command.Parameters.AddWithValue("@entityid", entity.EntityId);

                        command.Parameters.AddWithValue("@editdate", entity.EditDate);
                        command.Parameters.AddWithValue("@editday", entity.EditDay);

                        command.Parameters.AddWithValue("@datablob", entity.DataBlob);

                        command.Parameters.AddWithValue("@kindmetadata", entity.KindMetaData);
                        //command.Parameters.AddWithValue("@datablob", entity.Id);

                        var res = Convert.ToInt32(command.ExecuteScalar());
                        toReturn = new ResultObject()
                        {
                            recordId = res, saveStatus = res > 0
                        };
                    }
                    catch (SqlException ex)
                    {
                        if (MainLogger != null)
                        {
                            MainLogger.Log(string.Format(
                                               "Error opening database connection{0}{1}", Environment.NewLine, ex.ToString()));
                        }
                        return(null);
                    }

                    conn.Close();
                }
            return(toReturn);
        }
Exemplo n.º 23
0
        public void SetConf(BamConf conf)
        {
            OnSettingConf(conf);

            this.MainLogger = Log.Default = conf.GetMainLogger(out Type loggerType);
            this.MainLogger.RestartLoggingThread();
            if (!loggerType.Name.Equals(conf.MainLoggerName))
            {
                MainLogger.AddEntry("Configured MainLogger was ({0}) but the Logger found was ({1})", LogEventType.Warning, conf.MainLoggerName, loggerType.Name);
            }
            this.TryAddAdditionalLoggers(conf);
            conf.Server = this;

            DefaultConfiguration.CopyProperties(conf, this);
            SetWorkspace();

            OnSettedConf(conf);
        }
        public void Setup()
        {
            var servicesAdmin = ServiceManager.Create();
            var services      = servicesAdmin.Manager;

            IService service;
            var      loggerService = new MainLogger(out service);

            services.Register(service);
            var queueService = new HostApplicationActionQueue(out service);

            services.Register(service);

            TaskContextDummy taskContext = new TaskContextDummy();

            servicesAdmin.StartServices(taskContext);

            queue = services.Get <IHostApplicationActionQueue>();
        }
Exemplo n.º 25
0
        internal static ServiceManager.IServiceManagerAdministration CreateFileParsingSetup(Assembly testAssembly, params ScriptFile[] files)
        {
            ServiceManager.IServiceManagerAdministration services = ServiceManager.Create();
            LastServiceManager = services;

            IService service;
            var      addonManager = new AddonManager(null, out service);

            services.Manager.Register(service);
            var objectManager = new DynamicObjectManager(out service);

            services.Manager.Register(service);
            var loadedFiles = new LoadedFilesManager(out service);

            services.Manager.Register(service);
            var mainLogger = new MainLogger(out service);

            services.Manager.Register(service);
            var taskManager = new TaskManager(out service);

            services.Manager.Register(service);

            TaskContextDummy taskContext = new TaskContextDummy();

            services.StartServices(taskContext);

            addonManager.AddAssembly(typeof(System.Convert).Assembly, false);
            addonManager.AddAssembly(typeof(Math).Assembly, false);
            addonManager.AddAssembly(typeof(Enumerable).Assembly, false);
            addonManager.AddAssembly(AddonManager.StepBroCoreAssembly, true);

            if (testAssembly != null)
            {
                addonManager.AddAssembly(testAssembly, false);
            }

            foreach (var f in files)
            {
                loadedFiles.RegisterLoadedFile(f);
            }

            return(services);
        }
        public void SendFirstLaunchNotifications(FrameworkValues frameworkValues)
        {
            try
            {
                MainLogger.Log(typeof(LocalNotificationManager).Name, "[LOCAL NOTIFICATIONS]: Sending first launch notifications.", LogLevel.FrameworkInfo);

                var channel = new AndroidNotificationChannel()
                {
                    Id              = ChannelId,
                    Name            = "Default Channel",
                    Importance      = Importance.High,
                    Description     = "Generic notifications",
                    EnableLights    = true,
                    EnableVibration = true,
                };
                AndroidNotificationCenter.RegisterNotificationChannel(channel);

                AndroidNotification notification;
                foreach (var data in frameworkValues.NotificationsData)
                {
                    notification = new AndroidNotification
                    {
                        Title      = data.title,
                        Text       = data.message,
                        FireTime   = DateTime.Now.AddHours((int)data.type),
                        SmallIcon  = data.smallIconId,
                        LargeIcon  = data.bigIconId,
                        IntentData = data.callback,
                    };

                    if (data.type == LocalNotificationType.NRepeatable96h)
                    {
                        notification.RepeatInterval = TimeSpan.FromHours(24);
                    }

                    AndroidNotificationCenter.SendNotification(notification, ChannelId);
                }
            }
            catch (Exception e)
            {
                MainLogger.Log(typeof(LocalNotificationManager).Name, $"[LOCAL NOTIFICATIONS]: Failed to send first launch notifications: {e}", LogLevel.FrameworkErrorInfo);
            }
        }
Exemplo n.º 27
0
        public void AddLogger(ILogger logger)
        {
            MultiTargetLogger mtl = new MultiTargetLogger();

            if (MainLogger != null)
            {
                if (MainLogger.GetType() == typeof(MultiTargetLogger))
                {
                    mtl = (MultiTargetLogger)MainLogger;
                }
                else
                {
                    mtl.AddLogger(MainLogger);
                }
            }

            mtl.AddLogger(logger);
            MainLogger = mtl;
        }
Exemplo n.º 28
0
        internal static void DeinitializeInternal(bool reset)
        {
            m_loadedFilesManager.UnloadAllFilesWithoutDependants();

            TaskContextDummy taskContext = new TaskContextDummy();

            m_serviceManagerAdmin.StopServices(taskContext, reset);

            if (reset)
            {
                m_serviceManagerAdmin    = null;
                m_mainLogger             = null;
                m_loadedFilesManager     = null;
                m_addonManager           = null;
                m_logSinkManager         = null;
                m_scriptExecutionManager = null;
                m_dynamicObjectManager   = null;
                m_uiCalculator           = null;

                m_serviceManagerAdmin = ServiceManager.Create();
            }
        }
Exemplo n.º 29
0
        internal List <T> GetUnsyncedLocalEntities(KindName cloudTable, KindName localTable)
        {
            var diffSql = string.Format(
                @"
select a.* From {0} a join 
(
	select id, editdate from {0} except select id, editdate from {1}
	)b on a.Id = b.id
", cloudTable.Value, localTable.Value);

            var toReturn = new List <T>();

            using (var conn = new SqlConnection(_db.ConnectionString))
                using (var command = new SqlCommand(string.Format(insertSql, _tableName.Value), conn))
                {
                    try
                    {
                        conn.Open();
                        command.CommandText = diffSql;
                        using (var reader = command.ExecuteReader())
                        {
                            toReturn = getEntities(reader);
                        }
                    }
                    catch (SqlException ex)
                    {
                        if (MainLogger != null)
                        {
                            MainLogger.Log(string.Format(
                                               "Error opening database connection{0}{1}", Environment.NewLine, ex.ToString()));
                        }
                        return(null);
                    }
                    conn.Close();
                }
            return(toReturn);
        }
Exemplo n.º 30
0
        public override bool build(bool dropAndRecreate = false)
        {
            //we create if does not exist
            var saveStatus     = false;
            var createTableSql = string.Format(createKindSql, _tableName.Value, _tableName.Value.Replace("_fvs", ""));

            using (var conn = new SqlConnection(_db.ConnectionString))
                using (var command = new SqlCommand(createTableSql, conn))
                {
                    try
                    {
                        conn.Open();
                        if (dropAndRecreate)
                        {
                            command.CommandText = string.Format(dropKindSql, _tableName.Value);
                            command.ExecuteNonQuery();

                            command.CommandText = createTableSql;
                        }
                        command.ExecuteNonQuery();
                        saveStatus = true;
                    }
                    catch (SqlException ex)
                    {
                        if (MainLogger != null)
                        {
                            MainLogger.Log(string.Format(
                                               "Error opening database connection{0}{1}", Environment.NewLine, ex.ToString()));
                        }
                        return(false);
                    }

                    conn.Close();
                }
            return(saveStatus);
        }