/* Enables the Component, Salary, and Materials view, and prepares * the offer for receiving information about any of these */ private void OnSolutionSelected() { IsDataSaved = false; IsComponentTabVisible = true; ArePackagedSolutionsVisible = false; // Set offer's packaged solution to selected Offer.PackagedSolution = SelectedPackagedSolution; // Add appliances to appliances in this offer foreach (var appInstance in SelectedPackagedSolution.ApplianceInstances) { AppliancesInOffer.Add(new UnitPrice(appInstance.Appliance)); } UpdateSidebarValues(); NotifyCanExecuteChanged(); }
public void LoadExistingOffer(int existingOfferId) { using (var ctx = new AssistantContext()) { var existingOffer = ctx.Offers.Where(o => o.Id == existingOfferId) .Include(o => o.Appliances) .Include(o => o.PackagedSolution) .Include(o => o.Materials) .Include(o => o.Salaries) .FirstOrDefault(); if (existingOffer == null) { return; } Offer.PackagedSolution = existingOffer.PackagedSolution; // Load appliances foreach (var appliance in existingOffer.Appliances) { AppliancesInOffer.Add(appliance); } // Load materials foreach (var material in existingOffer.Materials) { MaterialsInOffer.Add(material); } // Load salaries foreach (var salary in existingOffer.Salaries) { SalariesInOffer.Add(salary); } ArePackagedSolutionsVisible = false; IsComponentTabVisible = true; } }