예제 #1
0
 private void resetDBObject()
 {
     if (_db != null)
     {
         _db.SaveChanges();
         _db.Database.Connection.Close();
         var file = Properties.Settings.Default.FileLocation;
         _db = null;
         _db = new NurseryAssignerEntities(file);
     }
 }
예제 #2
0
        private bool setDBConnectionAndLoad()
        {
            var file = Properties.Settings.Default.FileLocation;

            if (string.IsNullOrWhiteSpace(file))
            {
                if (!openDatabaseFile())
                {
                    return(false);
                }
            }
            if (_db != null)
            {
                _db.Database.Connection.Close();
            }

            _db       = new NurseryAssignerEntities(file);
            this.Text = "Nursery Assigner - " + System.IO.Path.GetFileName(file);

            loadByRange();
            return(true);
        }