Example #1
0
        private void TambahData()
        {
            if (textBox1.Text != "" && domainUpDown1.Text != "" && numericUpDown1.Text != "" && textBox4.Text != "" && textBox5.Text != "")
            {
                using (var db = new BiodataLink())
                {
                    table = new Table
                    {
                        Nama   = textBox1.Text,
                        Umur   = Convert.ToInt32(numericUpDown1.Text),
                        Gender = domainUpDown1.Text,
                        Email  = textBox4.Text,
                        Nomer  = textBox5.Text,
                    };
                    db.Tables.Add(table);
                    db.SaveChanges();


                    MessageBox.Show("Data diri telah ditambahkan ke profil ");
                    Close();

                    Home main = new Home();
                    main.Show();
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("Semua harus diisi");
            }
        }
Example #2
0
 private void Fruipedia_Cari_Click(object sender, EventArgs e)
 {
     using (var db = new BiodataLink())
     {
         var data = from Table in db.Tables where Table.Nama == textBox2.Text select Table;
         foreach (var item in data)
         {
             textBox1.Text  = item.Nama;
             textBox3.Text  = item.Umur.ToString();
             textBox4.Text  = item.Gender;
             textBox5.Text  = item.Email;
             textBox11.Text = item.Nomer.ToString();
         }
     }
 }