Example #1
0
        /// <summary>
        /// Method loads buyer records from the storage media, if present, in the buyer dictionary.
        /// <see cref="RecordManager{S, T}"/>
        /// <seealso cref="RecordManager{S, T}.readAllRecords"/>
        /// </summary>
        private void loadRecords()
        {
            RecordManager <string, Buyer> manager = new RecordManager <string, Buyer>();
            List <string> records = manager.readAllRecords();

            buyerDictionary.Clear();
            foreach (string record in records)
            {
                Buyer entity = new Buyer();
                entity.populateBuyer(record);
                buyerDictionary.Add(entity.getFullName(), entity);
            }
        }
Example #2
0
        /// <summary>
        /// Method saves the records present in the buyer dictionary on the storage media.
        /// <see cref="RecordManager{S, T}"/>
        /// <seealso cref="RecordManager{S, T}.writeRecords(Dictionary{S, T})"/>
        /// </summary>
        private void saveRecords()
        {
            RecordManager <string, Buyer> manager = new RecordManager <string, Buyer>();

            manager.writeRecords(buyerDictionary);
        }