private void btnUpdateProduct_Click(object sender, EventArgs e) { try { if (gridProducts.CurrentRow != null) { string productName = gridProducts.CurrentRow.Cells[0].Value.ToString(); int quantity = int.Parse(gridProducts.CurrentRow.Cells[2].Value.ToString()); var addProductForm = new AddProductForm(productName, quantity); if (addProductForm.ShowDialog() == DialogResult.OK) { OrderItemModel itemToDelete = order.Items.First(o => o.Name == gridProducts.CurrentRow.Cells[0].Value.ToString()); order.Items.Remove(itemToDelete); OrderControler.AddItemToOrder(order, addProductForm.SelectedOrderItem); DisplayOrderItems(); } } else { MetroFramework.MetroMessageBox.Show(this, "Nie zaznaczono żadnej pozycji!", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, "Błąd edytowania produktu!" + Environment.NewLine + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void AddProductBtn_Click(object sender, RoutedEventArgs e) { AddProductForm add = new AddProductForm(); add.ShowDialog(); ProductListBox.ItemsSource = null; ProductListBox.ItemsSource = DBHelper.GetContext().Product.ToList(); }
public ActionResult Create(AddProductForm form) { if (ModelState.IsValid) { _repository.Insert(new Product(form.Name, SessionManager.User.Id)); return(RedirectToAction("Index")); } return(View(form)); }
private async void Add_Click(object sender, RoutedEventArgs e) { var dialog = new AddProductForm(); if (dialog.ShowDialog() ?? false) { await((AddProductViewModel)dialog.DataContext).PostProduct(); } Refresh_Click(sender, e); }
private void btnAddProduct_Click(object sender, EventArgs e) { var form = new AddProductForm(logic); form.Text = "Добавление товара"; if (form.ShowDialog() == DialogResult.OK) { logic.AddProduct(new Entities.Product(0, form.title, form.price, form.leadTime)); dProducts.DataSource = logic.GetProducts(); } }
private void btnAddProduct_Click(object sender, EventArgs e) { AddProductForm form = new AddProductForm(); form.StyleManager = Program.MainStyleManager; if (form.ShowDialog() == DialogResult.OK) { RefreshPrivControls(); MetroMessageBox.Show(this, "You successfully added new product!", "Add product", MessageBoxButtons.OK, 150); } }
private void addProduct() { addProductForm = new AddProductForm(); addProductForm.MaximizeBox = false; addProductForm.MinimizeBox = false; addProductForm.ShowDialog(); using (var db = new WereDesktopEntities()) { productBindingSource.DataSource = db.Product.ToList(); } }
private void btnUpdateProduct_Click(object sender, EventArgs e) { int id = (int)dProducts.SelectedCells[0].Value; var form = new AddProductForm(logic, id); form.Text = "Изменение товара"; if (form.ShowDialog() == DialogResult.OK) { logic.UpdateProduct(new Entities.Product(id, form.title, form.price, form.leadTime)); dProducts.DataSource = logic.GetProducts(); } }
public JsonResult Add(AddProductForm form) { var customer = _context.Customers.Include(x => x.Products).Single(x => x.Id == form.CustomerId); var product = Mapper.Map <Product>(form); customer.Products.Add(product); _context.SaveChanges(); var model = Mapper.Map <CustomerProductViewModel>(product); return(BetterJson(model)); }
public JsonResult Add(AddProductForm form) { var customer = _context.Customers.Include(x => x.Products).Single(x => x.Id == form.CustomerId); var product = Mapper.Map<Product>(form); customer.Products.Add(product); _context.SaveChanges(); var model = Mapper.Map<CustomerProductViewModel>(product); return BetterJson(model); }
private void AddStripButton_Click(object sender, EventArgs e) { var id = (int)CategoryToolStripComboBox.ComboBox.SelectedValue; var name = CategoryToolStripComboBox.Text; var category = new Category(id, name); //ca sa mearga biding-ul dintre category si data set ne generam aici obiectul var productFormAdd = new AddProductForm(category); //si-l adaugam in constructor var result = productFormAdd.ShowDialog(); if (result == DialogResult.OK) { _currentSource.AddProduct(_productBindingSource, productFormAdd.Product); } }
private void AddToolStripMenuItem_Click(object sender, EventArgs e) { if (treeView1.SelectedNode.Parent == null) { AddCategoryForm addForm = new AddCategoryForm(); addForm.Owner = this; addForm.Show(); } else if (treeView1.SelectedNode.Parent.Parent != null || treeView1.SelectedNode.Parent == categoryRootNode) { AddProductForm addForm = new AddProductForm(); addForm.Owner = this; addForm.Show(); } }
private void btnAddProduct_Click(object sender, EventArgs e) { try { var addProductForm = new AddProductForm(); if (addProductForm.ShowDialog() == DialogResult.OK) { OrderControler.AddItemToOrder(order, addProductForm.SelectedOrderItem); DisplayOrderItems(); } } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, "Błąd dodawania produktu!" + Environment.NewLine + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void productsAddButton_Click(object sender, EventArgs e) { AddProductForm aProductForm = new AddProductForm(); aProductForm.ShowDialog(); }
public ProductManager() { addProductForm = new AddProductForm(); listProductForm = new ListProductForm(); context = new OrderDbContext(); }
private void addProduct_MouseClick(object sender, MouseEventArgs e) { AddProductForm product = new AddProductForm(); product.ShowDialog(); }
private void btn_StokGirisi_ItemClick(object sender, TileItemEventArgs e) { AddProductForm apf = new AddProductForm(); apf.ShowDialog(); }