//brisanje stavki sa pregleda racuna private void RemoveItem(object sender, EventArgs e) { if (products.Count > 0) { TblProduct selectedProduct = (TblProduct)listBoxForOrder.SelectedItem; TabTotal -= (decimal)selectedProduct.Price; products.Remove(selectedProduct); } }
//promini info box kad kliknes na neki item na pregledu racuna private void UpdateInfoFromListBox(object sender, EventArgs e) { TblProduct tp = (TblProduct)listBoxForOrder.SelectedItem; if (tp != null) { UpdateInfoPanel(tp); UpdatePricePanel(tp); } }
private void buttonSaveChanges_Click(object sender, EventArgs e) { TblProduct p = new TblProduct(); p.ProductID = 1; p.Description = textBoxForDescription.Text; p.Price = decimal.Parse(textBoxForPrice.Text); p.Image = byteData; p.ProductType = (int)comboBoxForCategories.SelectedValue; csde.TblProducts.Add(p); csde.SaveChanges(); MessageBox.Show("Success"); this.Close(); }
//dodavanja stavki na pregled racuna private void AddProductToFinalTab(object sender, EventArgs e) { Button b = (Button)sender; TblProduct tp = (TblProduct)b.Tag; //HINT -> vidi konstruktor products.Add(tp); UpdateInfoPanel(tp); UpdatePricePanel(tp); TabTotal += (decimal)tp.Price; listBoxForOrder.SelectedIndex = listBoxForOrder.Items.Count - 1; }
//promini cijenu private void UpdatePricePanel(TblProduct product) { textBoxForPriceInfo.Text = product.Price.ToString(); }
//promini info text private void UpdateInfoPanel(TblProduct product) { textBoxForInfo.Text = product.Description; }