コード例 #1
0
ファイル: CSVHandler.cs プロジェクト: MendesP/HolidayBooking
        private string csvExtrasPath   = @"H:\Software development 2\CourseWork2\HollydayBooking\extras.csv";   //holds the path to the extras.csv file


        // Method always returns the same instance of the class (no more than one instance can be created)
        public static CSVHandler Instance()
        {
            //Create new instance if one does not exist, otherwise return the existing instance
            if (instance == null)
            {
                instance = new CSVHandler();
            }
            return(instance);
        }
コード例 #2
0
        private int refNumber;                       //holds the current bookingRefNumber


        //Method always return the same instance of the class
        public static BookingRefGenerator Instance()
        {
            //Create new instance if it hasnt been created previously (if it is null)
            if (instance == null)
            {
                instance = new BookingRefGenerator();                      //Create new instance
                CSVHandler CSVFile = CSVHandler.Instance();                //Get a reference to the CSVFacade
                instance.refNumber = CSVFile.GetCurrentBookingRefNumber(); //Get last reference number given to a booking from the records in the CSV and assign the value to the reference number of this class
            }
            return(instance);                                              //Return the instance of the class (always the same one)
        }