Beispiel #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         Pegawai p = new Pegawai()
         {
             ID_Pegawai     = System.Convert.ToInt32(textBox1.Text),
             Jenis_Pegawai  = comboBox1.Text,
             Nama_Pegawai   = textBox2.Text,
             Alamat_Pegawai = textBox3.Text,
             Telp_Pegawai   = System.Convert.ToInt32(textBox5.Text),
             Kota           = textBox4.Text,
             Email          = textBox6.Text
         };
         PegawaiController pc = new PegawaiController();
         pc.updatePegawai(p);
     }
     catch (FormatException fe)
     {
         MessageBox.Show("Data Harus Terisi semua");
     }
     textBox1.Clear();
     textBox2.Clear();
     comboBox1.ResetText();
     textBox3.Clear();
     textBox4.Clear();
     textBox5.Clear();
     textBox6.Clear();
 }
Beispiel #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            PegawaiController     pc    = new PegawaiController();
            IEnumerable <Pegawai> hasil = pc.ShowData();

            dataGridView1.DataSource = hasil.ToList();
        }
Beispiel #3
0
        public void AddPegawai()
        {
            PegawaiController pc = new PegawaiController();
            int count1 = (pc.ShowData().Count()) + 1;

            using (HospitalEntities context = new HospitalEntities())
            {
                int result = (int)(context.GetNewPegawaiId().FirstOrDefault());
                if (result > -1)
                {
                    Pegawai p = new Pegawai()
                    {
                        ID_Pegawai = result,
                        Jenis_Pegawai = "Dokter",
                        Nama_Pegawai = "Ipir",
                        Alamat_Pegawai = "Keputih",
                        Telp_Pegawai = 0912,
                        Kota = "asd",
                        Email = "asdfs"
                    };
                    //PegawaiController pac = new PegawaiController();
                    pc.AddPegawi(p);
                }

                int count2 = pc.ShowData().Count();

                Assert.AreEqual(count1, count2, "Wrong");

            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            PegawaiController pc = new PegawaiController();
            IEnumerable<Pegawai> hasil = pc.ShowData();
            dataGridView1.DataSource = hasil.ToList();

            textBox1.Clear();
            textBox2.Clear();
            comboBox1.ResetText();
            textBox3.Clear();
            textBox4.Clear();
            textBox5.Clear();
            textBox6.Clear();
        }
Beispiel #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            PegawaiController     pc    = new PegawaiController();
            IEnumerable <Pegawai> hasil = pc.ShowData();

            dataGridView1.DataSource = hasil.ToList();

            textBox1.Clear();
            textBox2.Clear();
            comboBox1.ResetText();
            textBox3.Clear();
            textBox4.Clear();
            textBox5.Clear();
            textBox6.Clear();
        }
Beispiel #6
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         PegawaiController pc = new PegawaiController();
         pc.deletePegawai(System.Convert.ToInt32(textBox1.Text));
     }
     catch (FormatException fe)
     {
         MessageBox.Show("Pilih Data yang akan Dihapus");
     }
     textBox1.Clear();
     textBox2.Clear();
     comboBox1.ResetText();
     textBox3.Clear();
     textBox4.Clear();
     textBox5.Clear();
     textBox6.Clear();
 }
Beispiel #7
0
        private void Tambah_Click(object sender, EventArgs e)
        {
            using (HospitalEntities context = new HospitalEntities())
            {
                try
                {
                    int result = (int)(context.GetNewPegawaiId().FirstOrDefault());
                    if (result > -1)
                    {
                        Pegawai p = new Pegawai()
                        {
                            ID_Pegawai     = result,
                            Jenis_Pegawai  = comboBox1.Text,
                            Nama_Pegawai   = textBox2.Text,
                            Alamat_Pegawai = textBox3.Text,
                            Telp_Pegawai   = System.Convert.ToInt32(textBox5.Text),
                            Kota           = textBox4.Text,
                            Email          = textBox6.Text
                        };
                        PegawaiController pc = new PegawaiController();
                        pc.AddPegawi(p);
                    }
                }
                catch (FormatException fe)
                {
                    MessageBox.Show("Data harus terisi semua ");
                }
            }

            textBox1.Clear();
            textBox2.Clear();
            comboBox1.ResetText();
            textBox3.Clear();
            textBox4.Clear();
            textBox5.Clear();
            textBox6.Clear();
        }
        private void Tambah_Click(object sender, EventArgs e)
        {
            using (HospitalEntities context = new HospitalEntities())
            {
                try
                {
                    int result = (int)(context.GetNewPegawaiId().FirstOrDefault());
                    if (result > -1)
                    {
                        Pegawai p = new Pegawai()
                        {
                            ID_Pegawai = result,
                            Jenis_Pegawai = comboBox1.Text,
                            Nama_Pegawai = textBox2.Text,
                            Alamat_Pegawai = textBox3.Text,
                            Telp_Pegawai = System.Convert.ToInt32(textBox5.Text),
                            Kota = textBox4.Text,
                            Email = textBox6.Text
                        };
                        PegawaiController pc = new PegawaiController();
                        pc.AddPegawi(p);
                    }
                }
                catch (FormatException fe)
                {
                    MessageBox.Show("Data harus terisi semua ");
                }
            }

            textBox1.Clear();
            textBox2.Clear();
            comboBox1.ResetText();
            textBox3.Clear();
            textBox4.Clear();
            textBox5.Clear();
            textBox6.Clear();
        }
 private void button2_Click(object sender, EventArgs e)
 {
     PegawaiController pc = new PegawaiController();
     IEnumerable<Pegawai> hasil = pc.ShowDokter();
     dataGridView2.DataSource = hasil.ToList();
 }
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         Pegawai p = new Pegawai()
         {
             ID_Pegawai = System.Convert.ToInt32(textBox1.Text),
             Jenis_Pegawai = comboBox1.Text,
             Nama_Pegawai = textBox2.Text,
             Alamat_Pegawai = textBox3.Text,
             Telp_Pegawai = System.Convert.ToInt32(textBox5.Text),
             Kota = textBox4.Text,
             Email = textBox6.Text
         };
         PegawaiController pc = new PegawaiController();
         pc.updatePegawai(p);
     }
     catch (FormatException fe)
     {
         MessageBox.Show("Data Harus Terisi semua");
     }
     textBox1.Clear();
     textBox2.Clear();
     comboBox1.ResetText();
     textBox3.Clear();
     textBox4.Clear();
     textBox5.Clear();
     textBox6.Clear();
 }
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         PegawaiController pc = new PegawaiController();
         pc.deletePegawai(System.Convert.ToInt32(textBox1.Text));
     }
     catch (FormatException fe)
     {
         MessageBox.Show("Pilih Data yang akan Dihapus");
     }
     textBox1.Clear();
     textBox2.Clear();
     comboBox1.ResetText();
     textBox3.Clear();
     textBox4.Clear();
     textBox5.Clear();
     textBox6.Clear();
 }