Beispiel #1
0
        private void Button4_Click(object sender, EventArgs e)
        {
            // Sil

            DialogResult dr = MessageBox.Show("Silmek istediğinize emin misiniz?", "DİKKAT", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == DialogResult.No)
            {
                return;
            }

            if (txtMODUL_REFNO.Text != "")
            {
                MODUL m = new MODUL();
                m = pe.MODULs.Find(Convert.ToInt32(txtMODUL_REFNO.Text));
                pe.MODULs.Remove(m);
                pe.SaveChanges();
                var liste = pe.MODULs.ToList();
                dataGridView1.DataSource = liste;
            }
        }
Beispiel #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            // Kaydet

            MODUL m = new MODUL();

            if (txtMODUL_REFNO.Text != "")
            {
                m           = pe.MODULs.Find(Convert.ToInt32(txtMODUL_REFNO.Text));
                m.MODUL_ADI = txtMODUL_ADI.Text;
                pe.SaveChanges();
            }
            else
            {
                m.MODUL_ADI = txtMODUL_ADI.Text;
                pe.MODULs.Add(m);
                pe.SaveChanges();
            }
            var liste = pe.MODULs.ToList();

            dataGridView1.DataSource = liste;
        }