private void button1_Click(object sender, EventArgs e) { using (HospitalEntities context = new HospitalEntities()) { try { int result = (int)(context.GetNewAdminId().FirstOrDefault()); if (result > -1) { Admin p = new Admin() { Id_Admin = result, Id_pegawai = System.Convert.ToInt32(textBox2.Text), User_name = textBox3.Text, Password = textBox4.Text, }; AdminController pc = new AdminController(); pc.addAdmin(p); } } catch (FormatException) { MessageBox.Show("Data harus teriisi semua"); } } }
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 button3_Click(object sender, EventArgs e) { try { using (HospitalEntities context = new HospitalEntities()) { int result = (int)(context.GetNewKamarId().FirstOrDefault()); if (result > -1) { Kamar p = new Kamar() { Id_Room = result, Nama_Kamar = textBox2.Text, Harga_Sewa = System.Convert.ToInt32(textBox5.Text), Status_Kamar = System.Convert.ToByte(comboBox1.Text) }; RoomController rc = new RoomController(); rc.addRoom(p); } } } catch (FormatException fe) { MessageBox.Show("Data Harus Terisi semua"); } textBox1.Clear(); textBox2.Clear(); textBox5.Clear(); comboBox1.ResetText(); }
private void button1_Click(object sender, EventArgs e) { using (HospitalEntities context = new HospitalEntities()) { try { int result = (int)(context.GetNewAdminId().FirstOrDefault()); if (result > -1) { Admin p = new Admin() { Id_Admin = result, Id_pegawai = System.Convert.ToInt32(textBox2.Text), User_name = textBox3.Text, Password = textBox4.Text, }; AdminController pc = new AdminController(); pc.addAdmin(p); } } catch (FormatException) { MessageBox.Show("Data harus teriisi semua"); } } }
private void button2_Click(object sender, EventArgs e) { using (HospitalEntities context = new HospitalEntities()) { int result = (int)(context.GetNewPeriksaId().FirstOrDefault()); if (result > -1) { try { Periksa p = new Periksa() { No_Pemeriksaan = result, id_Pegawai = System.Convert.ToInt32(textBox3.Text), id_Pasien = System.Convert.ToInt32(textBox2.Text), Penyakit_Akhir = textBox4.Text, Tarif = System.Convert.ToInt32(textBox6.Text), Status_Rawat = comboBox1.Text }; PeriksaController rc = new PeriksaController(); rc.addPemeriksaan(p); } catch (FormatException fe) { MessageBox.Show("Data Harus teriisi semua"); } } } }
private void button3_Click(object sender, EventArgs e) { try { using (HospitalEntities context = new HospitalEntities()) { int result = (int)(context.GetNewKamarId().FirstOrDefault()); if (result > -1) { Kamar p = new Kamar() { Id_Room = result, Nama_Kamar = textBox2.Text, Harga_Sewa = System.Convert.ToInt32(textBox5.Text), Status_Kamar = System.Convert.ToByte(comboBox1.Text) }; RoomController rc = new RoomController(); rc.addRoom(p); } } } catch (FormatException fe) { MessageBox.Show("Data Harus Terisi semua"); } textBox1.Clear(); textBox2.Clear(); textBox5.Clear(); comboBox1.ResetText(); }
private void button2_Click(object sender, EventArgs e) { using (HospitalEntities context = new HospitalEntities()) { int result = (int)(context.GetNewPatientId().FirstOrDefault()); if (result > -1) { try { Patient p = new Patient() { Id_Pasien = result, Nama_Pasien = textBox3.Text, Penyakit = textBox9.Text, Jenis_pasien = comboBox3.Text, Golongan_Darah = comboBox2.Text, Jenis_Kelamin = comboBox1.Text, Tgl_Lahir = dateTimePicker2.Value, Alamat_Pasien = textBox4.Text, Kota_Pasien = textBox5.Text, No_KTP = System.Convert.ToInt32(textBox8.Text), No_Hp = System.Convert.ToInt32(textBox7.Text), Pekerjaan = textBox6.Text, Tgl_Masuk = dateTimePicker3.Value, ID_Room = System.Convert.ToInt32(textBox1.Text) }; PasienController pc = new PasienController(); pc.AddPasien(p); //int stat = System.Convert.ToInt32(textBox1.Text); //if (System.Convert.ToInt32(textBox1.Text) != null) //{ /* Kamar k = new Kamar() * { * Id_Room = System.Convert.ToInt32(textBox1.Text), * Status_Kamar = 1 * }; * */ RoomController rc = new RoomController(); rc.updateStatus(p); //} MessageBox.Show(textBox1.Text); } catch (FormatException fe) { MessageBox.Show("Data harus terisi semua"); } } } }
private void button2_Click(object sender, EventArgs e) { using (HospitalEntities context = new HospitalEntities()) { int result = (int)(context.GetNewPatientId().FirstOrDefault()); if (result > -1) { try { Patient p = new Patient() { Id_Pasien = result, Nama_Pasien = textBox3.Text, Penyakit = textBox9.Text, Jenis_pasien = comboBox3.Text, Golongan_Darah = comboBox2.Text, Jenis_Kelamin = comboBox1.Text, Tgl_Lahir = dateTimePicker2.Value, Alamat_Pasien = textBox4.Text, Kota_Pasien = textBox5.Text, No_KTP = System.Convert.ToInt32(textBox8.Text), No_Hp = System.Convert.ToInt32(textBox7.Text), Pekerjaan = textBox6.Text, Tgl_Masuk = dateTimePicker3.Value, ID_Room = System.Convert.ToInt32(textBox1.Text) }; PasienController pc = new PasienController(); pc.AddPasien(p); //int stat = System.Convert.ToInt32(textBox1.Text); //if (System.Convert.ToInt32(textBox1.Text) != null) //{ /* Kamar k = new Kamar() { Id_Room = System.Convert.ToInt32(textBox1.Text), Status_Kamar = 1 }; * */ RoomController rc = new RoomController(); rc.updateStatus(p); //} MessageBox.Show(textBox1.Text); } catch (FormatException fe) { MessageBox.Show("Data harus terisi semua"); } } } }
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) { using (HospitalEntities context = new HospitalEntities()) { int result = (int)(context.GetNewPeriksaId().FirstOrDefault()); if (result > -1) { try { Periksa p = new Periksa() { No_Pemeriksaan = result, id_Pegawai = System.Convert.ToInt32(textBox3.Text), id_Pasien = System.Convert.ToInt32(textBox2.Text), Penyakit_Akhir = textBox4.Text, Tarif = System.Convert.ToInt32(textBox6.Text), Status_Rawat = comboBox1.Text }; PeriksaController rc = new PeriksaController(); rc.addPemeriksaan(p); } catch (FormatException fe) { MessageBox.Show("Data Harus teriisi semua"); } } } }