// Form for updating an exisiting quote public QuoteFormViewModel(BaseViewModel parent, int quoteId, Boolean updating) { this.parent = parent; // will be set to true this.updating = updating; btnText = "Update Quote"; // Get the quote this.quote = QuoteModel.getQuote(quoteId); this.customerId = quote.customer.customerId; // Get the customer the quote is being issued for customer = CustomerModel.getCustomer(customerId); // Set visibility of business textblocks if (customer.companyName == null || customer.vatNo == null) { isBusinessCustomer = "Collapsed"; } else { isBusinessCustomer = "Visible"; } // Get all materials materialList = MaterialModel.getMaterialList(); // Keep a copy of the material list for filtering originalMaterialList = new ObservableCollection <MaterialModel>(materialList); // Get the quote materials that have been generated for this quote quoteMaterialList = QuoteMaterialModel.getQuoteMaterialList(quoteId); // Update the total quote cost updateTotalQuoteCosts(); }
// Default constructor for creating a new quote public QuoteFormViewModel(BaseViewModel parent, int customerId) { this.parent = parent; // this is a new quote this.updating = false; btnText = "Create Qoute"; this.customerId = customerId; // Create a new blank quote quote = new QuoteModel(customerId); // Get the customer's model customer = CustomerModel.getCustomer(customerId); // Set the visibility of the customer vat and company name details if (customer.companyName == null || customer.vatNo == null) { isBusinessCustomer = "Collapsed"; } else { isBusinessCustomer = "Visible"; } // The the list of all active materials materialList = MaterialModel.getMaterialList(); originalMaterialList = new ObservableCollection <MaterialModel>(materialList); // Create an empty list ot store quote materials quoteMaterialList = new ObservableCollection <QuoteMaterialModel>(); // Update the total quote cost updateTotalQuoteCosts(); }
public MaterialManageViewModel(BaseViewModel parent) { this.parent = parent; // Get the list of all active materials materialList = MaterialModel.getMaterialList(); // Get list of all deleted materials deletedMaterialList = MaterialModel.getDeletedMaterialList(); // Keep a copy of the materialList so that we can restore the list after filtering originalMaterialList = new ObservableCollection <MaterialModel>(materialList); }