Beispiel #1
0
        private void _Billing()
        {
            FileIO                  membersDb        = new FileIO();
            SingleClubMember        singleClubMember = new SingleClubMember();
            List <SingleClubMember> scMembers        = new List <SingleClubMember>();

            for (int i = 0; i < membersDb.SingleMemberDbPull().Count; i++)
            {
                singleClubMember = membersDb.SingleMemberDbPull()[i];

                if (DateTime.Now.Day == singleClubMember.LastTimeBilled.Day && DateTime.Now.Date != singleClubMember.LastTimeBilled.Date && singleClubMember.Status == true)
                {
                    if (singleClubMember.Employee)
                    {
                        singleClubMember.Bill += 9;
                    }
                    else
                    {
                        singleClubMember.Bill += 10;
                    }

                    singleClubMember.LastTimeBilled = DateTime.Now;
                }

                scMembers.Add(singleClubMember);
            }

            membersDb.SingleMembersDbPush(scMembers);
        }
Beispiel #2
0
        public SingleClubMember FindMember(int id)
        {
            FileIO           membersDB = new FileIO();
            SingleClubMember member    = new SingleClubMember();

            if (_DrawFromFile(id))
            {
                member = membersDB.SingleMemberDbPull().Find(m => m.ID == id);
            }
            else
            {
                Utility.PrintYellow($"The ID {id} is not in the database. Press any key to return to the main menu.");
                Console.ReadKey();
            }
            return(member);
        }
Beispiel #3
0
        public List <SingleClubMember> SingleMemberDbPull()
        {
            List <SingleClubMember> members = new List <SingleClubMember>();

            StreamReader reader = new StreamReader("../../../SingleMembersDb.txt");

            string memberline = reader.ReadLine();

            while (memberline != null)
            {
                string[]         membersplit = memberline.Split('|');
                SingleClubMember memb        = new SingleClubMember(int.Parse(membersplit[0]), membersplit[1], DateTime.Parse(membersplit[2]),
                                                                    (membersplit[3]), bool.Parse(membersplit[4]), double.Parse(membersplit[5]), bool.Parse(membersplit[6]), DateTime.Parse(membersplit[7]));
                members.Add(memb);
                memberline = reader.ReadLine();
            }
            reader.Close();

            return(members);
        }
