예제 #1
0
        public List <Orders> EditOrder(int ID, DateTime dt, string editChoice, int varToChange)
        {
            if (editChoice == null)
            {
                return(null);
            }
            else
            {
                var order = new FileData.OrderRepo();
                var file  = order.GrabDate(dt);

                var edit   = order.FindByIDAndDate(ID, dt);
                var result = order.EditOrder(file, ID, editChoice, varToChange);

                if (result == null)
                {
                    return(null);
                }
                else
                {
                    var calc = CalculateNewValues(result, editChoice, ID);

                    order.WriteOrders(calc, dt);

                    return(result);
                }
            }
        }
예제 #2
0
        // Validation complete. Done.

        public DateTime Display()
        {
            var    order = new FileData.OrderRepo();
            string date  = ReadString("Please enter in the date of your order (any format): ");

            DateTime.TryParse(date, out DateTime dt);

            if (dt == null)
            {
                Console.WriteLine("Please enter in a valid input");
            }
            else
            {
                if (DateTime.Now > dt)
                {
                    Console.WriteLine("Please enter in a valid date in the FUTURE");
                }
                else
                {
                    var orders = order.GrabDate(dt);
                    if (orders == null)
                    {
                        Console.WriteLine("Could NOT find the file with the date you have entered.");
                    }
                    else
                    {
                        foreach (var o in orders)
                        {
                            Console.WriteLine($"{o.OrderNum}  {o.CustomerName}  {o.State}  {o.TaxRate}  {o.ProductType}  {o.Area}  {o.CostPerSquareFoot}  {o.LaborCostPerSquareFoot}  {o.MaterialsCost}  {o.LaborCost}  {o.Tax}  {o.Total}");
                        }
                    }
                }
            }
            return(dt);
        }
예제 #3
0
        public void RemovingOrder(DateTime dt, int ID)
        {
            var order = new FileData.OrderRepo();
            var file  = order.GrabDate(dt);



            foreach (var f in file)
            {
                if (f.OrderNum == ID)
                {
                    var orders = order.FindByIDAndDate(ID, dt);
                    var remove = order.RemoveOrder(file, dt, orders, ID);
                    order.WriteOrders(remove, dt);
                    var testing = order.GrabDate(dt);
                }
            }
        }