public frmKhamThem(BenhNhan_Info bn, LanKham_Info lk, DoiTuong_Info dt, BacSi_Info bs)
 {
     this.bn = bn;
     this.lk = lk;
     this.dt = dt;
     this.bs = bs;
     InitializeComponent();
 }
        private void btn_ThemBacSiGui_Click(object sender, EventArgs e)
        {
            frmBacSiGui f = new frmBacSiGui();

            f.ShowDialog();
            cbx_BacSiGui.DataSource    = BacSi_Info.SelectAllTable2();
            cbx_BacSiGui.ValueMember   = "HoTen";
            cbx_BacSiGui.DisplayMember = "BacSiID";
            cbx_BacSiGui.Select();
        }
        private DataTable load_bs()
        {
            DataTable ds_bs = BacSi_Info.SelectAllTableCustemer();
            DataRow   r     = ds_bs.NewRow();

            r["BacSiID"] = 0;
            r["HoTen"]   = "Tự đến";

            ds_bs.Rows.Add(r);
            DataView v = ds_bs.DefaultView;

            v.Sort = "BacSiID";
            return(v.ToTable());
        }
Exemple #4
0
 private void btnChapNhan_Click(object sender, EventArgs e)
 {
     if (check() || checkSua())
     {
         if (them == 1 && check())
         {
             BacSi_Info nv = new BacSi_Info(1, txtHoTen.Text, txtNgaySinh.DateTime, Convert.ToBoolean(cbx_Sex.Text), txtDienThoai.Text
                                            , txtDiaChi.Text, txtTenDangNhap.Text, Util.ResetControl.Get_MD5(txtMatKhau.Text),
                                            Convert.ToInt32(cbx_quyenhan.Text), 1, txtGhiChu.Text);
             if (nv.Insert())
             {
                 Util.MESSAGE.MSG("Cập nhật thành công!");
                 Util.ResetControl.ReserAll(this);
                 them = 0;
                 load();
             }
             else
             {
                 Util.MESSAGE.WARNING("Cập nhật không thành công!");
             }
         }
         else if (them == 2 && checkSua())
         {
             BacSi_Info nv = new BacSi_Info(1, txtHoTen.Text, txtNgaySinh.DateTime, Convert.ToBoolean(cbx_Sex.Text), txtDienThoai.Text
                                            , txtDiaChi.Text, txtTenDangNhap.Text, Util.ResetControl.Get_MD5(txtMatKhau.Text),
                                            Convert.ToInt32(cbx_quyenhan.Text), 1, txtGhiChu.Text);
             nv.BacSiID = Convert.ToInt32(gridDanhSach.ActiveRow.Cells["BacSiID"].Value.ToString());
             if (nv.Update())
             {
                 Util.MESSAGE.MSG("Cập nhật thành công!");
                 Util.ResetControl.ReserAll(this);
                 them = 0;
                 load();
             }
             else
             {
                 Util.MESSAGE.WARNING("Cập nhật không thành công!");
             }
         }
     }
 }
        private void btn_KhamThem_Click(object sender, EventArgs e)
        {
            if (GridBenhNhan.ActiveRow != null)
            {
                BenhNhan_Info bn = new BenhNhan_Info();
                bn.DiaChi    = txtDiaChi.Text;
                bn.DienThoai = txtDienThoai.Text;
                bn.GioiTinh  = txtGT.Text == "Nam" ? true : false;
                bn.HoTen     = txtHoTen.Text;
                bn.Tuoi      = Convert.ToInt32(txtTuoi.Text);
                LanKham_Info lk = new LanKham_Info();
                lk.NgayKham  = Convert.ToDateTime(txtNgayKham.Text);
                lk.SoBH      = txtMaTheBHYT.Text;
                lk.SoKham    = Convert.ToInt32(txtMaBenhAn.Text);
                lk.LanKhamID = Convert.ToInt32(GridBenhNhan.ActiveRow.Cells["LanKhamID"].Value);
                if (GridBenhNhan.ActiveRow.Cells["BacSiGuiID"].Value.ToString() == "")
                {
                    lk.BacSiGuiID = 0;
                }
                else
                {
                    lk.BacSiGuiID = Convert.ToInt32(GridBenhNhan.ActiveRow.Cells["BacSiGuiID"].Value);
                }
                DoiTuong_Info dt = new DoiTuong_Info();
                dt.TenDoiTuong = txtDoiTuong.Text;
                BacSi_Info bs = new BacSi_Info();
                bs.HoTen = GridBenhNhan.ActiveRow.Cells["HoTenBacSi"].Value.ToString();


                frmKhamThem f = new frmKhamThem(bn, lk, dt, bs);
                f.ShowDialog();
                grid_DV.DataSource = LoadDV(lk.LanKhamID.ToString());
            }

            else
            {
                MessageBox.Show("Chọn bệnh nhân để khám thêm");
            }
        }
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            if (txtTenDangNhap.Text.Trim() == "")
            {
                txtTenDangNhap.Focus();
                errorProvider1.SetError(txtTenDangNhap, "loi");
                return;
            }
            else
            {
                errorProvider1.Clear();
            }
            if (txtMatKhau.Text.Trim() == "")
            {
                txtMatKhau.Focus();
                errorProvider1.SetError(txtMatKhau, "loi");
                return;
            }
            else
            {
                errorProvider1.Clear();
            }
            DataTable b = new DataTable();



            BacSi_Info _nv = new BacSi_Info();

            try
            {
                string   TenDangNhap = txtTenDangNhap.Text.Trim();
                string   MatKhau     = txtMatKhau.Text.Trim();
                object[] arrvalue    = new object[4] {
                    "@TenDangNhap", TenDangNhap, "@MatKhau", Util.ResetControl.Get_MD5(MatKhau)
                };

                b = DB_SQL.EXECUTE_PROC("BacSi_SelectByUser", arrvalue);
            }
            catch (Exception ae)
            {
                MessageBox.Show("Tên đăng nhập hoặc mật khẩu sai. Xin vui lòng nhập lại !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtTenDangNhap.Select();
                return;
            }
            if (b == null)
            {
                return;
            }
            if (b.Rows.Count <= 0)
            {
                MessageBox.Show("Tên đăng nhập hoặc mật khẩu sai. Xin vui lòng nhập lại !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtTenDangNhap.Select();
                return;
            }
            else
            {
                _nv.TenDangNhap = b.Rows[0]["TenDangNhap"].ToString();
                _nv.BacSiID     = Convert.ToInt32(b.Rows[0]["BacSiID"].ToString());
                _nv.QuyenHan    = Convert.ToInt16(b.Rows[0]["QuyenHan"].ToString());
                _nv.HoTen       = Convert.ToString(b.Rows[0]["HoTen"].ToString());
                _nv.NgaySinh    = Convert.ToDateTime(b.Rows[0]["NgaySinh"].ToString());
                _nv.GioiTinh    = Convert.ToBoolean(b.Rows[0]["GioiTinh"].ToString());
                _nv.DiaChi      = Convert.ToString(b.Rows[0]["DiaChi"].ToString());
                _nv.DienThoai   = Convert.ToString(b.Rows[0]["DienThoai"].ToString());
                CTGlobal.nv     = _nv;

                FormMain frm = new FormMain(0);
                frm.Show();
                CTGlobal._Login = this;
                this.Hide();
            }
        }
Exemple #7
0
 public DoiMatKhau(BacSi_Info nv)
 {
     this.nv = nv;
     InitializeComponent();
 }