private void btnAdd1_Click(object sender, EventArgs e) { if (tabControl1.SelectedIndex == 0) { adaugaFurnizor frm = new adaugaFurnizor(); frm.Show(); } else if (tabControl1.SelectedIndex == 1) { adaugaContract frm = new adaugaContract(); frm.Show(); } else if (tabControl1.SelectedIndex == 2) { adaugaComanda frm = new adaugaComanda(); frm.Show(); } else if (tabControl1.SelectedIndex == 3) { adaugaCategorie frm = new adaugaCategorie(); frm.Show(); } else if (tabControl1.SelectedIndex == 4) { adaugaProdus frm = new adaugaProdus(); frm.Show(); } else if (tabControl1.SelectedIndex == 5) { adaugaProducator frm = new adaugaProducator(); frm.Show(); } }
private void btnActualizare_Click(object sender, EventArgs e) { if (tabControl1.SelectedIndex == 0) { int ID = Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value); var objTmp = db.FURNIZORs.Where(x => x.FURNIZOR_ID == ID).First(); adaugaFurnizor frm = new adaugaFurnizor(objTmp); frm.Show(); } else if (tabControl1.SelectedIndex == 1) { int ID = Convert.ToInt32(dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[0].Value); var objTmp = db.CONTRACTs.Where(x => x.CONTRACT_ID == ID).First(); adaugaContract frm = new adaugaContract(objTmp); frm.Show(); } else if (tabControl1.SelectedIndex == 2) { int ID = Convert.ToInt32(dataGridView3.Rows[dataGridView3.CurrentRow.Index].Cells[0].Value); var objTmp = db.COMANDA_STOC.Where(x => x.COMANDA_STOC_ID == ID).First(); adaugaComanda frm = new adaugaComanda(objTmp); frm.Show(); } else if (tabControl1.SelectedIndex == 3) { int ID = Convert.ToInt32(dataGridView4.Rows[dataGridView4.CurrentRow.Index].Cells[0].Value); var objTmp = db.CATEGORIE_SPORT.Where(x => x.CATEGORIE_SPORT_ID == ID).First(); adaugaCategorie frm = new adaugaCategorie(objTmp); frm.Show(); } else if (tabControl1.SelectedIndex == 4) { int ID = Convert.ToInt32(dataGridView5.Rows[dataGridView5.CurrentRow.Index].Cells[0].Value); var objTmp = db.PRODUSEs.Where(x => x.PRODUS_ID == ID).First(); adaugaProdus frm = new adaugaProdus(objTmp); frm.Show(); } else if (tabControl1.SelectedIndex == 5) { int ID = Convert.ToInt32(dataGridView6.Rows[dataGridView6.CurrentRow.Index].Cells[0].Value); var objTmp = db.PRODUCATORs.Where(x => x.PRODUCATOR_ID == ID).First(); adaugaProducator frm = new adaugaProducator(objTmp); frm.Show(); } }