예제 #1
0
        public void display_data()
        {
            var contex = new db_asuransiEntities();
            var data   = (from d in contex.Nasabah select d);

            dataGridView1.DataSource = data.ToList();
        }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            var contex   = new db_asuransiEntities();
            var nasabah  = new Nasabah();
            var asuransi = new Asuransi_nasabah();

            nasabah.nama_nasabah  = textBox1.Text;
            nasabah.no_identitas  = Convert.ToInt32(textBox2.Text);
            nasabah.tempat_lahir  = textBox3.Text;
            nasabah.tanggal_lahir = dateTimePicker1.Value.Date;
            nasabah.jenis_kelamin = comboBox1.Text;
            nasabah.status        = textBox4.Text;
            nasabah.pekerjaan     = textBox5.Text;
            nasabah.penghasilan   = textBox6.Text;
            nasabah.no_telp       = Convert.ToInt32(textBox7.Text);
            nasabah.alamat        = textBox8.Text;
            contex.Nasabah.Add(nasabah);
            asuransi.id_nasabah     = nasabah.id_nasabah;
            asuransi.Jenis_asuransi = comboBox2.Text;
            contex.SaveChanges();
            display_data();
        }