示例#1
0
        private void btnWlasciwoscMaterialu_Click(object sender, EventArgs e)
        {
            this.Hide();
            this.Close();
            Wlasciwosc_materialu wlasciwoscMaterialu = new Wlasciwosc_materialu(this.database);

            wlasciwoscMaterialu.ShowDialog();
        }
        private void btnSaveChanges_Click(object sender, EventArgs e)
        {
            Wlasciwosc_materialu frm = (Wlasciwosc_materialu)Application.OpenForms["Wlasciwosc_materialu"];
            int row = Convert.ToInt32(frm.dgvWlasciwoscMaterialu.CurrentRow.Cells[0].Value);;
            DM_Wlasciwosc_materialu toUpdate = this.database.DM_Wlasciwosc_materialu.Where(id_materialu => id_materialu.id_wlasciwosc_materialu == row).First();

            toUpdate.Id_materialu  = Convert.ToInt32(cmbMaterial.SelectedValue);
            toUpdate.Id_wlasciwosc = Convert.ToInt32(cmbWlasciwosc.SelectedValue);
            toUpdate.Wartosc       = txtValue.Text;
            this.database.SaveChanges();

            var WlasciwoscMaterialuForm = Application.OpenForms.OfType <Wlasciwosc_materialu>().Single();

            WlasciwoscMaterialuForm.initDataGridView();
            this.Close();
        }