Ejemplo n.º 1
0
 private void CommandBinding_CanExecute_Them(object sender, CanExecuteRoutedEventArgs e)
 {
     if (txtMaBenhNhan.Text != "" && txtHoTen.Text != "" && xl.tim(txtMaBenhNhan.Text) == null)
     {
         e.CanExecute = true;
     }
 }
Ejemplo n.º 2
0
        private void CommandBinding_Executed_LapPhieuDKKham(object sender, ExecutedRoutedEventArgs e)
        {
            PhieuDKKham      pdkk    = new PhieuDKKham();
            PhieuSDDV        psddv   = new PhieuSDDV();
            List <PhieuSDDV> dsPSDDV = new List <PhieuSDDV>();

            pdkk.MaPhieuDKK = txtMaPDDK.Text;
            pdkk.TrieuChung = txtTrieuChung.Text.ToString();
            pdkk.NgayLap    = DateTime.Now;
            BenhNhan bn = (BenhNhan)xlBN.tim(txtMaBenhNhan.Text.ToString());

            if (bn != null)
            {
                pdkk.BenhNhan = bn;
            }
            NhanVien nv = (NhanVien)xlNV.TimMa(txtNhanVienLP.Text.ToString());

            if (nv != null)
            {
                pdkk.NhanVien = nv;
            }
            if (dsCTDKPK != null)
            {
                foreach (CTDKPhongKham b in dsCTDKPK)
                {
                    //b.PhieuDKKham = a;
                    //b.PhieuDKKID = pdkk.IDPhieuDKK;
                    pdkk.CTDKPhongKham.Add(b);
                }
            }
            decimal tt = 0;

            if (dsCTDKDV != null)
            {
                foreach (CTDKDichVu b in dsCTDKDV)
                {
                    psddv.CTDKDichVu.Add(b);
                    //b.PhieuSDDV = a;
                    //b.PhieuSDDVID = a.IDPhieuSDDV;
                    tt += b.DichVu.DonGiaDichVu.Value;
                }
            }
            psddv.TongTien    = tt;
            psddv.MaPhieuSDDV = xlPSDDV.taoMaPK().ToString();
            psddv.NgayLap     = pdkk.NgayLap;
            psddv.NhanVien    = pdkk.NhanVien;
            dsPSDDV.Add(psddv);

            pdkk.PhieuSDDV.AddRange(dsPSDDV);

            xlPDDK.Them(pdkk);


            //Common.maPhieuDDK = txtMaPDDK.Text.ToString();
            //QLPhieuSDDV f = new QLPhieuSDDV();
            //f.ShowDialog();
            //dgSDDV.ItemsSource = xlPDDK.getDSCTPhieuSDDV(txtMaPDDK.Text.ToString()).ToList();

            clearControl();
            MessageBox.Show("Lập PDKK thành công!");
        }