Esempio n. 1
0
        static void Main(string[] args)
        {
            var dataloader = new ABB.Vtrin.cDataLoader();

            try
            {
                // Try to connect to the database
                ConnectOrThrow(
                    dataloader: dataloader,
                    data_source: DATA_SOURCE,
                    db_username: DB_USERNAME,
                    db_password: DB_PASSWORD);

                System.Console.WriteLine("Connection successful!");
            }

            // Case: Something went wrong
            // > Log the error
            catch (System.Exception e)
            {
                System.Console.WriteLine(e.ToString());
            }

            finally
            {
                // Dispose dataloader if necessary
                if (dataloader != null)
                {
                    dataloader.Dispose();
                }
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var dataloader = new ABB.Vtrin.cDataLoader();

            try
            {
                // Try to connect to the database
                ConnectOrThrow(
                    dataloader: dataloader,
                    rtdbHost: RTDBHost,
                    rtdbUsername: RTDBUsername,
                    rtdbPassword: RTDBPassword);

                // Create or update equipment type and properties
                CreateOrUpdateEquipmentTypes();

                // Create or update equipment instances
                CreateOrUpdateEquipmentInstances();
            }

            // Case: Something went wrong
            // > Log the error
            catch (System.Exception e)
            {
                System.Console.WriteLine(e.ToString());
            }

            finally
            {
                // Dispose dataloader if necessary
                if (dataloader != null)
                {
                    dataloader.Dispose();
                }
            }
        }