예제 #1
0
        public bool AddGoldMember(string incustomerName, bool ingoldMember, string intelNo, string inaddress, DateTime inrenewalDate) //Add a new GoldMember and save it to the CustomerDictionary JAM
        {
            string     customerID    = CustomerDictionary.Count.ToString();
            GoldMember newGoldMember = new GoldMember(customerID, incustomerName, ingoldMember, intelNo, inaddress, inrenewalDate);

            CustomerDictionary.Add(customerID, newGoldMember);
            return(true);
        }
예제 #2
0
        public static GoldMember LoadGoldMember(System.IO.TextReader textIn)         //Load method for Goldmember customer class using TextReader  GB
        {
            GoldMember result = null;

            try
            {
                string   customerID   = textIn.ReadLine();
                string   customerName = textIn.ReadLine();
                bool     goldMember   = Convert.ToBoolean(textIn.ReadLine()); //variable 'GoldMember' is converted from a string to a Bool GB
                string   telNo        = textIn.ReadLine();
                string   Address      = textIn.ReadLine();
                DateTime RenewalDate  = Convert.ToDateTime(textIn.ReadLine());
                result = new GoldMember(customerID, customerName, goldMember, telNo, Address, RenewalDate);
            }
            catch
            {
                return(null);
            }
            return(result);                                                   //The loaded Goldcustomer is returned in 'result' GB
        }
예제 #3
0
        public static GoldMember LoadGoldMember(string filename)             //The above method is called via this Load method
        {                                                                    //Which uses SteamReader to read fro a .txt file GB
            GoldMember result = null;

            System.IO.TextReader textIn = null;
            try
            {
                textIn = new System.IO.StreamReader(filename);
                result = GoldMember.LoadGoldMember(textIn);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (textIn != null)
                {
                    textIn.Close();
                }
            }
            return(result);
        }