Beispiel #4
0
        public static bool DisplayMainMenu(Club club)
        {
            string inputMembership = "";
            bool   output          = false;

            Console.Clear();
            SingleClubMember s = new SingleClubMember();
            MultiClubMember  m = new MultiClubMember();

            Utility.PrintGreen($"{club.ClubName}: Operations");

            for (int i = 0; i < mainMenu.Count; i++)
            {
                Utility.PrintCyan($"{i + 1}. {mainMenu[i]} ");
            }
            Console.WriteLine("");
            int input = Validate.NumberRange($"Please select an option from (please input 1 - {mainMenu.Count}).\nPress 0 to clear console or crash Mac computers; Both are good services.", mainMenu.Count);

            //member check-in
            if (input == 1)
            {
                int idNum = Validate.Integer("Please input your member's ID number:");
                if (idNum < 600)
                {
                    s = s.FindMember(idNum);
                    if (s.ID == 0)
                    {
                    }
                    else
                    {
                        s.CheckIn(club);
                    }
                }
                else if (idNum >= 600)
                {
                    m = m.FindMember(idNum);
                    if (m.ID == 0)
                    {
                    }
                    else
                    {
                        m.CheckIn(club);
                    }
                }
            }
            else if (input == 2)
            {
                //add member

                inputMembership = Utility.GetKeyInput("Would you like to sign up for a Single club membership (s) or a Multi-club membership (m)?");;
                Console.Clear();
                if (inputMembership == "s")
                {
                    SingleClubMember newMemb = new SingleClubMember();
                    newMemb.Name           = Utility.GetInput("What is the new member's name?");
                    newMemb.Enroll         = DateTime.Now;
                    newMemb.LastTimeBilled = DateTime.Now;
                    newMemb.AssignID();
                    newMemb.Status = true;
                    newMemb.Bill   = 10;

                    Console.Clear();
                    newMemb.DisplayInfo();

                    if (Validate.YesNo("Does the above info look correct? (input Y/N)"))
                    {
                        newMemb.DBAdd();
                        Utility.PrintGreen($"{newMemb.Name} added to the database!");
                        Console.ReadKey();
                    }
                }
                else if (inputMembership == "m")
                {
                    MultiClubMember newMemb = new MultiClubMember();
                    newMemb.Name           = Utility.GetInput("What is the new member's name?");
                    newMemb.Enroll         = DateTime.Now;
                    newMemb.LastTimeBilled = DateTime.Now;
                    newMemb.AssignID();

                    newMemb.Status = true;
                    newMemb.Bill   = 25;

                    Console.Clear();
                    newMemb.DisplayInfo();

                    if (Validate.YesNo("Does the above info look correct? Input (Y/N)"))
                    {
                        newMemb.DBAdd();
                    }
                }
            }
            else if (input == 3)
            //display user
            {
                int idNum = Validate.Integer("Please input your member's ID number:");
                if (idNum < 600)
                {
                    s = s.FindMember(idNum);
                    if (s.ID == 0)
                    {
                    }
                    else
                    {
                        Console.Clear();
                        s.DisplayInfo();
                        Utility.PrintGreen("Press any key to return to the main menu.");
                        Console.ReadKey();
                    }
                }
                else if (idNum >= 600)
                {
                    m = m.FindMember(idNum);
                    if (m.ID == 0)
                    {
                    }
                    else
                    {
                        Console.Clear();
                        m.DisplayInfo();
                        Utility.PrintGreen("Press any key to return to the main menu.");
                        Console.ReadKey();
                    }
                }
            }
            else if (input == 4)
            {
                //remove member (leaves member info in so they can be spammed with "please come back" messages)
                int idNum = Validate.Integer("Please input your member's ID number: ");
                if (idNum < 600)
                {
                    s = s.FindMember(idNum);
                    if (s.ID == 0)
                    {
                    }
                    else
                    {
                        if (Validate.YesNo($"Are you sure you wish to delete {s.Name}? Input (Y/N)."))
                        {
                            s.DBRemove();
                        }
                    }
                }
                else if (idNum >= 600)
                {
                    m = m.FindMember(idNum);
                    if (m.ID == 0)
                    {
                    }
                    else
                    {
                        if (Validate.YesNo($"Are you sure you wish to delete {m.Name}? Input (Y/N)."))
                        {
                            m.DBRemove();
                        }
                    }
                }
            }
            else if (input == 5)
            //displays current bill and points, if someone is already checed in but maybe wants to trade points for a sports drink
            {
                int idNum = Validate.Integer("Please input your member's ID number: ");
                if (idNum < 600)
                {
                    s = s.FindMember(idNum);
                    if (s.ID == 0)
                    {
                    }
                    else
                    {
                        Console.Clear();
                        s.DisplayFees();
                        Console.ReadKey();
                    }
                }
                else if (idNum >= 600)
                {
                    m = m.FindMember(idNum);
                    if (m.ID == 0)
                    {
                    }
                    else
                    {
                        Console.Clear();
                        m.DisplayFees();
                        Console.ReadKey();
                    }
                }
            }
            else if (input == 6)
            //quittin' time
            {
                output = Validate.YesNo("Are you sure you want to quit? Input (Y/N)");
            }
            else
            {
                Console.Beep(1000, 150); Console.Beep(500, 150); Console.Beep(200, 150); Console.Beep(500, 150); Console.Beep(1000, 150);
            }
            return(output);
        }
Beispiel #5
0
        public static void Startup()
        {
            SingleClubMember singleClubMember = new SingleClubMember();

            singleClubMember._Billing();
        }
Beispiel #6
0
 public static void StartUp()
 {
     MultiClubMember.StartUp();
     SingleClubMember.Startup();
 }