private void button2_Click(object sender, EventArgs e) { WypozyczenieNarzedzia wypozyczenie = new WypozyczenieNarzedzia(this.database); wypozyczenie.ShowDialog(); this.Close(); }
private void btnZapisz_Click(object sender, EventArgs e) { WypozyczenieNarzedzia frm = (WypozyczenieNarzedzia)Application.OpenForms["WypozyczenieNarzedzia"]; int row = Convert.ToInt32(frm.dgvWypozyczenie.CurrentRow.Cells[0].Value);; DM_Wypozyczenie_narzedzia toUpdate = this.database.DM_Wypozyczenie_narzedzia.Where(narzedzie => narzedzie.Id_wypozyczenia_narzedzia == row).First(); toUpdate.Data_i_godzina_zwrotu = Convert.ToDateTime(dateTimePicker2.Value); toUpdate.Uwagi = textBox1.Text; database.SaveChanges(); frm.dgvWypozyczenie.DataSource = this.database.vDM_Wypozyczenie_narzedzia.ToList(); this.Close(); }
private void btnZapisz_Click(object sender, EventArgs e) { WypozyczenieNarzedzia frm = (WypozyczenieNarzedzia)Application.OpenForms["WypozyczenieNarzedzia"]; DM_Wypozyczenie_narzedzia narzedzie = new DM_Wypozyczenie_narzedzia(); narzedzie.Id_pracownika_wypozyczajacego = Convert.ToInt32(comboBox1.SelectedValue); narzedzie.Data_i_godzina_wypozyczenia = Convert.ToDateTime(dateTimePicker2.Value); narzedzie.Data_i_godzina_zwrotu = Convert.ToDateTime(dateTimePicker2.Value); narzedzie.Uwagi = textBox1.Text; this.database.DM_Wypozyczenie_narzedzia.Add(narzedzie); database.SaveChanges(); frm.dgvWypozyczenie.DataSource = this.database.vDM_Wypozyczenie_narzedzia.ToList(); this.Close(); }