public void GetAddress()
        {
            String address;

            address = SpeciesObservationServer.GetAddress();
            Assert.IsTrue(address.IsNotEmpty());
        }
Пример #2
0
 public void CommitTransactionNoTransactionError()
 {
     using (DataServer database = new SpeciesObservationServer())
     {
         database.CommitTransaction();
     }
 }
 public void Constructor()
 {
     using (SpeciesObservationServer database = new SpeciesObservationServer())
     {
         Assert.IsNotNull(database);
     }
 }
Пример #4
0
 public void BeginTransaction()
 {
     using (DataServer database = new SpeciesObservationServer())
     {
         database.BeginTransaction();
     }
 }
Пример #5
0
 public void RollbackTransactionNoTransactionError()
 {
     using (DataServer database = new SpeciesObservationServer())
     {
         database.RollbackTransaction();
     }
 }
Пример #6
0
 public void BeginTransactionAlreadyStartedError()
 {
     using (DataServer database = new SpeciesObservationServer())
     {
         database.BeginTransaction();
         database.BeginTransaction();
     }
 }
Пример #7
0
 public void HasPendingTransaction()
 {
     using (DataServer database = new SpeciesObservationServer())
     {
         Assert.IsFalse(database.HasPendingTransaction());
         database.BeginTransaction();
         Assert.IsTrue(database.HasPendingTransaction());
     }
 }
Пример #8
0
        public void Dispose()
        {
            using (DataServer database = new SpeciesObservationServer())
            {
                database.Dispose();

                // Should be ok to dispose an already disposed database.
                database.Dispose();
            }
        }
Пример #9
0
        /// <summary>
        /// Get status for database.
        /// </summary>
        private void GetDatabaseStatus(Dictionary <Int32, List <WebResourceStatus> > status)
        {
            Boolean           ping;
            String            address, informationEnglish, informationSwedish;
            WebResourceStatus resourceStatus;

            address = null;

            try
            {
                address            = SpeciesObservationServer.GetAddress();
                informationEnglish = null;
                informationSwedish = null;
                using (SpeciesObservationServer database = new SpeciesObservationServer())
                {
                    ping = database.Ping();
                }
                if (!ping)
                {
                    informationEnglish = WebService.Settings.Default.DatabaseStatusErrorEnglish;
                    informationSwedish = WebService.Settings.Default.DatabaseStatusErrorSwedish;
                }
            }
            catch (Exception exception)
            {
                ping = false;
                informationEnglish = WebService.Settings.Default.DatabaseCommunicationFailureEnglish + " " +
                                     WebService.Settings.Default.ErrorMessageEnglish + " = " + exception.Message;
                informationSwedish = WebService.Settings.Default.DatabaseCommunicationFailureSwedish + " " +
                                     WebService.Settings.Default.ErrorMessageSwedish + " = " + exception.Message;
            }
            resourceStatus              = new WebResourceStatus();
            resourceStatus.AccessType   = WebService.Settings.Default.ResourceAccessTypeReadSwedish;
            resourceStatus.Address      = address;
            resourceStatus.Information  = informationSwedish;
            resourceStatus.Name         = DatabaseName.SwedishSpeciesObservation.ToString();
            resourceStatus.ResourceType = WebServiceBase.GetResourceType(ResourceTypeIdentifier.Database,
                                                                         (Int32)(LocaleId.sv_SE));
            resourceStatus.Status = ping;
            resourceStatus.Time   = DateTime.Now;
            status[(Int32)(LocaleId.sv_SE)].Add(resourceStatus);

            resourceStatus              = new WebResourceStatus();
            resourceStatus.AccessType   = WebService.Settings.Default.ResourceAccessTypeReadEnglish;
            resourceStatus.Address      = address;
            resourceStatus.Information  = informationEnglish;
            resourceStatus.Name         = DatabaseName.SwedishSpeciesObservation.ToString();
            resourceStatus.ResourceType = WebServiceBase.GetResourceType(ResourceTypeIdentifier.Database,
                                                                         (Int32)(LocaleId.en_GB));
            resourceStatus.Status = ping;
            resourceStatus.Time   = DateTime.Now;
            status[(Int32)(LocaleId.en_GB)].Add(resourceStatus);
        }
        private SpeciesObservationServer GetDatabase(Boolean refresh = false)
        {
            if (_database.IsNull() || refresh)
            {
                if (_database.IsNotNull())
                {
                    _database.Dispose();
                }

                _database = new SpeciesObservationServer();
            }

            return(_database);
        }
        public void LoadData()
        {
            TaxonInformation taxonInformation;

            using (SpeciesObservationServer database = new SpeciesObservationServer())
            {
                using (DataReader dataReader = database.GetTaxonInformation())
                {
                    Assert.IsTrue(dataReader.Read());
                    taxonInformation = new TaxonInformation();
                    taxonInformation.LoadData(dataReader);
                    Assert.IsNotNull(taxonInformation);
                }
            }
        }
        public void LoadData()
        {
            WebSpeciesActivityCategory speciesActivityCategory;

            using (SpeciesObservationServer database = new SpeciesObservationServer())
            {
                using (DataReader dataReader = database.GetSpeciesActivityCategories((Int32)(LocaleId.sv_SE)))
                {
                    while (dataReader.Read())
                    {
                        speciesActivityCategory = new WebSpeciesActivityCategory();
                        speciesActivityCategory.LoadData(dataReader);
                        Assert.IsNotNull(speciesActivityCategory);
                        Assert.IsTrue(speciesActivityCategory.Guid.IsNotEmpty());
                        Assert.IsTrue(0 <= speciesActivityCategory.Id);
                        Assert.IsTrue(speciesActivityCategory.Identifier.IsNotEmpty());
                        Assert.IsTrue(speciesActivityCategory.Name.IsNotEmpty());
                    }
                }
            }
        }