public void AddPartToBOM(Part part) { if (_observableBOMPartsCollection == null) { _observableBOMPartsCollection = new List <ObservableBOMPart>(); } ObservableBOMPart addedPart = new ObservableBOMPart(part.Id, part.Description, part.PartNumber, part.Supplier, part.Price, part.Link); try { _observableBOMPartsCollection.Add(addedPart); //BOMGrid.ItemsSource = bomCollection; } catch (Exception ex) { } }
public void ViewBOM(string JobNumber) { ObservableBOMPartsCollection = new List <ObservableBOMPart>(); GetParts(); GetBOMParts(); var jobNumberParts = BOMPartCollection.Where(j => j.JobNumber == JobNumber); foreach (var item in jobNumberParts) { var part = PartsCollection.Where(p => p.Id == item.PartId).FirstOrDefault(); ObservableBOMPart bomPart = new ObservableBOMPart(item.PartId, part.Description, part.PartNumber, part.Supplier, part.PartNumber, part.Link, item.Quantity); //{ //}; //bomPart.Quantity = item.Quantity; ObservableBOMPartsCollection.Add(bomPart); } _exportViewBtnVisibility = true; }
public void RemovePartToBOM(ObservableBOMPart part) { if (_observableBOMPartsCollection == null) { _observableBOMPartsCollection = new List <ObservableBOMPart>(); } //ObservableBOMPart removedPart = new ObservableBOMPart(part.Id, part.Description, part.PartNumber, part.Supplier, part.Price); ObservableBOMPart removedPart = _observableBOMPartsCollection.Where(p => p.PartId == part.PartId).FirstOrDefault(); try { _observableBOMPartsCollection.Remove(removedPart); //BOMGrid.ItemsSource = bomCollection; } catch (Exception ex) { } }