Exemplo n.º 1
0
 public static void SubmitCart(List <Person> people)
 {
     if (people.Count == 0)
     {
         Console.WriteLine("There are no customers.");
     }
     else
     {
         Console.Write("Enter Customer ID#: ");
         string inputID = Console.ReadLine();
         foreach (PreferredCustomer person in people)
         {
             if (person.CustNum == inputID)
             {
                 Console.Write("Enter purchase amount: $");
                 if (!decimal.TryParse(Console.ReadLine(), out decimal amount))
                 {
                     InvalidInput();
                 }
                 person.Purchases += amount;
                 PreferredCustomer.GetDiscount(person);
             }
             else
             {
                 Console.WriteLine($"Customer with ID# '{inputID}' could not be found.");
             }
         }
     }
 }
Exemplo n.º 2
0
        public static void EnterInfo(List <Person> people)
        {
            PreferredCustomer fNG = new PreferredCustomer(Person.GetName(),
                                                          Person.GetAddr(),
                                                          Person.GetPhone(),
                                                          Customer.GetNum(),
                                                          Customer.GetMail(),
                                                          PreferredCustomer.GetPurchases(),
                                                          0);

            people.Add(fNG);
        }
Exemplo n.º 3
0
 public static void GetDiscount(PreferredCustomer person) // TODO discount level isn't being updated
 {
     if (person.Purchases >= 2000m)
     {
         person.DiscountLevel = 10;
     }
     else if (person.Purchases >= 1500m)
     {
         person.DiscountLevel = 7;
     }
     else if (person.Purchases >= 1000m)
     {
         person.DiscountLevel = 6;
     }
     else if (person.Purchases >= 500m)
     {
         person.DiscountLevel = 5;
     }
 }