private void KhamBenhBtn_Click(object sender, RoutedEventArgs e) { try { if (DSLuotKhamListView.SelectedIndex == -1) { return; } ThongTinLuotKhamTab.IsEnabled = true; BenhNhan bn = DSLuotKhamListView.SelectedItem as BenhNhan; LuotKham lk = LuotKhamDAO.getLuotKhamBaseOnDateAndPatient(DateTime.Today.ToString("dd/MM/yyyy"), bn.CMND); Bussiness.currentLuotKhamID = -1; BenhComboBox.SelectedItem = lk.Benh; Bussiness.currentLuotKhamID = lk.ID; LuotKhamIDLabel.Content = "ID: " + lk.ID; BenhComboBox.SelectedItem = lk.Benh; if (!lk.Benh.Equals("")) { Benh b = BenhDAO.getBenh(lk.Benh); TrieuChungTxtBlock.Text = b.TrieuChung; } TienKhamTxtBlock.Text = "Tien kham: " + lk.TienKham.ToString(); TienThuocTxtBlock.Text = "Tien thuoc: " + lk.TienThuoc.ToString(); TongChiPhiTxtBlock.Text = "Tong chi phi: " + lk.ChiPhi.ToString(); UserInfoTxtBlock.Text = bn.HoTen; Bussiness.listLuotThuoc.Clear(); foreach (LuotThuoc lt in lk.LuotThuocs) { Bussiness.listLuotThuoc.Add(lt); } ThongTinLuotKhamTab.IsSelected = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public static int addOrUpdateBenh(string loaibenh, string trieuchung) { Benh benh = BenhDAO.getBenh(loaibenh); if (benh == null) { benh = new QuanLyPhongKham.Benh(); } benh.LoaiBenh = loaibenh; benh.TrieuChung = trieuchung; int res = BenhDAO.addOrUpdateBenh(loaibenh, benh); if (res == 1) { listAllBenh.Add(benh); } if (res == 0) { foreach (Benh b in listAllBenh) { if (b.LoaiBenh.Equals(loaibenh)) { b.TrieuChung = trieuchung; } } } return(res); }
private void BenhComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (Bussiness.currentLuotKhamID == -1) { return; } if ((BenhComboBox.SelectedItem as string).Equals("unidentified")) { Bussiness.updateLuotKham(Bussiness.currentLuotKhamID, "unidentified"); } Benh benh = BenhDAO.getBenh(BenhComboBox.SelectedItem as string); TrieuChungTxtBlock.Text = benh.TrieuChung; Bussiness.updateLuotKham(Bussiness.currentLuotKhamID, benh.LoaiBenh); }