//TODO: I used auto-fix to add the private line above. Why is it required to set numProducts? public OrderManager(IOrderRepo orderRepository) { _orderRepository = orderRepository; //TODO: Search for _orderRepository to see how it's used and ask if I still don't know. // Load all tax Info List <StateTax> Taxes = new List <StateTax>(); Taxes = TaxRepo.ReadFile(); //Load all Product Info List <Product> Products = new List <Product>(); Products = ProductRepo.ReadFile(); int numProducts = Products.Count; List <Order> allOrders = new List <Order>(); }
private static Order CalcRestofOrder(Order orderFromUsr) { //Keep lInq statements here. // Move others to the getter. //Order completedOrder = new Order(); OrderTestRepo2 orderRepo = new OrderTestRepo2(); //List<Order> allCrntOrders = orderRepo.LoadOrders(); List <StateTax> allTaxInfo = TaxRepo.ReadFile(); List <Product> allPrducts = ProductRepo.ReadFile(); StateTax stateTax = allTaxInfo.FirstOrDefault(t => t.StateAbrev == orderFromUsr.State); orderFromUsr.TaxRate = stateTax.Tax; Product crntProd = allPrducts.FirstOrDefault(p => p.ProductType == orderFromUsr.ProductType); orderFromUsr.CostPerSquareFoot = crntProd.CostPerSquareFoot; orderFromUsr.LaborCostPerSquareFoot = crntProd.LaborCostPerSquareFoot; return(orderFromUsr); }
public static string AskForNewStateAbbr() { List <StateTax> TaxList = TaxRepo.ReadFile(); foreach (StateTax tax in TaxList) { Console.WriteLine(" " + (TaxList.IndexOf(tax) + 1) + ". " + tax.StateName); } Console.WriteLine("Type the number of the state."); int userNumChoice = CommonIO.GetIntFromUser(0, TaxList.Count, -1); if (userNumChoice == -1) { // Users choose zero when selecting no state, which gets set to -1 in GetIntFromUser using offset return(null); } else { StateTax SelectedState = TaxList.ElementAt(userNumChoice); return(SelectedState.StateAbrev); } }