示例#1
0
        private void btnZapisz_Click(object sender, EventArgs e)
        {
            DostawaMaterialu     frm     = (DostawaMaterialu)Application.OpenForms["DostawaMaterialu"];
            DM_Dostawa_materialu dostawa = new DM_Dostawa_materialu();

            dostawa.Id_pracownika = Convert.ToInt32(comboBox1.SelectedValue);
            dostawa.Data_dostawy  = Convert.ToDateTime(dateTimePicker2.Value);
            dostawa.Uwagi         = textBox1.Text;
            this.database.DM_Dostawa_materialu.Add(dostawa);
            database.SaveChanges();
            frm.dgvDostawa.DataSource = this.database.vDM_Dostawa_materialu.ToList();
            this.Close();
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Czy chcesz usunąć materiał?", "Usuwanie materiału", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                DostawaMaterialu frm = (DostawaMaterialu)Application.OpenForms["DostawaMaterialu"];
                int id = Convert.ToInt32(this.dgv.CurrentRow.Cells[0].Value);

                DM_Sklad_dostawy_materialu toRemove = this.database.DM_Sklad_dostawy_materialu.Where(id_narz => id_narz.Id_dostawy_mate == id).First();

                this.database.DM_Sklad_dostawy_materialu.Remove(toRemove); // DELETE

                this.database.SaveChanges();
                this.Close();
            }
            else
            {
                DialogResult dialog1Result = MessageBox.Show("Nie udało się usunąć materiału!");
            }
        }
示例#3
0
        private void button2_Click(object sender, EventArgs e)
        {
            DostawaMaterialu nowa = new DostawaMaterialu(this.database);

            nowa.ShowDialog();
        }