Esempio n. 1
0
        /******** Menu Methods ******************************
        ****************************************************/

        private void CreateCustomer()
        {
            Customer newCustomer = new Customer
            {
                FirstName = FirstName(),
                LastName  = LastName(),
                Type      = Type()
            };

            newCustomer.Email = Email(newCustomer.Type);

            _customerRepo.AddCustomerToList(newCustomer);
        }
Esempio n. 2
0
        private static void AddCustomerOption()
        {
            string full_name     = Input("What is the full name of this customer? ");
            string customer_type = ChooseCustomerType();

            Customer new_customer = new Customer(full_name, customer_type);

            new_customer.UpdateMessage();
            Console.WriteLine($"\nCustomer Email Message has been set to \"{new_customer.EmailMessage}\"");

            CustomerRepository.AddCustomerToList(new_customer);
            Console.WriteLine("\nYour customer has been added.");
            Input("Press enter/return ");
        }
        private void CreateNewCustomer()
        {
            Customer newCustomer = new Customer();

            Console.WriteLine("Enter the customer's first name:");
            newCustomer.FirstName = Console.ReadLine();

            Console.WriteLine("Enter the customer's last name:");
            newCustomer.LastName = Console.ReadLine();

            Console.WriteLine("Enter an ID number for customer:");
            newCustomer.CustomerID = int.Parse(Console.ReadLine());

            Console.WriteLine("Enter the type of customer (former, current, or potential):");
            string input = Console.ReadLine();

            switch (input)
            {
            case "former":
                newCustomer.TypeOfCustomer = CustomerType.Former;
                newCustomer.Email          = "We miss you! Would a discount bring you back?";
                break;

            case "current":
                newCustomer.TypeOfCustomer = CustomerType.Current;
                newCustomer.Email          = "We appreciate your business; here's a coupon just for you!";
                break;

            case "potential":
                newCustomer.TypeOfCustomer = CustomerType.Potential;
                newCustomer.Email          = "We currently have the lowest rates for helicopter insurance! Come check us out!";
                break;

            default:
                Console.WriteLine("Invalid response.");
                Console.ReadLine();
                break;
            }

            _customerRepo.AddCustomerToList(newCustomer);
        }
Esempio n. 4
0
        public void AddtoMailingList()
        {
            Console.Clear();
            Customer customer = new Customer();

            Console.WriteLine("What is This Person's First Name?");
            customer.FirstName = Console.ReadLine();

            Console.WriteLine("What is this person's Last Name?");
            customer.LastName = Console.ReadLine();

            Console.WriteLine("What Type of Customer is this person? Please choose" +
                              "\n1. Potential" +
                              "\n2. Current" +
                              "\n3. Past");
            int intput = int.Parse(Console.ReadLine());

            switch (intput)
            {
            case 1:
                customer.CustomerType = CustomerType.Potenial;
                customer.Email        = "We currently have the lowest rates on Helicopter Insurance!";
                break;

            case 2:
                customer.CustomerType = CustomerType.Current;
                customer.Email        = "Thank you for your work with us. We appreciate your loyalty. Here's a coupon";
                break;

            case 3:
                customer.CustomerType = CustomerType.Past;
                customer.Email        = "It's been a long time since we've heard from you, we want you back";
                break;
            }

            _customerRepo.AddCustomerToList(customer);
        }
