示例#1
0
        private void btnNarzedzie_Click(object sender, EventArgs e)
        {
            this.Hide();
            this.Close();
            Narzedzie narzedzie = new Narzedzie(this.database);

            narzedzie.ShowDialog();
        }
示例#2
0
        private void btnZapisz_Click(object sender, EventArgs e)
        {
            Narzedzie    frm       = (Narzedzie)Application.OpenForms["Narzedzie"];
            DM_Narzedzie narzedzie = new DM_Narzedzie();

            narzedzie.Nazwa = txtNazwa.Text;
            narzedzie.Id_rodzaj_narzedzia = Convert.ToInt32(comboBox1.SelectedValue);;
            narzedzie.Nr_seryjny          = txtNumer.Text;
            narzedzie.Data_zuzycia        = dateTimePicker1.Value;
            this.database.DM_Narzedzie.Add(narzedzie);
            database.SaveChanges();
            frm.dgvNarzedzie.DataSource = this.database.vDM_Narzedzie.ToList();
            this.Close();
        }
示例#3
0
        private void btnZapisz_Click(object sender, EventArgs e)
        {
            Narzedzie    frm      = (Narzedzie)Application.OpenForms["Narzedzie"];
            int          row      = Convert.ToInt32(frm.dgvNarzedzie.CurrentRow.Cells[0].Value);
            DM_Narzedzie toUpdate = this.database.DM_Narzedzie.Where(narzedzie => narzedzie.Id_narzedzia == row).First();

            toUpdate.Nazwa = textBox2.Text;
            toUpdate.Id_rodzaj_narzedzia = Convert.ToInt32(comboBox1.SelectedValue);
            toUpdate.Nr_seryjny          = textBox1.Text;
            toUpdate.Data_zuzycia        = Convert.ToDateTime(dateTimePicker1.Value);

            database.SaveChanges();
            frm.dgvNarzedzie.DataSource = this.database.vDM_Narzedzie.ToList();
            this.Close();
        }