Пример #1
0
        //
        // Initialize()
        //
        // Perform the minimum requirement of logging onto the c-tree Server
        //

        static void Initialize()
        {
            Console.WriteLine("INIT");

            try
            {
                // allocate objects
                MySession = new CTSession(SESSION_TYPE.CTREE_SESSION);
                MyTable   = new CTTable(MySession);
                MyRecord  = new CTRecord(MyTable);
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }

            try
            {
                // connect to server
                Console.WriteLine("\tLogon to server...");
                MySession.Logon("FAIRCOMS", "ADMIN", "ADMIN");
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }
        }
Пример #2
0
        //
        // Delete_Records()
        //
        // This function deletes all the records in the table
        //

        static void Delete_Records(CTRecord record)
        {
            bool found;

            Console.WriteLine("\tDelete records...");

            try
            {
                // enable session-wide lock flag
                MySession.Lock(LOCK_MODE.WRITE_BLOCK_LOCK);

                // read first record
                found = record.First();

                while (found) // while records are found
                {
                    // delete record
                    record.Delete();
                    // read next record
                    found = record.Next();
                }

                // reset session-wide locks
                MySession.Unlock();
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }
        }
Пример #3
0
        //
        // Initialize()
        //
        // Perform the minimum requirement of logging onto the c-tree Server
        //

        static void Initialize()
        {
            Console.WriteLine("INIT");

            try
            {
                // This section is only needed for the AppServer DLL model.
                bool AppServerModel = true;
                if (AppServerModel)
                {
                    // Set c-tree database engine configuration file name.
                    CTSession.SetConfigurationFile("ctsrvr.cfg");
                    // Start c-tree database engine.
                    CTSession.StartDatabaseEngine();
                }


                // allocate objects
                MySession = new CTSession(SESSION_TYPE.CTREE_SESSION);
                MyTable   = new CTTable(MySession);
                MyRecord  = new CTRecord(MyTable);
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }

            try
            {
                // connect to server
                Console.WriteLine("\tLogon to server...");
                MySession.Logon("FAIRCOMS", "ADMIN", "ADMIN");
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }
        }
Пример #4
0
        //
        // Initialize()
        //
        // Perform the minimum requirement of logging onto the c-tree Server
        //

        static void Initialize()
        {
            Console.WriteLine("INIT");

            try
            {
                // allocate the session object
                MySession = new CTSession(SESSION_TYPE.CTREE_SESSION);

                // allocate the table objects
                tableCustOrdr = new CTTable(MySession);
                tableOrdrItem = new CTTable(MySession);
                tableItemMast = new CTTable(MySession);
                tableCustMast = new CTTable(MySession);

                // allocate the record objects
                recordCustOrdr = new CTRecord(tableCustOrdr);
                recordOrdrItem = new CTRecord(tableOrdrItem);
                recordItemMast = new CTRecord(tableItemMast);
                recordCustMast = new CTRecord(tableCustMast);
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }

            try
            {
                // connect to server
                Console.WriteLine("\tLogon to server...");
                MySession.Logon("FAIRCOMS", "ADMIN", "ADMIN");
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }
        }
Пример #5
0
        //
        // Delete_Records()
        //
        // This function deletes all the records in the table
        //

        static void Delete_Records(CTRecord record)
        {
            bool found;

            Console.WriteLine("\tDelete records...");

            try
            {
                // write lock required for transaction updates
                record.Lock(LOCK_MODE.WRITE_LOCK);

                // start a transaction
                record.Begin();

                // read first record
                found = record.First();

                while (found) // while records are found
                {
                    // delete record
                    record.Delete();
                    // read next record
                    found = record.Next();
                }

                // commit transaction
                record.Commit();

                // free locks
                record.Unlock();
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }
        }
Пример #6
0
        //
        // Delete_Records()
        //
        // This function deletes all the records in the table
        //

        static void Delete_Records(CTRecord record)
        {
            bool found;

            Console.WriteLine("\tDelete records...");

            try
            {
                // read first record
                found = record.First();

                while (found) // while records are found
                {
                    // delete record
                    record.Delete();
                    // read next record
                    found = record.Next();
                }
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }
        }