private void btnWlasciwosc_Click(object sender, EventArgs e) { this.Hide(); this.Close(); Wlasciwosc Wlasciwosc = new Wlasciwosc(this.database); Wlasciwosc.ShowDialog(); }
private void btnAdd_Click(object sender, EventArgs e) { Wlasciwosc frm = (Wlasciwosc)Application.OpenForms["Wlasciwosc"]; int row = Convert.ToInt32(frm.dgvWlasciwosc.CurrentRow.Cells[0].Value);; DM_Wlasciwosc toUpdate = this.database.DM_Wlasciwosc.Where(wlasc => wlasc.Id_wlasciwosc == row).First(); toUpdate.Nazwa_wlasciwosci = txtNew.Text; toUpdate.Jednostka_pomiarowa = txtNIP.Text; database.SaveChanges(); frm.dgvWlasciwosc.DataSource = this.database.vDM_Wlasciwosc.ToList(); this.Close(); }
private void btnAdd_Click(object sender, EventArgs e) { Wlasciwosc frm = (Wlasciwosc)Application.OpenForms["Wlasciwosc"]; DM_Wlasciwosc newsnowy = new DM_Wlasciwosc(); newsnowy.Nazwa_wlasciwosci = txtNew.Text; newsnowy.Jednostka_pomiarowa = txtNIP.Text; this.database.DM_Wlasciwosc.Add(newsnowy); this.database.SaveChanges(); frm.dgvWlasciwosc.DataSource = this.database.vDM_Wlasciwosc.ToList(); this.Close(); }