private void AddFirmu() { AddEdit_Product proizvodi = new AddEdit_Product(selectedfirma, new Product()); proizvodi.ShowDialog(); PopulateProizvodList(-1); }
private void EditProizvod() { if (dataGridProducts.SelectedRows.Count == 0) { return; } Product p = new Product(); p.CustomerID = selectedfirma; int.TryParse(Convert.ToString(dataGridProducts.SelectedRows[0].Cells[0].Value), out p.ProductID); p.ProductName = dataGridProducts.SelectedRows[0].Cells[2].Value.ToString(); p.Sale = bool.Parse(dataGridProducts.SelectedRows[0].Cells[3].Value.ToString()); p.Rent = bool.Parse(dataGridProducts.SelectedRows[0].Cells[4].Value.ToString()); int.TryParse(Convert.ToString(dataGridProducts.SelectedRows[0].Cells[5].Value), out p.ContractDuration); int.TryParse(Convert.ToString(dataGridProducts.SelectedRows[0].Cells[6].Value), out p.SaleIncome); int.TryParse(Convert.ToString(dataGridProducts.SelectedRows[0].Cells[7].Value), out p.RentIncome); p.DateOfContract = Convert.ToDateTime(dataGridProducts.SelectedRows[0].Cells[8].Value); AddEdit_Product dlg = new AddEdit_Product(selectedfirma, p); if (dlg.ShowDialog() == DialogResult.OK) { if (specific) { PopulateProizvodList(selectedfirma.CustomerID); } else { PopulateProizvodList(-1); } } }
private void dodajProizvodToolStripMenuItem_Click(object sender, EventArgs e) { AddEdit_Product frm = new AddEdit_Product(selectedfirma, new Product()); frm.ShowDialog(); if (specific) { PopulateProizvodList(selectedfirma.CustomerID); } else { PopulateProizvodList(-1); } }