Beispiel #1
0
        private void LichSuXemBenhBtn_Click(object sender, RoutedEventArgs e)
        {
            Benh           b      = LuotKhamDAO.getLuotKham((LichSuKhamListView.SelectedItem as LuotKham).ID).Benh1;
            ThemBenhDialog dialog = new ThemBenhDialog(b, true);

            dialog.ShowDialog();
        }
Beispiel #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            bool isObserve = false;

            if (Bussiness.currentLuotKhamID == -1)
            {
                isObserve = true;
            }
            LuotThuoc lt = new LuotThuoc();

            lt.LuotKham = Bussiness.currentLuotKhamID;
            lt.Thuoc    = (ThemThuocListView.SelectedItem as Thuoc).TenThuoc;
            ThemLuotThuocDialog dialog = new ThemLuotThuocDialog(lt, isObserve);

            if (dialog.ShowDialog() == true)
            {
                try
                {
                    Bussiness.addLuotThuoc(lt.Thuoc, (int)lt.SoLuong);
                    LuotKham lk = LuotKhamDAO.getLuotKham(Bussiness.currentLuotKhamID);
                    TienKhamTxtBlock.Text          = "Tien kham: " + lk.TienKham.ToString();
                    TienThuocTxtBlock.Text         = "Tien thuoc: " + lk.TienThuoc.ToString();
                    TongChiPhiTxtBlock.Text        = "Tong chi phi: " + lk.ChiPhi.ToString();
                    ThongTinLuotKhamTab.IsSelected = true;
                }
                catch (Exception ex) { MessageBox.Show(ex.ToString()); }
            }
        }
Beispiel #3
0
        private void LichSuXemBNBtn_Click(object sender, RoutedEventArgs e)
        {
            BenhNhan           bn     = LuotKhamDAO.getLuotKham((LichSuKhamListView.SelectedItem as LuotKham).ID).BenhNhan1;
            ThemLuotKhamDialog dialog = new ThemLuotKhamDialog(bn, 2);

            dialog.ShowDialog();
        }
Beispiel #4
0
        public static bool removeLuotThuoc(int ID)
        {
            if (currentLuotKhamID == -1)
            {
                return(false);
            }
            LuotKham lk = LuotKhamDAO.getLuotKham(currentLuotKhamID);

            LuotThuoc lt = LuotThuocDAO.getLuotThuoc(ID);

            if (lt == null)
            {
                return(false);
            }
            lk.TienThuoc -= lt.ChiPhi;
            LuotKhamDAO.updateLuotKham(lk.ID, lk);
            foreach (LuotThuoc l in listLuotThuoc)
            {
                if (l.ID == ID)
                {
                    lt = l;
                    break;
                }
            }
            listLuotThuoc.Remove(lt);
            LuotThuocDAO.removeLuotThuoc(ID);
            return(true);
        }
Beispiel #5
0
        public static bool removeLuotKham(int ID)
        {
            LuotKham lk = LuotKhamDAO.getLuotKham(ID);

            if (lk == null)
            {
                return(false);
            }
            foreach (LuotThuoc lt in lk.LuotThuocs)
            {
                LuotThuocDAO.removeLuotThuoc(lt.ID);
            }

            BenhNhan temp = null;

            foreach (BenhNhan bn in listBenhNhan)
            {
                if (bn.CMND.Equals(lk.BenhNhan))
                {
                    temp = bn; break;
                }
            }
            listBenhNhan.Remove(temp);
            LuotKhamDAO.removeLuotKham(ID);
            if (currentLuotKhamID == ID)
            {
                currentLuotKhamID = -1;
            }
            return(true);
        }
Beispiel #6
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            Bussiness.removeLuotThuoc((LuotThuocListView.SelectedItem as LuotThuoc).ID);
            LuotKham lk = LuotKhamDAO.getLuotKham(Bussiness.currentLuotKhamID);

            TienKhamTxtBlock.Text   = "Tien kham: " + lk.TienKham.ToString();
            TienThuocTxtBlock.Text  = "Tien thuoc: " + lk.TienThuoc.ToString();
            TongChiPhiTxtBlock.Text = "Tong chi phi: " + lk.ChiPhi.ToString();
        }
