Esempio n. 1
0
        public static void WriteOrdersDatabase()
        {
            LoadOrders o = new LoadOrders();
            Dictionary <int, Order> OrderDirectory = o.ParseOrderFilestodictionary();
            string OrderDatabase = DateTime.Today.ToString("MMddyyyy") + ".txt";

            try
            {
                using (StreamWriter sw = new StreamWriter(@"C:\repos\chris-williams-individual-work\FlooringMasteryV5\Data\" + OrderDatabase))
                {
                    sw.WriteLine("OrderNumber,CustomerName,State,TaxRate,ProductType,Area,CostPerSquareFoot,LaborCostPerSquareFoot,MaterialCost,LaborCost,Tax,Total,OrderDate");
                    var Toprint = OrderDirectory.Where(d => d.Value.OrderNumber > 0);
                    foreach (var print in Toprint)
                    {
                        sw.WriteLine($"{print.Value.OrderNumber.ToString()},{print.Key},{print.Value.CustomerName},{print.Value.State},{print.Value.TaxRate},{print.Value.Product},{print.Value.Area.ToString()},{print.Value.CostPerSquareFoot.ToString()},{print.Value.LaborCostPerSquareFoot.ToString()},{print.Value.MaterialCost.ToString()},{print.Value.LaborCost.ToString()},{print.Value.Tax.ToString()},{print.Value.Total.ToString()},{print.Value.OrderDate}");
                    }
                }
            }
            catch
            {
                Console.WriteLine("Could not create database File");
                return;
            }
            Console.WriteLine("Database file created");
        }
Esempio n. 2
0
        public static int ReturnHighestOrderNumber()
        {
            List <string> allfiles = GetCurrentOrderFiles();
            LoadOrders    o        = new LoadOrders();
            int           highest  = o.GetHighestOrderNumber(allfiles);

            return(highest);
        }