private void btnEkle_Click(object sender, EventArgs e) { Marka m = new Marka() { MarkaAdi = txtmarkaAd.Text }; MarkaRepository rep = new MarkaRepository(); int mid = 0; bool result = rep.MarkaEkle(m, out mid); if (result == true) { MarkaLabel lbl = new MarkaLabel(); lbl.Text = txtmarkaAd.Text; lbl.MarkaId = mid; MarkalarForm f = (MarkalarForm)Application.OpenForms["MarkalarForm"]; if (f != null) { f.MarkaLabelEkle(lbl); } txtmarkaAd.Clear(); MessageBox.Show("Eklendi"); } else { MessageBox.Show("hata olustu"); } }
private void btnEkle_Click(object sender, EventArgs e) { Marka m = new Marka(); m.MarkaAdi = txtMarkaAdi.Text; //Marka m = new Marka() //üsttekinin farklı hali //{ // MarkaAdi = txtMarkaAdi.Text //}; MarkaRepository rep = new MarkaRepository(); int mid = 0; bool result = rep.MarkaEkle(m, out mid); if (result) { MarkaLabel lbl = new MarkaLabel(); lbl.Text = txtMarkaAdi.Text; lbl.MarkaId = 0; MarkalarForm f = (MarkalarForm)Application.OpenForms["MarkalarForm"]; if (f != null) { f.MarkaLabelEkle(lbl); } txtMarkaAdi.Clear(); MessageBox.Show("Eklendi"); } else { MessageBox.Show("Hata"); } }
private void markalarToolStripMenuItem_Click(object sender, EventArgs e) { Form m = Application.OpenForms["MarkalarForm"]; if (m == null) { m = new MarkalarForm(); } //singelton kullanılmayan hali m.MdiParent = this; m.Show(); }
private void markalarToolStripMenuItem_Click(object sender, EventArgs e) { // MarkalarForm m = new MarkalarForm(); Form m = Application.OpenForms["MarkalarForm"]; if (m == null) { m = new MarkalarForm(); } // Singeloton kullnancagzı m.MdiParent = this; m.Show(); }