Beispiel #7
0
        public static void addLuotThuoc(string thuoc, int soLuong)
        {
            if (currentLuotKhamID == -1)
            {
                return;
            }
            int      check = -1;
            LuotKham lk;

            foreach (Thuoc th in listAllThuoc)
            {
                if (th.TenThuoc.Equals(thuoc))
                {
                    check = 0;
                    break;
                }
            }
            if (check == -1)
            {
                return;
            }
            else
            {
                lk = LuotKhamDAO.getLuotKham(currentLuotKhamID);
                IList <LuotThuoc> list = lk.LuotThuocs.ToList();
                foreach (LuotThuoc lth in list)
                {
                    if (lth.Thuoc.Equals(thuoc))
                    {
                        lk.TienThuoc += soLuong * ThuocDAO.getThuoc(thuoc).DonGia;
                        LuotKhamDAO.updateLuotKham(lk.ID, lk);
                        updateLuotThuoc(lth.ID, soLuong);
                        return;
                    }
                }
            }
            LuotThuoc lt = new LuotThuoc();

            lt.ID         = currentLTID++;
            lt.LuotKham   = currentLuotKhamID;
            lt.SoLuong    = soLuong;
            lt.Thuoc      = thuoc;
            lt.ChiPhi     = lt.SoLuong * ThuocDAO.getThuoc(thuoc).DonGia;
            lk.TienThuoc += lt.ChiPhi;
            listLuotThuoc.Add(lt);
            LuotKhamDAO.updateLuotKham(lk.ID, lk);
            LuotThuocDAO.addLuotThuoc(lt);
        }
Beispiel #8
0
        public static void updateLuotKham(int ID, string benh)
        {
            LuotKham lk = LuotKhamDAO.getLuotKham(ID);

            if (lk == null)
            {
                return;
            }
            lk.Benh = benh;
            LuotKhamDAO.updateLuotKham(ID, lk);

            /*foreach (LuotThuoc lt in lk.LuotThuocs)
             * {
             *  LuotKhamDAO.updateLuotKham(ID,lk);
             * }*/
        }
Beispiel #9
0
        private void UpdateUserInfoBtn_Click(object sender, RoutedEventArgs e)
        {
            BenhNhan           bn     = LuotKhamDAO.getLuotKham(Bussiness.currentLuotKhamID).BenhNhan1;
            ThemLuotKhamDialog dialog = new ThemLuotKhamDialog(bn, 1);

            if (dialog.ShowDialog() == true)
            {
                Bussiness.addOrUpdateBenhNhan(bn.CMND, bn.HoTen, bn.SDT, bn.DiaChi, (byte)bn.GioiTinh);
                UserInfoTxtBlock.Text = bn.HoTen;
                foreach (BenhNhan b in Bussiness.listBenhNhan)
                {
                    if (b.CMND.Equals(bn.CMND))
                    {
                        b.diachi1   = bn.DiaChi;
                        b.sdt1      = bn.SDT;
                        b.gioitinh1 = (byte)bn.GioiTinh;
                        b.hoten1    = bn.HoTen;
                    }
                }
            }
        }
Beispiel #10
0
        private void LichSuXemThuocBtn_Click(object sender, RoutedEventArgs e)
        {
            ICollection <LuotThuoc> list = LuotKhamDAO
                                           .getLuotKham((LichSuKhamListView.SelectedItem as LuotKham).ID).LuotThuocs;
            StringBuilder builder = new StringBuilder();

            builder.Append("Ke toa thuoc: ");
            builder.Append(Environment.NewLine);
            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);
            }
            TextDialog dialog = new TextDialog("Toa thuoc", builder.ToString());

            dialog.ShowDialog();
        }