Esempio n. 5
0
        //This challenge is not at all finished
        static void Main(string[] args)
        {
            CustomerRepository customerRepo = new CustomerRepository();
            List <Customer>    customerList = customerRepo.GetCustomerList();

            Customer newCustomer = new Customer();
            Customer jim         = new Customer("Jim", "Halpert", CustomerType.Current);
            Customer dwight      = new Customer("Dwight", "Shrute", CustomerType.Potential);

            customerRepo.AddCustomerToList(jim);
            customerRepo.AddCustomerToList(dwight);

            int menuResponse = 0;

            while (menuResponse != 5)
            {
                //Sorts customerList alphabettically by last name.
                customerList.Sort(delegate(Customer customer1, Customer customer2) { return(customer1.LastName.CompareTo(customer2.LastName)); });

                Console.WriteLine($"Welcome to Komodo Insurance Customer Log!\n\nWhat would you like to do?\n\t1.See list of customers\n\t2.Add new customer\n\t3.Update current customer\n\t4.Delete current customer\n\t5.Exit program");
                menuResponse = int.Parse(Console.ReadLine());

                switch (menuResponse)
                {
                case 1:
                    Console.WriteLine($"Here are all current customers:\nLast Name\tFirst Name\tCustomer Status\t\tSuggested Email");
                    foreach (Customer customer in customerList)
                    {
                        string email = "";
                        if (customer.CustomerType == CustomerType.Current)
                        {
                            email = "Thank you for your work with us. We appreciate your loyalty. Here's a coupon.";
                        }
                        if (customer.CustomerType == CustomerType.Past)
                        {
                            email = "It's been a long time since we've heard from you, we want you back!";
                        }
                        else
                        {
                            email = " We currently have the lowest rates on Helicopter Insurance!";
                        }

                        Console.WriteLine($"{customer.LastName}\t\t{customer.FirstName}\t\t{customer.CustomerType}\t\t{email}");
                    }
                    Console.ReadLine();
                    break;

                case 2:
                    Console.WriteLine($"Great! Let's add new customer info!\n\nPlease enter their first name:");
                    newCustomer.FirstName = Console.ReadLine();

                    Console.WriteLine("Please enter their last name: ");
                    newCustomer.LastName = Console.ReadLine();

                    Console.WriteLine("Please input customer status: Potential, Current, or Past");
                    var customerType = Console.ReadLine();
                    newCustomer.CustomerType = (CustomerType)Enum.Parse(typeof(CustomerType), customerType);
                    customerRepo.AddCustomerToList(newCustomer);
                    break;

                case 3:
                    Console.WriteLine("Who would you like to update?");
                    var updateResponse = Console.ReadLine();
                    Console.WriteLine($"Would you like to:\n\t1. Change first name\n\t2.Change last name\n\t3.Change customer status");
                    var updateType = Console.ReadLine();
                    if (updateType == "1")
                    {
                        break;
                    }

                case 4:
                    //Only removes added customers. Not ones that are hard coded in.
                    Console.WriteLine($"Which customer would you like to remove?\n Enter First Name:");
                    var removeResponse = Console.ReadLine();
                    Console.WriteLine("Enter Last Name:");
                    var removeLast = Console.ReadLine();
                    if (newCustomer.FirstName == removeResponse && newCustomer.LastName == removeLast)
                    {
                        customerList.Remove(newCustomer);
                    }
                    break;

                default:
                    menuResponse = 5;
                    break;
                }
            }
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            CustomerRepository customerRepo       = new CustomerRepository();
            List <Customer>    CustomerRepository = customerRepo.GetList();

            Customer customer = new Customer("Jim", "Jones", "Potential");

            Console.WriteLine("Welcome to Komodo Insurance");
            Console.WriteLine("\n");
            Console.WriteLine("Would you like to 1.Add a Customer, 2. Remove an Customer, or 3. List all Customers?");
            string choice = Console.ReadLine();

            if (choice == "1")
            {
                while (true)
                {
                    Console.WriteLine("Enter the customer's first name:");
                    int firstName = int.Parse(Console.ReadLine());

                    Console.WriteLine("Enter the customer's last name:");
                    var lastName = Console.ReadLine();

                    Console.WriteLine("Is this a potential, previous or current customer?");
                    string type = Console.ReadLine();


                    customer userFood = new Customer(firstName, lastName, type);
                    customerRepo.AddCustomerToList(userCustomer);


                    Console.WriteLine("Do you want to add annother customer?");
                    string theAnswer = Console.ReadLine();
                    if (theAnswer == "y")
                    {
                        continue;
                    }
                    else if (theAnswer == "n")
                    {
                        customerRepo.printList(customerRepo.GetList());

                        break;
                    }
                }
            }

            else if (choice == "2")
            {
                Console.WriteLine("Which customer do you want to remove?");
                string item = Console.ReadLine();
                customerRepo.removeMenuItemFromList(item);
                customerRepo.printList(customerRepo.GetList());
            }

            else if (choice == "3")
            {
                customerRepo.printList(customerRepo.GetList());
            }
            Console.ReadLine();


            foRepo.AddMenuItemToList(omelette);
            foodRepo.AddMenuItemToList(pancakes);
            foodRepo.AddMenuItemToList(blt);
            foodRepo.AddMenuItemToList(parfait);
            foodRepo.AddMenuItemToList(salad);
            foodRepo.AddMenuItemToList(sub);
        }
        public void Run()
        {
            CustomerRepository customerRepo = new CustomerRepository();
            Customer           customer     = new Customer();
            List <Customer>    customers    = customerRepo.GetCustomerList();
            bool           response         = true;
            CustomerStatus status;

            while (response)
            {
                Console.WriteLine("Welcome to Komodo Customer management!\n\nWhat would you like to do?\n\t" +
                                  "1. See all customers\n\t" +
                                  "2. Add customer\n\t" +
                                  "3. Remove customer\n\t" +
                                  "4. Update customer status\n\t" +
                                  "5. Exit");
                var menuInput = int.Parse(Console.ReadLine());
                switch (menuInput)
                {
                case 1:
                    List <Customer> sortedList = customers.OrderBy(c => c.Name).ToList();
                    Console.WriteLine("Name\t\tStatus\t\tEmail");
                    if (customers.Count < 1 || customers.Capacity == 0)
                    {
                        Console.WriteLine("It appears there aren't any customers.");
                    }
                    else
                    {
                        foreach (Customer c in sortedList)
                        {
                            Console.WriteLine($"{c.Name}\t\t{c.Status}\t\t{c.EmailResponse}");
                        }
                    }
                    Console.ReadLine();
                    break;

                case 2:
                    Console.Write("Enter customer name: ");
                    string name = Console.ReadLine();
                    Console.Write("Enter customer status (Current, Past, Potential): ");
                    string statusInput = Console.ReadLine().ToLower();
                    status   = customerRepo.GetCustomerStatus(statusInput);
                    customer = new Customer()
                    {
                        Name          = name,
                        Status        = status,
                        EmailResponse = customerRepo.GetEmailResponse(status),
                    };
                    customerRepo.AddCustomerToList(customer);
                    break;

                case 3:
                    Console.WriteLine("Enter the name of the customer you would like to remove: \n\n" +
                                      "Name\t\tStatus");
                    if (customers.Count < 1 || customers.Capacity == 0)
                    {
                        Console.WriteLine("It appears there aren't any customers.");
                    }
                    else
                    {
                        foreach (Customer c in customers)
                        {
                            Console.WriteLine($"{c.Name}\t\t{c.Status}");
                        }

                        var remove = Console.ReadLine();
                        customerRepo.RemoveCustomerFromList(remove);
                    }
                    break;

                case 4:
                    Console.WriteLine("Enter the name of the customer you would like to update:");
                    PrintCustomerDetails(customers);
                    var updateName = Console.ReadLine();
                    foreach (Customer c in customers)
                    {
                        if (c.Name == updateName)
                        {
                            Console.WriteLine($"Current Name: {c.Name}. Would you like to update?");
                            if (customerRepo.YesNoResponse(Console.ReadLine()))
                            {
                                Console.Write("Enter new name: ");
                                c.Name = Console.ReadLine();
                            }
                            Console.WriteLine($"Current Status: {c.Status}. Would you like to update?");
                            if (customerRepo.YesNoResponse(Console.ReadLine()))
                            {
                                Console.Write("Enter new status: ");
                                string updateStatus = Console.ReadLine().ToLower();
                                c.Status = customerRepo.GetCustomerStatus(updateStatus);
                            }
                        }
                    }
                    break;

                default:
                    response = false;
                    break;
                }
            }
        }