private void openAddWindow(object parameter) { AddStockView new_stock = new AddStockView(null, HomeViewModel); new_stock.ShowDialog(); refresh(); }
private void openEditWindow(object parameter) { AddStockView old_stock = new AddStockView(SelectedStock, HomeViewModel); old_stock.ShowDialog(); refresh(); }
private void btnAddStock_Click(object sender, EventArgs e) { using (AddStockView addStockView = new AddStockView()) { addStockView.ShowDialog(); } }
public AddStockViewModel(StockModel model, AddStockView add_stock_view, HomeViewModel home_view_model) { fetchProducts(); fetchSuppliers(); this.AddStockView = add_stock_view; this.HomeViewModel = home_view_model; this.CreateOrUpdateCommand = new RelayCommand(addOrUpdateStock); if (model != null) { this.UpdateOrCreate = "Update"; this.ID = Convert.ToInt32(model.ID.value); this.ProductID = Convert.ToInt32(model.ProductID.value); this.SupplierID = Convert.ToInt32(model.SupplierID.value); foreach (ProductModel product in Products) { if (product.ID.value == ProductID) { this.SelectedProduct = product; break; } } foreach (SupplierModel supplier in Suppliers) { if (supplier.ID.value == SupplierID) { this.SelectedSupplier = supplier; break; } } this.Quantity = Convert.ToInt32(model.Quantity.value); this.Date = model.Date.value; } else { this.UpdateOrCreate = "Create"; } CoreApp.logger.log("AddStockViewModel successfully initialized."); }