private void Button_Click_1(object sender, RoutedEventArgs e) { //删除记录 if (GridSelected.SelectedItem != null) { DXInfo.Models.OrderMenuEx selInv = GridSelected.SelectedItem as DXInfo.Models.OrderMenuEx; if (desk != null && order != null) { DXInfo.Models.OrderMenus orderMenu = uow.OrderMenus.GetById(selInv.Id);//.Where(w => w.Id == selInv.Id).FirstOrDefault(); if (orderMenu != null) { if (orderMenu.Status == 2) { MessageBox.Show("已下单不能删除"); return; } uow.OrderMenus.Delete(orderMenu); uow.Commit(); } } ObservableCollection <DXInfo.Models.OrderMenuEx> lsi = GridSelected.ItemsSource as ObservableCollection <DXInfo.Models.OrderMenuEx>; lsi.Remove(selInv); txtQuantity.Text = lsi.Sum(s => s.Quantity).ToString(); txtAmount.Text = lsi.Sum(s => s.Amount).ToString("c"); } }
private void IntegerUpDown_ValueChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { if (GridSelected.SelectedItem != null) { DXInfo.Models.OrderMenuEx selInv = GridSelected.SelectedItem as DXInfo.Models.OrderMenuEx; selInv.Amount = selInv.Quantity * selInv.Price; } }
private void TextBox_LostFocus(object sender, RoutedEventArgs e) { Keyboard.IsOpen = false; if (GridSelected.SelectedItem != null) { DXInfo.Models.OrderMenuEx selInv = GridSelected.SelectedItem as DXInfo.Models.OrderMenuEx; selInv.Amount = selInv.Quantity * selInv.Price; } if (GridSelected.ItemsSource != null) { ObservableCollection <DXInfo.Models.OrderMenuEx> lsi = GridSelected.ItemsSource as ObservableCollection <DXInfo.Models.OrderMenuEx>; txtQuantity.Text = lsi.Sum(s => s.Quantity).ToString(); txtAmount.Text = lsi.Sum(s => s.Amount).ToString("c"); } }