private void Window_Loaded(object sender, RoutedEventArgs e) { DataRowView RowView = (DataRowView)this.DataContext; Int64 Order_num = Int64.Parse(RowView["order_num"].ToString()); DataBase.OrderInfoModel info = new DataBase.OrderInfoModel(); DataTable dt = info.GetByOrderid(Order_num); DishList.ItemsSource = dt.DefaultView; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { Int64 reValue = System.Convert.ToInt64(value); DataBase.OrderInfoModel info = new DataBase.OrderInfoModel(); DataTable dt = info.GetByOrderid(reValue); DataRow[] Rows = dt.Select(); int Allprice = 0; foreach (DataRow row in Rows) { int pr = (int)row["dish_price"]; int num = (int)row["dish_num"]; int price = pr * num; Allprice = Allprice + price; } return Allprice; }