private void ButtonEditOrder_Click(object sender, RoutedEventArgs e) { FuncOrders1_Result selectedRow = new FuncOrders1_Result(); selectedRow = (FuncOrders1_Result)this.DataGridOrders.SelectedItems[0]; new EditORder(context, selectedRow).ShowDialog(); RefreshWindow(); }
private void RemoveOrder_Click(object sender, RoutedEventArgs e) { FuncOrders1_Result selectedRow = new FuncOrders1_Result(); selectedRow = (FuncOrders1_Result)this.DataGridOrders.SelectedItems[0]; TableOrders rowForDel = new TableOrders(); rowForDel = (from c in context.TableOrders where c.Id == selectedRow.id select c).First(); context.TableOrders.Remove(rowForDel); context.SaveChanges(); RefreshWindow(); }
public EditORder(CarRentalCenterDBEntities context_inpt, FuncOrders1_Result selectedRow_inpt) { InitializeComponent(); this.context = context_inpt; this.selectedRow = selectedRow_inpt; this.context = context_inpt; this.LabelAmountCurr.Content = selectedRow.Amount.ToString(); this.LabelCarCurr.Content = selectedRow_inpt.Maker + selectedRow_inpt.Model; this.LabelDateCurr.Content = selectedRow_inpt.Date; this.LabelPersonCurr1.Content = selectedRow_inpt.FirstName + selectedRow_inpt.LastName; this.LabelStatusCurr.Content = selectedRow_inpt.Status; this.ComboBoxEditStatus.ItemsSource = (from c in context.TableStatus select c).ToArray(); this.ComboBoxEditStatus.DisplayMemberPath = "Status"; }