private void AddItem_Click(object sender, RoutedEventArgs e)//button add { if (!string.IsNullOrEmpty(fooditem.SelectedValue.ToString()) || !string.IsNullOrEmpty(tableitem.SelectedValue.ToString()) || !string.IsNullOrEmpty(Quantitytxt.Text)) { _vOrderItems = new ViewOrderItems(); _oVM = new OrderingViewModel(); fooditemdata = _oVM.getFoodDetail(Convert.ToInt32(fooditem.SelectedValue)); _vOrderItems.Quantity = Convert.ToInt32(Quantitytxt.Text); _vOrderItems.Price = fooditemdata.fPrice * _vOrderItems.Quantity; _vOrderItems.FoodID = fooditemdata.FoodID; _vOrderItems.FoodName = fooditemdata.FoodName; _vOrderItems.TableID = Convert.ToInt32(tableitem.SelectedValue); var createdOrder = _oVM.PlaceOrder(_vOrderItems); if (createdOrder != null) { mycart.Add(_vOrderItems); fooditemsgrid.ItemsSource = mycart; fooditemsgrid.Items.Refresh(); status.Content = "Додано до списку замовлених страв"; } } else { status.Foreground = Brushes.Red; status.Content = "Всі поля обов'язкові для заповнення"; status.Foreground = Brushes.Green; } }
private void AddItem_Click(object sender, RoutedEventArgs e) { if (Quantitytxt.Text != "" || fooditem.SelectedValue != null || tableitem.SelectedValue != null) { _vOrderItems = new ViewOrderItems(); _oVM = new OrderingViewModel(); //fooditemsdata = _oVM.getFoodItems(); //get food detail _vOrderItems.FoodId = fooditemsdata.FoodID; _vOrderItems.FoodName = fooditemsdata.FoodName; _vOrderItems.Quantity = Convert.ToInt32(Quantitytxt.Text); _vOrderItems.TableId = Convert.ToInt32(tableitem.SelectedItem); _vOrderItems.Price = fooditemsdata.fPrice * _vOrderItems.Quantity; myCart.Add(_vOrderItems); fooditemsgrid.ItemsSource = myCart; fooditemsgrid.Items.Refresh(); //veri ekledikçe data grid güncelleme işlemi status.Content = "Ürün Eklendi"; } else { status.Content = "Tüm alanlar zorunludur."; } }
public OrderingPage(List <CartItemInfo> productList) { InitializeComponent(); orderingViewModel = new OrderingViewModel(productList); BindingContext = orderingViewModel; }
private void PlaceOrder_Click(object sender, RoutedEventArgs e) { _oVM = new OrderingViewModel(); bool confirm = _oVM.PlaceOrder(myCart); if (confirm) { DataContext = new OrderingViewModel(); myCart.Clear(); fooditemsgrid.ItemsSource = myCart; fooditemsgrid.Items.Refresh(); } else { status.Content = "Yanlış giden bir şeyler var."; } }
public static void CreateOrdering(object sender, object selectedItem) { if (selectedItem is OrderingCollectionViewModel orderingCollectionViewModel) { CreateOrdering(sender, orderingCollectionViewModel.Parent); return; } if (!(selectedItem is GroupViewModel entityGroupViewModel)) { return; } var button = (Button)sender; var type = (string)button.CommandParameter; OrderByBase entity; switch (type) { case nameof(Ascending): entity = Ascending.New("Property"); break; case nameof(Descending): entity = Descending.New("Property"); break; default: throw new ArgumentOutOfRangeException(); } entityGroupViewModel.Element.Ordering.Add(entity); var viewModelCollection = entityGroupViewModel.Children.OfType <OrderingCollectionViewModel>().First(); var viewModel = new OrderingViewModel(entity, viewModelCollection); viewModelCollection.Children.Add(viewModel); entityGroupViewModel.IsExpanded = true; viewModelCollection.IsExpanded = true; viewModel.IsSelected = true; viewModel.IsExpanded = true; }
private void AddItem_Click(object sender, RoutedEventArgs e) { if (fooditem.SelectedValue != null || tableitem.SelectedValue != null || Quantitytxt.Text != null) { _vOrderItems = new ViewOrderItems(); _oVM = new OrderingViewModel(); //fooditemsdata = _oVM.getFoodDetail() // getfooddetail _vOrderItems.Quantity = Convert.ToInt32(Quantitytxt.Text); _vOrderItems.Price = fooditemsdata.fPrice * _vOrderItems.Quantity;// ücret hesaplanır _vOrderItems.TableID = Convert.ToInt32(tableitem.SelectedItem); _vOrderItems.FoodID = fooditemsdata.FoodID; _vOrderItems.FoodName = fooditemsdata.FoodName; myCart.Add(_vOrderItems); fooditemsgrid.ItemsSource = myCart; fooditemsgrid.Items.Refresh(); status.Content = "Ürün eklendi."; } else { status.Content = "Tüm alanlar zorunlu doldurulmalıdır"; } }
private void PlaceOrder_Click(object sender, RoutedEventArgs e)//proceed order with dish { if (fooditemsgrid.ItemsSource != null) { _oVM = new OrderingViewModel(); int confirm = _oVM.InsertOrder(mycart); if (confirm != 0) { DataContext = new OrderingViewModel(); mycart.Clear(); fooditemsgrid.ItemsSource = mycart; fooditemsgrid.Items.Refresh(); status.Content = "Замовленя відправлено на обробку."; } else { status.Content = "Щось не так =)"; } } else { status.Content = "Немає елементів доданих до списку."; } }
private void PlaceOrder_Click(object sender, RoutedEventArgs e) { if (fooditemsgrid.ItemsSource != null) { _oVM = new OrderingViewModel(); bool confirm = _oVM.PlaceOrder(mycart); if (confirm) { DataContext = new OrderingViewModel(); mycart.Clear(); fooditemsgrid.ItemsSource = mycart; fooditemsgrid.Items.Refresh(); status.Content = "Sipariş verildi."; } else { status.Content = "Birşeyler yanlış gitti."; } } else { status.Content = "Listeye herhangi bir ürün eklenmedi."; } }
private void AddItem_Click(object sender, RoutedEventArgs e) { if (fooditem.SelectedValue != null || tableitem.SelectedValue != null || Quantitytxt.Text != null) { _vOrderItems = new ViewOrderItems(); _oVM = new OrderingViewModel(); fooditemdata = _oVM.getFoodDetail(Convert.ToInt32(fooditem.SelectedValue)); _vOrderItems.Quantity = Convert.ToInt32(Quantitytxt.Text); _vOrderItems.Price = fooditemdata.fPrice * _vOrderItems.Quantity; _vOrderItems.FoodID = fooditemdata.FoodID; _vOrderItems.FoodName = fooditemdata.FoodName; _vOrderItems.TableID = Convert.ToInt32(tableitem.SelectedValue); mycart.Add(_vOrderItems); fooditemsgrid.ItemsSource = mycart; fooditemsgrid.Items.Refresh(); status.Content = "Ürün listeye eklendi"; } else { status.Foreground = Brushes.Red; status.Content = "Tüm alanlar zorunludur"; status.Foreground = Brushes.Green; } }
public NewOrderPlace() { InitializeComponent(); DataContext = new OrderingViewModel(); mycart = new List <ViewOrderItems>(); }
private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { _oVM = new OrderingViewModel(); _oVM.getFoodOrderItems(); MessageBox.Show(tablelistcombo.SelectedValue.ToString()); }
public UpdateOrders() { InitializeComponent(); DataContext = new OrderingViewModel(); }
public GenerateBill() { InitializeComponent(); DataContext = new OrderingViewModel(); }