private void removeCustomerOrder(object sender, SelectionChangedEventArgs args) { Model.CustomerOrder selectedCustomerOrder = ListViewCustomerOrders.SelectedItem as Model.CustomerOrder; if (selectedCustomerOrder != null) { modelView.removeCustomerOrder(selectedCustomerOrder); } }
private void selectedOrderComplete(object sender, RoutedEventArgs e) { Model.CustomerOrder selectedCustomerOrder = ListViewCustomerOrders.SelectedItem as Model.CustomerOrder; if (selectedCustomerOrder != null) { modelView.selectedOrderComplete(selectedCustomerOrder); } }
public void selectedOrderComplete(Model.CustomerOrder selectedCustomerOrder) { for (int i = 0; i < this.CustomerOrders.Count; i++) { Model.CustomerOrder customerOrder = this.CustomerOrders[i]; if (customerOrder == selectedCustomerOrder) { this.CustomerOrders.RemoveAt(i); this.CompleteCustomerOrders.Add(selectedCustomerOrder); } } }
public void safeOrder(Model.CustomerOrder order) { try { string query = "INSERT INTO orders (id, date) VALUES (?id, ?date)"; MySqlCommand cmd = new MySqlCommand(query, database.Connection); cmd.Parameters.AddWithValue("?id", order.ID); cmd.Parameters.AddWithValue("?date", DateTime.Now); database.Connection.Open(); cmd.ExecuteNonQuery(); database.Connection.Close(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void clearOrder() { Model.CustomerOrder order = new Model.CustomerOrder(); this.Order = order; }
public void addOrder(Model.CustomerOrder order) { this.CustomerOrders.Add(order); OnPropertyChanged("CustomerOrders"); }