public NewPart(Parts part, bool modifiable) { InitializeComponent(); AppMessages.PartAdded.Register(this, p => this.Close()); AppMessages.PartModified.Register(this, p => this.Close()); var viewModel = new NewPart_ViewModel(part, modifiable); this.DataContext = viewModel; }
void removePartExecute() { Parts p = new Parts(); //p = SQLConnection.Execute.PartsTable.Single( pa => pa.partID == selectedPart.partID); //SQLConnection.Execute.PartsTable.DeleteObject(p); SQLConnection.Execute.SaveDb(); RefreshParts(); }
private void PartModifiedActions(Parts p) { Parts modifiablePart = new Parts(); //modifiablePart = SQLConnection.Execute.PartsTable.Single(part => part.partID == p.partID); modifiablePart.partName = p.partName; modifiablePart.partManufacturer = p.partManufacturer; modifiablePart.partIDNumber = p.partIDNumber; modifiablePart.partPrice = p.partPrice; modifiablePart.partQuantity = p.partQuantity; modifiablePart.mustOrder = p.mustOrder; SQLConnection.Execute.SaveDb(); SetStatus(); RefreshParts(); }
private void PartAddedActions(Parts p) { if (p.partID == null || p.partID == 0) { p.serviceID = _serviceID; p.partID = 0; //SQLConnection.Execute.PartsTable.AddObject(p); SQLConnection.Execute.SaveDb(); SetStatus(); RefreshParts(); } }
public static void Send(Parts p) { Messenger.Default.Send(p, MessageTypes.partModified); }
public static PartRepresentation convertPart(Parts part) { PartRepresentation convertedPart = new PartRepresentation() { id = part.partID, mustOrder = part.mustOrder, partIDNumber = part.partIDNumber, partManufacturer = part.partManufacturer, partName = part.partName, partPrice = part.partPrice, partQuantity = part.partQuantity }; return convertedPart; }