Exemple #1
0
        //writes TrialMember to csv
        public void writeMemberToCSV(TrialMember member)
        {
            var csv = new StringBuilder();

            var newLine = string.Format("{0},{1},{2},{3},{4},{5},{6},{7}", member.FirstName, member.LastName, member.Birthday, member.LastInTime, member.LastOutTime, member.LastDate, member.NumberOfCheckInTimes, member.TrialEndDate);

            csv.AppendLine(newLine);

            string path = @"C:\Users\Tristan\Desktop\MATC\S2\Advanced Object Oriented Programing\Assignments\AOOP-Assginment1\AOOP-Assignment1\AOOP-Assignment1\members.csv";

            File.AppendAllText(path, csv.ToString());
        }
Exemple #2
0
        static private TrialMember inputMember()
        {
            Console.WriteLine("Please enter: member first name in lowercase");
            string firstName = Console.ReadLine();

            Console.WriteLine("Please enter: member last name in lowercase");
            string lastName = Console.ReadLine();

            Console.WriteLine("Please enter: member birthdate ex: 01/01/1999");
            string birthDate = Console.ReadLine();

            Console.WriteLine("If trial member enter trial end date ex: 01/01/1999 if not trial member hit enter");
            string trialDate = Console.ReadLine();
            var    member    = new TrialMember(firstName, lastName, birthDate, "", "", "", trialDate);

            return(member);
        }
Exemple #3
0
        //reads the csv and adds the members and trial members to their respective lists
        private void ReadCSV()
        {
            string path  = @"C:\Users\Tristan\Desktop\MATC\S2\Advanced Object Oriented Programing\Assignments\AOOP-Assginment1\AOOP-Assignment1\AOOP-Assignment1\members.csv";
            var    lines = File.ReadLines(path);

            members      = new List <Member>();
            trialMembers = new List <TrialMember>();
            foreach (string line in lines)
            {
                string[] input = line.Split(',');
                if (input.Length > 7)
                {
                    var trialMember = new TrialMember(input[0], input[1], input[2], input[3], input[4], input[5], input[6]);
                    trialMembers.Add(trialMember);
                }
                else if (input.Length == 7)
                {
                    var member = new Member(input[0], input[1], input[2], input[3], input[4], input[5]);
                    members.Add(member);
                }
            }
        }