Пример #1
0
        public bool xoa(LapPhieuKhamDTO dsdto)
        {
            bool re = dsdal.xoa(dsdto);

            return(re);
        }
Пример #2
0
        private void bt_luu_Click(object sender, EventArgs e)
        {
            if (flag == "Sửa")
            {
                LapPhieuKhamDTO pk = new LapPhieuKhamDTO();
                pk.MaPK1 = tB_MaPK.Text;
                pk.MaLB1 = comboBox_LoaiBenh.Text.Substring(1, 4);

                pk.MaBS1 = comboBox_TenBS.Text.Substring(1, 5);
                DateTime a = (DateTime)dateTimePicker1.Value;
                pk.NgayKham1 = (DateTime)dateTimePicker1.Value;


                LapPhieuKhamBUS pkbus = new LapPhieuKhamBUS();
                bool            kq    = pkbus.sua(pk);
                if (kq == true)
                {
                    MessageBox.Show("Thêm bệnh nhân thành công");
                    pkbus = new LapPhieuKhamBUS();
                    List <LapPhieuKhamDTO> listdanhsach = pkbus.select();
                    loadDsPK(listdanhsach);
                }
                else
                {
                    MessageBox.Show("Thêm bệnh nhân thất bại");
                }
            }
            else if (flag == "Xóa")
            {
                LapPhieuKhamDTO pk = new LapPhieuKhamDTO();
                pk.MaPK1 = tB_MaPK.Text;



                LapPhieuKhamBUS pkbus = new LapPhieuKhamBUS();
                bool            kq    = pkbus.xoa(pk);
                if (kq == true)
                {
                    MessageBox.Show("Xóa  thành công");
                    pkbus = new LapPhieuKhamBUS();
                    List <LapPhieuKhamDTO> listdanhsach = pkbus.select();
                    loadDsPK(listdanhsach);
                }
                else
                {
                    MessageBox.Show("Xóa  thất bại");
                }
            }
            else if (flag == "them")
            {
                PhieuKhamDTO pk = new PhieuKhamDTO();
                pk.MaPK1     = TaoMaTuDong("PK");
                pk.MaBN1     = tB_mabn.Text;
                pk.NgayKham1 = dateTimePicker1.Value.Date;
                pk.MaLB1     = comboBox_LoaiBenh.Text.Substring(1, 4);
                pk.MaNV1     = comboBox_TenBS.Text.Substring(1, 5);
                pk.NgayKham1 = dateTimePicker1.Value;


                PhieuKhamBUS pk1bus = new PhieuKhamBUS();
                bool         kq     = pk1bus.them(pk);
                if (kq == true)
                {
                    MessageBox.Show("Thêm  thành công");
                }
                else
                {
                    MessageBox.Show("Thêm  thất bại");
                }
            }
            dataGridView1.Enabled     = true;
            bt_sua.Visible            = true;
            bt_luu.Visible            = false;
            bt_Huy.Visible            = false;
            comboBox_TenBS.Enabled    = false;
            comboBox_LoaiBenh.Enabled = false;
            load();
        }