public static int addOrUpdateBenhNhan(string CMND, string hoten, string sdt, string diachi, byte gioitinh) { BenhNhan bn = BenhNhanDAO.getBenhNhan(CMND); foreach (BenhNhan b in listBenhNhan) { if (b.CMND.Equals(CMND)) { b.hoten1 = hoten; b.sdt1 = sdt; b.diachi1 = diachi; b.gioitinh1 = gioitinh; } } if (bn == null) { bn = new BenhNhan(); } bn.CMND = CMND; bn.HoTen = hoten; bn.SDT = sdt; bn.DiaChi = diachi; bn.GioiTinh = gioitinh; return(BenhNhanDAO.addOrUpdateBenhNhan(CMND, bn)); }
public static bool addLuotKham(string benhnhan, string ngaykham) { LuotKham lk = new LuotKham(); BenhNhan bn = BenhNhanDAO.getBenhNhan(benhnhan); lk.BenhNhan = benhnhan; lk.TienKham = tienKham; lk.TienThuoc = 0; lk.NgayKham = ngaykham; lk.ID = currentLKID++; listBenhNhan.Add(bn); return(LuotKhamDAO.addLuotKham(lk)); }
private void HoaDonBtn_Click(object sender, RoutedEventArgs e) { try { if (DSLuotKhamListView.SelectedIndex == -1) { return; } StringBuilder builder = new StringBuilder(); LuotKham lk = LuotKhamDAO .getLuotKhamBaseOnDateAndPatient(DateTime.Today.ToString("dd/MM/yyyy") , (DSLuotKhamListView.SelectedItem as BenhNhan).CMND); builder.Append("-----HOA DON THANH TOAN-----"); builder.Append(Environment.NewLine); builder.Append("Thong tin benh nhan"); builder.Append(Environment.NewLine); BenhNhan bn = BenhNhanDAO.getBenhNhan(lk.BenhNhan); builder.Append(">Ho ten: " + bn.HoTen); builder.Append(Environment.NewLine); builder.Append(">So CMND: " + bn.CMND); builder.Append(Environment.NewLine); builder.Append("Thong tin kham benh:"); builder.Append(Environment.NewLine); builder.Append(">Ten benh: " + lk.Benh); builder.Append(Environment.NewLine); builder.Append("Ke toa thuoc:"); builder.Append(Environment.NewLine); ICollection <LuotThuoc> list = lk.LuotThuocs; foreach (LuotThuoc lt in list) { builder.Append(">"); builder.Append(lt.Thuoc); Thuoc thuoc = ThuocDAO.getThuoc(lt.Thuoc); builder.Append(" - "); builder.Append(lt.SoLuong + " " + thuoc.DonVi); builder.Append(" - "); builder.Append(lt.ChiPhi + "VND"); builder.Append(Environment.NewLine); } builder.Append("---------------------------" + Environment.NewLine); builder.Append("Tien kham: " + lk.TienKham); builder.Append(" + Tien thuoc: " + lk.TienThuoc); builder.Append(Environment.NewLine); builder.Append("Tong chi phi: " + lk.ChiPhi); TextDialog dialog = new TextDialog("Hoa don", builder.ToString()); dialog.ShowDialog(); }catch (Exception ex) { MessageBox.Show(ex.ToString()); } }