public UpdateRekamMedis() { InitializeComponent(); mrm = new ModelRekamMedis(int.Parse(" "), " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "); DataContext = mrm; conn = DBConnection.dbConnection(); }
public UpdateRekamMedis(string no_rm, ViewRekamMedis vrm) { InitializeComponent(); this.no_rm = no_rm; conn = DBConnection.dbConnection(); this.vrm = vrm; txtRekamMedis.Text = no_rm; mrm = new ModelRekamMedis(0, " ", " ", " ", " ", " ", " ", " ", " ", " ", DateTime.Now.ToShortDateString(), " ", " ", " "); DataContext = mrm; }
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { mrm = new ModelRekamMedis(0, " ", " ", " ", " ", " ", " ", " ", " ", " ", DateTime.Now.ToShortDateString(), " ", " ", " "); var cmd = new DBCommand(conn); var no_rm = txtRekamMedis.Text; var riwayat_penyakit = txtRiwayat.Text; var berat_badan = txtBeratBadan.Text; var alergi = txtAlergi.Text; var keluhan = textKeluhan.Text; var diagnosa = textDiagnosa.Text; var tindakan = textTindakan.Text; var id_dokter = Settings.Default.KodeDokter; var kode_poli = cmd.GetKodePoli(); cmd.CloseConnection(); if (CheckTextBox()) { if (cmd.UpdateDataRekamMedis(no_rm, riwayat_penyakit, alergi, berat_badan, keluhan, diagnosa, tindakan, id_dokter, kode_poli)) { MessageBox.Show("Rekam medis berhasil di update.", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information); DataContext = mrm; vrm.DisplayDataPasien(no_rm); Close(); } else { MessageBox.Show("Rekam medis gagal di update.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("Pastikan data yang diinputkan sudah benar.", "Perhatian", MessageBoxButton.OK, MessageBoxImage.Warning); } e.Handled = true; }
private void AddRekamMedis_Executed(object sender, ExecutedRoutedEventArgs e) { mrm = new ModelRekamMedis(0, " ", " ", " ", " ", " ", " ", " ", " ", " ", DateTime.Now.ToShortDateString(), " ", " ", " "); var cmd = new DBCommand(conn); var lstDiagnosa = txtKodeDiagnosis.Text.Split(';').ToArray(); var lstTindakan = txtKodeTindakan.Text.Split(';').ToArray(); var riwayat_penyakit = ""; if (txtRiwayat.Text == string.Empty) { riwayat_penyakit = "-"; } else { riwayat_penyakit = txtRiwayat.Text; } var no_rm = txtRekamMedis.Text; var berat_badan = txtBeratBadan.Text; var alergi = txtAlergi.Text; var keluhan = textKeluhan.Text; var diagnosa = ""; var tindakan = ""; var id_dokter = Settings.Default.KodeDokter; var kode_poli = cmd.GetKodePoli(); cmd.CloseConnection(); var res = false; if (CheckTextBox()) { if (!Regex.IsMatch(berat_badan, "^[A-Za-z]+$")) { for (var i = 0; i < lstDiagnosa.Length - 1; i++) { diagnosa = lstDiagnosa[i]; for (var j = 0; j < lstTindakan.Length - 1; j++) { if (string.IsNullOrEmpty(alergi)) { alergi = "-"; } tindakan = lstTindakan[j]; if (cmd.InsertDataRekamMedis(no_rm, riwayat_penyakit, alergi, berat_badan, keluhan, diagnosa, tindakan, id_dokter, kode_poli)) { res = true; } else { res = false; break; } } } if (res) { MessageBox.Show("Rekam medis berhasil di tambahkan.", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Rekam medis gagal di tambahkan.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } DataContext = mrm; vmr.DisplayDataPasien(no_rm); Close(); } else { MessageBox.Show("Berat badan harus berupa angka.", "Perhatian", MessageBoxButton.OK, MessageBoxImage.Warning); } } else { MessageBox.Show("Pastikan data yang diinputkan sudah benar.", "Perhatian", MessageBoxButton.OK, MessageBoxImage.Warning); } e.Handled = true; }