Пример #1
0
        static void Main(string[] args)
        {
            DisplayMenu m = new DisplayMenu();
            m.HomeMenu();

              /* Console.WriteLine("What day do you want to see the sales of?")

            {
            Console.Write("Enter a state: ");
            string state = Console.ReadLine();

            TaxRateOperations taxOps = new TaxRateOperations();
            if (taxOps.IsAllowedState(state))
            {
                Console.WriteLine("That is a valid state");
                TaxRate rate = taxOps.GetTaxRateFor(state);

                Console.WriteLine("The tax rate for {0} is {1:p}", rate.State, rate.TaxPercent);
            }
            else
            {
                Console.WriteLine("That is not a valid state");
            }

            Console.ReadLine();*/
        }
Пример #2
0
        public void Quit()
        {
            Console.WriteLine("Would you like to exit the program?");
            string quitProgram = Console.ReadLine().ToUpper();

            if (quitProgram == "Y")
            {
                Console.WriteLine("Hit the enter key to exit:");
                Console.ReadLine();
            }
            else
            {
                DisplayMenu m = new DisplayMenu();
                m.HomeMenu();
            }
        }
Пример #3
0
        public void Quit()
        {
            Console.WriteLine("Would you like to exit the program?");
            string quitProgram = Console.ReadLine().ToUpper();

            if (quitProgram == "Y")
            {
                Console.WriteLine("Hit the enter key to exit:");
                Console.ReadLine();
            }
            else
            {
                DisplayMenu m = new DisplayMenu();
                m.HomeMenu();
            }
        }
Пример #4
0
        public void RemoveTheOrder()
        {
            OrderOperations orderOperations = new OrderOperations();

            Validate validate = new Validate();
            AddEntry display = new AddEntry();
            //bool alreadydisplayed = false;
            bool validinput = false;
            bool goodDate = false;

            Console.WriteLine("REMOVE ORDER");
            Console.WriteLine();

            do
            {
                OrderDate = validate.PromptforDate("Please enter the Date of the order MM/DD/YYYY");
                Console.WriteLine("Enter Order Number:");
                OrderNumber = Console.ReadLine();
                goodNumber = int.TryParse(OrderNumber, out output);
                if (validinput = (goodNumber == true))
                {
                    goodDate = (orderOperations.FindOrder(OrderDate, output));
                }
               if (goodDate == false)
                {
                    Console.WriteLine("That was not a valid order!");
                    //Console.ReadLine();
                }

            } while (!goodDate && !goodNumber);

            if (goodDate == true)
            {
                Console.WriteLine("Would you like to delete order? y/n");
                string answer;
                answer = Console.ReadLine();
                if (answer == "y")
                {
                    //string OrderDate = validate.PromptforDate("Please enter the Date MM/DD/YYYY");
                    //decimal ordnum = validate.PromptforDecimal("EnterOrder Number: ");
                    List<Order> removeO = orderOperations.LoadOrdersFromFile();
                    var remove = orderOperations.LoadOrdersFromFile();
                    var resultsr = from order in removeO
                                   where order.OrderDate != OrderDate || order.OrderNumber != output
                                   select new
                                   {
                                       order.OrderDate,
                                       order.OrderNumber,
                                       order.CustomerName,
                                       order.State,
                                       order.TaxRate,
                                       order.Tax,
                                       order.ProductType,
                                       order.Area,
                                       order.CostPerSquareFoot,
                                       order.LaborCost,
                                       order.LaborCostPerSquareFoot,
                                       order.MaterialCost,
                                       order.Total
                                   };

                    using (StreamWriter ord = new StreamWriter("Orders.txt"))
                    {
                        foreach (var order in resultsr)
                        {
                            ord.WriteLine(order.OrderDate + "," + order.OrderNumber + "," + order.CustomerName + "," + order.State + "," +
                                +order.TaxRate + "," + order.Tax + "," + order.ProductType + "," + order.Area + "," + order.CostPerSquareFoot + "," + order.LaborCost + "," + order.LaborCostPerSquareFoot + "," +
                                 order.MaterialCost + "," + order.Total);
                        }
                        Console.WriteLine("Your order has been removed!");
                        Console.ReadLine();
                    }
                }
                else
                {
                    DisplayMenu m = new DisplayMenu();
                    m.HomeMenu();
                }
            }
            else
            {
                Console.WriteLine("That is not a valid order!");
            }
        }
Пример #5
0
        public void RemoveTheOrder()
        {
            OrderOperations orderOperations = new OrderOperations();

            Validate validate = new Validate();
            AddEntry display  = new AddEntry();
            //bool alreadydisplayed = false;
            bool validinput = false;
            bool goodDate   = false;

            Console.WriteLine("REMOVE ORDER");
            Console.WriteLine();


            do
            {
                OrderDate = validate.PromptforDate("Please enter the Date of the order MM/DD/YYYY");
                Console.WriteLine("Enter Order Number:");
                OrderNumber = Console.ReadLine();
                goodNumber  = int.TryParse(OrderNumber, out output);
                if (validinput = (goodNumber == true))
                {
                    goodDate = (orderOperations.FindOrder(OrderDate, output));
                }
                if (goodDate == false)
                {
                    Console.WriteLine("That was not a valid order!");
                    //Console.ReadLine();
                }
            } while (!goodDate && !goodNumber);

            if (goodDate == true)
            {
                Console.WriteLine("Would you like to delete order? y/n");
                string answer;
                answer = Console.ReadLine();
                if (answer == "y")
                {
                    //string OrderDate = validate.PromptforDate("Please enter the Date MM/DD/YYYY");
                    //decimal ordnum = validate.PromptforDecimal("EnterOrder Number: ");
                    List <Order> removeO  = orderOperations.LoadOrdersFromFile();
                    var          remove   = orderOperations.LoadOrdersFromFile();
                    var          resultsr = from order in removeO
                                            where order.OrderDate != OrderDate || order.OrderNumber != output
                                            select new
                    {
                        order.OrderDate,
                        order.OrderNumber,
                        order.CustomerName,
                        order.State,
                        order.TaxRate,
                        order.Tax,
                        order.ProductType,
                        order.Area,
                        order.CostPerSquareFoot,
                        order.LaborCost,
                        order.LaborCostPerSquareFoot,
                        order.MaterialCost,
                        order.Total
                    };

                    using (StreamWriter ord = new StreamWriter("Orders.txt"))
                    {
                        foreach (var order in resultsr)
                        {
                            ord.WriteLine(order.OrderDate + "," + order.OrderNumber + "," + order.CustomerName + "," + order.State + "," +
                                          +order.TaxRate + "," + order.Tax + "," + order.ProductType + "," + order.Area + "," + order.CostPerSquareFoot + "," + order.LaborCost + "," + order.LaborCostPerSquareFoot + "," +
                                          order.MaterialCost + "," + order.Total);
                        }
                        Console.WriteLine("Your order has been removed!");
                        Console.ReadLine();
                    }
                }
                else
                {
                    DisplayMenu m = new DisplayMenu();
                    m.HomeMenu();
                }
            }
            else
            {
                Console.WriteLine("That is not a valid order!");
            }
        }