private void CommitBuildChangesCommandHandler(object sender, ExecutedRoutedEventArgs e) { if (newBuildChangesDataGrid.IsVisible) { // Create a new object because the old one is being tracked by EF now. BuildChanx newBuildChanges = new BuildChanx() { ChangeDate = addchangeDate.SelectedDate, VersionReleaseDate = addrelDate.SelectedDate, AppliedChanges = addappliedChanges.Text, MMBR = addmmbr.Text, New_MMBR = addnew_Mmbr.Text, Status = addstatus.Text, }; { context.BuildChanges.Local.Add(newBuildChanges); bcViewSource.View.Refresh(); bcViewSource.View.MoveCurrentTo(newBuildChanges); } //Close the secondary ADD grid and move back to EXISTING grid newBuildChangesDataGrid.Visibility = Visibility.Collapsed; existingBuildChangeDataGrid.Visibility = Visibility.Visible; } //Save to the database now all has been checked context.SaveChanges(); bcViewSource.View.MoveCurrentToPrevious(); bcViewSource.View.MoveCurrentToNext(); //QID.Text = quoteid.Text; */ }
private void CommitInvoiceCommandHandler(object sender, ExecutedRoutedEventArgs e) { int acct; int.TryParse(add_originv.Text, out acct); if (newInvoiceDataGrid.IsVisible) { // Create a new object because the old one // is being tracked by EF now. invoice newInvoice = new invoice() { OrigInvNumber = acct, AccountNo = add_accountno.Text, CustEmail = add_custemail.Text, CompCust = add_company.Text, Address = add_address.Text, SAddress = add_saddress.Text, InvoiceDate = add_invdate.SelectedDate, CustomerOrderNo = add_custorder.Text, Contact = add_contact.Text, Phone = add_phone.Text, InvCode = add_invCodeComboBox.Text, User = add_user.Text }; { context.invoices.Local.Add(newInvoice); invViewSource.View.Refresh(); invViewSource.View.MoveCurrentTo(newInvoice); } //Close the secondary ADD grid and move back to EXISTING grid newInvoiceDataGrid.Visibility = Visibility.Collapsed; //Collapse Commit Btn/Show Save Btn btnUpdate.Visibility = Visibility.Visible; btnCommit.Visibility = Visibility.Collapsed; existingInvoiceDataGrid.Visibility = Visibility.Visible; } //Save to the database now all has been checked context.SaveChanges(); invViewSource.View.MoveCurrentToPrevious(); invViewSource.View.MoveCurrentToNext(); }
private void DeleteQuoteCommandHandler(object sender, ExecutedRoutedEventArgs e) { Analytics.TrackEvent("Quotes - Delete attempt"); // If existing window is visible, delete the customer and all their orders. // In a real application, you should add warnings and allow the user to cancel the operation. var cur = qtViewSource.View.CurrentItem as quote; var qt = (from c in context.quotes where c.QuoteNumber == cur.QuoteNumber select c).FirstOrDefault(); if (qt != null) { foreach (var qtitm in qt.quoteitems.ToList()) { // Delete_Order(qtitm); } context.quotes.Remove(qt); } context.SaveChanges(); qtViewSource.View.Refresh(); }
// Commit changes from the new customer form, the new order form, // or edits made to the existing customer form. private void UpdateCommandHandler(object sender, ExecutedRoutedEventArgs e) { context.SaveChanges(); }