Example #1
0
        public static void Begin()
        {
            List <Application>       applications       = ApplicationDAO.Get();
            List <Communication>     communications     = CommunicationDAO.Get();
            List <CommunicationType> communicationTypes = CommunicationTypeDAO.Get();
            List <DirectionType>     directionTypes     = DirectionTypeDAO.Get();

            foreach (Application app in applications)
            {
                // for each application, initalize inbound interface connections
            }
        }
        public static void Begin(DirectionType directionType)
        {
            int beforeCount = 0;
            int afterCount  = 0;

            // DirectionType API
            List <DirectionType> directionTypes;

            // Get existing
            beforeCount = DirectionTypeDAO.Get().Count;

            // Insert and Updating: if ID is included, it will update
            directionType = DirectionTypeDAO.PostUpdate(directionType);

            // Reading: Use GetDirectionTypes() to retrieve a list of obj
            directionTypes = DirectionTypeDAO.Get();

            // get master item count
            afterCount = directionTypes.Count;

            // write
            DirectionTypeTest.Write(directionTypes, "INSERT", beforeCount, afterCount, true);
            Console.Read();

            // make a soft update to some property (Optional)
            // directionType.<property> = 1;

            // re-assign the before count
            beforeCount = afterCount;

            // Insert and Updating: if ID is included, it will update
            directionType = DirectionTypeDAO.PostUpdate(directionType);

            // Reading: Use GetDirectionTypes() to retrieve a list of obj
            directionTypes = DirectionTypeDAO.Get();

            // Get existing
            afterCount = DirectionTypeDAO.Get().Count;

            // write
            DirectionTypeTest.Write(directionTypes, "UPDATE", beforeCount, afterCount);
            Console.Read();

            // Reading: Use GetDirectionTypes() to retrieve a list of obj w/ 1 item
            directionTypes = DirectionTypeDAO.Get(directionType);

            // get count
            afterCount = directionTypes.Count;

            // reassign count
            beforeCount = afterCount;

            // write
            DirectionTypeTest.Write(directionTypes, "Single", afterCount, 1);
            Console.Read();

            // Deleting - Send in the obj w/ at minimal the ID populated
            DirectionTypeDAO.Delete(directionType);

            // Reading: Use GetDirectionTypes() to retrieve a list of obj
            directionTypes = DirectionTypeDAO.Get();

            // get count
            afterCount = directionTypes.Count;

            // write
            DirectionTypeTest.Write(directionTypes, "Removed", beforeCount, afterCount, true);
            Console.Read();
        }