private void getDS()
        {
            ////clearControl();
            dg.ItemsSource = xlDT.getDSDonThuocByDS(xlDT.getDSDonThuoc()).ToList();
            //dg.ItemsSource = xlDT.getDSDonThuoc();
            dg.SelectedValuePath = "MaDonThuoc";

            //cmbThuoc.ItemsSource = xlDV.TimMaDV(Common.ConvertToInt(cmbLoaiThuoc.SelectedValue));
            cmbThuoc.ItemsSource       = xlT.getDSThuocFirstNull();
            cmbThuoc.DisplayMemberPath = "TenThuoc";
            cmbThuoc.SelectedValuePath = "IDThuoc";
            cmbThuoc.SelectedIndex     = 0;

            dgCTT.SelectedValuePath = "ThuocID";
            //dgCTDKPK.SelectedValuePath = "PhongKhamID";

            //txtMaPDDK.Text = xlT.taoMaPK();
            //dpNgayLap.Text = DateTime.Now.ToShortDateString();

            //if (Common.maBenhNhan != null)
            //{
            //    txtMaBenhNhan.Text = Common.maBenhNhan.ToString();
            //    epdLPDKK.IsExpanded = true;
            //    txtTenBenhNhan.Text = Common.objBenhNhanM.HoTen.ToString();
            //}
            //if (Common.maNhanVien != null)
            //{
            //    txtNhanVienLP.Text = Common.maNhanVien.ToString();
            //    epdLPDKK.IsExpanded = true;
            //}

            txtMaDT.Text           = xlDT.taoMa().ToString();
            dpNgayLap.SelectedDate = DateTime.Now;
            //test
            if (Common.maNhanVien != null)
            {
                txtNhanVienLP.Text = Common.maNhanVien.ToString();
            }
            txtNhanVienLP.Text      = "bhvu";
            txtMaPhieuKhamBenh.Text = "TRO";
        }
Exemplo n.º 2
0
        private void CommandBinding_Executed_LapPhieuKhamBenh(object sender, ExecutedRoutedEventArgs e)
        {
            if (MessageBox.Show("Xác nhận?", "Cảnh báo!", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
            {
                return;
            }
            else
            {
                PhieuKhamBenh pkb = new PhieuKhamBenh();

                pkb.MaPhieuKB = txtMaPKB.Text;
                pkb.ChanDoan  = txtChanDoan.Text.ToString();
                pkb.NgayLap   = DateTime.Now;
                PhieuDKKham pdkk = (PhieuDKKham)xlPDKK.Tim(txtMaPDKK.Text.ToString());
                if (pdkk != null)
                {
                    //MessageBox.Show(pdkk.IDPhieuDKK.ToString());
                    //psddv.PhieuDKKID = pdkk.IDPhieuDKK;
                    pkb.PhieuDKKham = pdkk;
                }
                NhanVien nv = (NhanVien)xlNV.TimMa(txtNhanVienLP.Text.ToString());
                if (nv != null)
                {
                    pkb.NhanVien = nv;
                }
                decimal tt = 0;
                if (dsCTDT != null && dsCTDT.Count > 0)
                {
                    DonThuoc        dt   = new DonThuoc();
                    List <DonThuoc> dsDT = new List <DonThuoc>();
                    foreach (CTDonThuoc b in dsCTDT)
                    {
                        dt.CTDonThuoc.Add(b);
                        tt += b.Thuoc.DonGiaThuoc.Value;
                    }
                    dt.TongTien   = tt;
                    dt.MaDonThuoc = xlDT.taoMa().ToString();
                    dt.NgayLap    = pkb.NgayLap;
                    //dt.PhieuKhamBenh.NhanVien = pkb.NhanVien;
                    dsDT.Add(dt);
                    pkb.DonThuoc.AddRange(dsDT);
                }

                xlPKB.Them(pkb);
                clearControl(); getDS();
                MessageBox.Show("Lập PKB thành công!");
                this.Close();
            }
        }