public bool IsConnected() { try { dataContext = new DCMedismartToolsDataContext(Medismart_Tools.Properties.Settings.Default.CS); dataContext.Connection.Open(); return(true); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
public Koneksi() { try { dataSource = Medismart_Tools.Properties.Settings.Default.DataSource; initialCatalog = Medismart_Tools.Properties.Settings.Default.InitialCatalog; userID = Medismart_Tools.Properties.Settings.Default.UserID; password = Medismart_Tools.Properties.Settings.Default.Password; dataContext = new DCMedismartToolsDataContext(Medismart_Tools.Properties.Settings.Default.CS); connection = Medismart_Tools.Properties.Settings.Default.CS; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void cariPasien(string nomorMR) { Koneksi koneksi = new Koneksi(); DCMedismartToolsDataContext context = koneksi.DataContext; try { pasien = (from pasien_ in context.PASIENs where pasien_.KD_PASIEN == nomorMR select pasien_).FirstOrDefault(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void BukaTransaksiNonRWI(string kodeUnit, string nomorTransaksi, DateTime tglKunjungan) { Koneksi koneksi = new Koneksi(); DCMedismartToolsDataContext context = koneksi.DataContext; TransactionScope transactionScope = new TransactionScope(); using (transactionScope) { try { var selectedKunjungan = (from k in context.KUNJUNGANs where k.KD_PASIEN == pasien.KD_PASIEN && k.TGL_MASUK == tglKunjungan select k ).FirstOrDefault(); var selectedTransaksi = (from transaksi in context.TRANSAKSIs where transaksi.KD_PASIEN == pasien.KD_PASIEN && transaksi.NO_TRANSAKSI == nomorTransaksi select transaksi ).FirstOrDefault(); selectedKunjungan.TGL_KELUAR = null; selectedKunjungan.JAM_KELUAR = null; selectedTransaksi.CO_STATUS = false; selectedTransaksi.TGL_CO = null; context.SubmitChanges(); transactionScope.Complete(); MessageBox.Show("Transaksi sudah dibuka", "Information"); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { context.Dispose(); transactionScope.Dispose(); } } }
public ArrayList cariKunjungan() { Koneksi koneksi = new Koneksi(); DCMedismartToolsDataContext context = koneksi.DataContext; ArrayList nilaiBalikan = new ArrayList(); switch (namaForm) { case "Ganti Tanggal Kunjungan RWJ": var selectedKunjunganRWJ = (from selectedKunjungan_ in context.KUNJUNGANs join selectedTransaksi in context.TRANSAKSIs on new { selectedKunjungan_.KD_PASIEN, selectedKunjungan_.TGL_MASUK.Date, selectedKunjungan_.KD_UNIT } equals new { selectedTransaksi.KD_PASIEN, selectedTransaksi.TGL_TRANSAKSI.Date, selectedTransaksi.KD_UNIT } join selectedUnit in context.UNITs on selectedKunjungan_.KD_UNIT equals selectedUnit.KD_UNIT join selectedCustomer in context.CUSTOMERs on selectedKunjungan_.KD_CUSTOMER equals selectedCustomer.KD_CUSTOMER join selectedDokter in context.DOKTERs on selectedKunjungan_.KD_DOKTER equals selectedDokter.KD_DOKTER where selectedKunjungan_.KD_PASIEN == pasien.KD_PASIEN && selectedUnit.KD_BAGIAN == 2 orderby selectedKunjungan_.TGL_MASUK descending, selectedKunjungan_.JAM_MASUK descending select new { selectedTransaksi.NO_TRANSAKSI, selectedUnit.NAMA_UNIT, selectedKunjungan_.TGL_MASUK, selectedKunjungan_.JAM_MASUK, selectedKunjungan_.TGL_KELUAR, selectedKunjungan_.JAM_KELUAR, selectedCustomer.CUSTOMER1, selectedDokter.NAMA, selectedUnit.KD_UNIT, }).ToList(); foreach (var nilai in selectedKunjunganRWJ) { nilaiBalikan.Add(nilai); } break; case "Ganti Tanggal Kunjungan RWI": var selectedKunjunganRWI = (from selectedKunjungan_ in context.KUNJUNGANs join selectedTransaksi in context.TRANSAKSIs on new { selectedKunjungan_.KD_PASIEN, selectedKunjungan_.TGL_MASUK.Date, selectedKunjungan_.KD_UNIT } equals new { selectedTransaksi.KD_PASIEN, selectedTransaksi.TGL_TRANSAKSI.Date, selectedTransaksi.KD_UNIT } join selectedUnit in context.UNITs on selectedKunjungan_.KD_UNIT equals selectedUnit.KD_UNIT join selectedCustomer in context.CUSTOMERs on selectedKunjungan_.KD_CUSTOMER equals selectedCustomer.KD_CUSTOMER join selectedDokter in context.DOKTERs on selectedKunjungan_.KD_DOKTER equals selectedDokter.KD_DOKTER where selectedKunjungan_.KD_PASIEN == pasien.KD_PASIEN && selectedUnit.KD_BAGIAN == 1 orderby selectedKunjungan_.TGL_MASUK descending, selectedKunjungan_.JAM_MASUK descending select new { selectedTransaksi.NO_TRANSAKSI, selectedUnit.NAMA_UNIT, selectedKunjungan_.TGL_MASUK, selectedKunjungan_.JAM_MASUK, selectedKunjungan_.TGL_KELUAR, selectedKunjungan_.JAM_KELUAR, selectedCustomer.CUSTOMER1, selectedDokter.NAMA, selectedUnit.KD_UNIT, }).ToArray(); foreach (var nilai in selectedKunjunganRWI) { nilaiBalikan.Add(nilai); } break; case "Ganti Tanggal Kunjungan IGD": var selectedKunjunganIGD = (from selectedKunjungan_ in context.KUNJUNGANs join selectedTransaksi in context.TRANSAKSIs on new { selectedKunjungan_.KD_PASIEN, selectedKunjungan_.TGL_MASUK.Date, selectedKunjungan_.KD_UNIT } equals new { selectedTransaksi.KD_PASIEN, selectedTransaksi.TGL_TRANSAKSI.Date, selectedTransaksi.KD_UNIT } join selectedUnit in context.UNITs on selectedKunjungan_.KD_UNIT equals selectedUnit.KD_UNIT join selectedCustomer in context.CUSTOMERs on selectedKunjungan_.KD_CUSTOMER equals selectedCustomer.KD_CUSTOMER join selectedDokter in context.DOKTERs on selectedKunjungan_.KD_DOKTER equals selectedDokter.KD_DOKTER where selectedKunjungan_.KD_PASIEN == pasien.KD_PASIEN && selectedUnit.KD_BAGIAN == 3 orderby selectedKunjungan_.TGL_MASUK descending, selectedKunjungan_.JAM_MASUK descending select new { selectedTransaksi.NO_TRANSAKSI, selectedUnit.NAMA_UNIT, selectedKunjungan_.TGL_MASUK, selectedKunjungan_.JAM_MASUK, selectedKunjungan_.TGL_KELUAR, selectedKunjungan_.JAM_KELUAR, selectedCustomer.CUSTOMER1, selectedDokter.NAMA, selectedUnit.KD_UNIT, }).ToArray(); foreach (var nilai in selectedKunjunganIGD) { nilaiBalikan.Add(nilai); } break; case "Ganti Tanggal Kunjungan Laboratorium": var selectedKunjunganLAB = (from selectedKunjungan_ in context.KUNJUNGANs join selectedTransaksi in context.TRANSAKSIs on new { selectedKunjungan_.KD_PASIEN, selectedKunjungan_.TGL_MASUK.Date, selectedKunjungan_.KD_UNIT } equals new { selectedTransaksi.KD_PASIEN, selectedTransaksi.TGL_TRANSAKSI.Date, selectedTransaksi.KD_UNIT } join selectedUnit in context.UNITs on selectedKunjungan_.KD_UNIT equals selectedUnit.KD_UNIT join selectedCustomer in context.CUSTOMERs on selectedKunjungan_.KD_CUSTOMER equals selectedCustomer.KD_CUSTOMER join selectedDokter in context.DOKTERs on selectedKunjungan_.KD_DOKTER equals selectedDokter.KD_DOKTER where selectedKunjungan_.KD_PASIEN == pasien.KD_PASIEN && selectedUnit.KD_BAGIAN == 4 orderby selectedKunjungan_.TGL_MASUK descending, selectedKunjungan_.JAM_MASUK descending select new { selectedTransaksi.NO_TRANSAKSI, selectedUnit.NAMA_UNIT, selectedKunjungan_.TGL_MASUK, selectedKunjungan_.JAM_MASUK, selectedKunjungan_.TGL_KELUAR, selectedKunjungan_.JAM_KELUAR, selectedCustomer.CUSTOMER1, selectedDokter.NAMA, selectedUnit.KD_UNIT, }).ToArray(); foreach (var nilai in selectedKunjunganLAB) { nilaiBalikan.Add(nilai); } break; case "Ganti Tanggal Kunjungan Radiologi": var selectedKunjunganRAD = (from selectedKunjungan_ in context.KUNJUNGANs join selectedTransaksi in context.TRANSAKSIs on new { selectedKunjungan_.KD_PASIEN, selectedKunjungan_.TGL_MASUK.Date, selectedKunjungan_.KD_UNIT } equals new { selectedTransaksi.KD_PASIEN, selectedTransaksi.TGL_TRANSAKSI.Date, selectedTransaksi.KD_UNIT } join selectedUnit in context.UNITs on selectedKunjungan_.KD_UNIT equals selectedUnit.KD_UNIT join selectedCustomer in context.CUSTOMERs on selectedKunjungan_.KD_CUSTOMER equals selectedCustomer.KD_CUSTOMER join selectedDokter in context.DOKTERs on selectedKunjungan_.KD_DOKTER equals selectedDokter.KD_DOKTER where selectedKunjungan_.KD_PASIEN == pasien.KD_PASIEN && selectedUnit.KD_BAGIAN == 5 orderby selectedKunjungan_.TGL_MASUK descending, selectedKunjungan_.JAM_MASUK descending select new { selectedTransaksi.NO_TRANSAKSI, selectedUnit.NAMA_UNIT, selectedKunjungan_.TGL_MASUK, selectedKunjungan_.JAM_MASUK, selectedKunjungan_.TGL_KELUAR, selectedKunjungan_.JAM_KELUAR, selectedCustomer.CUSTOMER1, selectedDokter.NAMA, selectedUnit.KD_UNIT, }).ToArray(); foreach (var nilai in selectedKunjunganRAD) { nilaiBalikan.Add(nilai); } break; default: break; } return(nilaiBalikan); }
public void BukaTransaksiRWI(string kodeUnit, string nomorTransaksi, DateTime tanggalMasuk) { Koneksi koneksi = new Koneksi(); DCMedismartToolsDataContext context = koneksi.DataContext; TransactionScope transactionScope = new TransactionScope(); KUNJUNGAN selectedKunjungan; TRANSAKSI selectedTransaksi; NGINAP selectedNginap; using (transactionScope) { try { selectedKunjungan = (from k in context.KUNJUNGANs where k.KD_PASIEN == pasien.KD_PASIEN && k.TGL_MASUK.Date == tanggalMasuk.Date select k ).FirstOrDefault(); selectedTransaksi = (from transaksi in context.TRANSAKSIs where transaksi.KD_PASIEN == pasien.KD_PASIEN && transaksi.KD_UNIT == kodeUnit && transaksi.NO_TRANSAKSI == nomorTransaksi && transaksi.CO_STATUS == true select transaksi ).FirstOrDefault(); selectedNginap = (from nginap in context.NGINAPs where nginap.KD_PASIEN == pasien.KD_PASIEN && nginap.TGL_INAP == selectedTransaksi.TGL_TRANSAKSI && nginap.TGL_KELUAR == selectedTransaksi.TGL_CO select nginap ).FirstOrDefault(); KAMAR_INDUK selectedKamarInduk = (from kamarInduk in context.KAMAR_INDUKs where kamarInduk.NO_KAMAR == selectedNginap.NO_KAMAR select kamarInduk ).FirstOrDefault(); selectedKunjungan.TGL_KELUAR = null; selectedKunjungan.JAM_KELUAR = null; selectedTransaksi.CO_STATUS = false; selectedTransaksi.TGL_CO = null; selectedNginap.TGL_KELUAR = null; selectedNginap.JAM_KELUAR = null; selectedNginap.AKHIR = true; PASIEN_INAP pasienInap = new PASIEN_INAP(); pasienInap.KD_KASIR = "02"; pasienInap.KD_UNIT = kodeUnit; pasienInap.NO_TRANSAKSI = selectedTransaksi.NO_TRANSAKSI; pasienInap.NO_KAMAR = selectedNginap.NO_KAMAR; pasienInap.KD_SPESIAL = selectedNginap.KD_SPESIAL; context.PASIEN_INAPs.InsertOnSubmit(pasienInap); selectedKamarInduk.DIGUNAKAN++; context.SubmitChanges(); transactionScope.Complete(); MessageBox.Show("Transaksi sudah dibuka", "Information"); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { context.Dispose(); transactionScope.Dispose(); } } }