Example #1
0
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (grdPhongBan.RowCount <= 0)
            {
                Utility.ShowMsg("Hiện chưa có bản ghi nào chọn", "Thông báo");
                grdPhongBan.Focus();
                return;
            }
            v_Department_id = Utility.Int32Dbnull(grdPhongBan.CurrentRow.Cells[DmucKhoaphong.Columns.IdKhoaphong].Value, -1);

            if (grdPhongBan.CurrentRow != null)
            {
                if (Utility.AcceptQuestion("Bạn có muốn xoá bản ghi này không", "Thông bảo", true))
                {
                    DmucKhoaphong.Delete(DmucKhoaphong.Columns.IdKhoaphong, v_Department_id);
                    DataRow[] array = dsTable.Select(DmucKhoaphong.Columns.IdKhoaphong + "=" + v_Department_id);
                    if (array.GetLength(0) > 0)
                    {
                        array[0].Delete();
                        dsTable.AcceptChanges();
                    }
                }

                ModifyCommand();
            }
        }
Example #2
0
        private void RemoveObjectChecked()
        {
            try
            {
                int Count = dsTable.DefaultView.Count;
                int i     = 0;
                m_blnLoaded = false;
_Continue:
                foreach (DataRowView drv in dsTable.DefaultView)
                {
                    i++;
                    if (drv["CHON"].ToString() == "0")
                    {
                        dsTable.Rows.Remove(drv.Row);
                        DmucKhoaphong.Delete(Utility.Int32Dbnull(drv[DmucKhoaphong.Columns.IdKhoaphong], -1));
                        if (i < Count)
                        {
                            goto _Continue;
                        }
                        else
                        {
                            break;
                        }
                    }

                    dsTable.AcceptChanges();
                    m_blnLoaded = true;
                }
            }
            catch
            {
            }
        }
Example #3
0
        private void BindData()
        {
            SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema)
                                .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaLanKham.Text);

            if (sqlQuery.GetRecordCount() > 0)
            {
                objLuotkham = sqlQuery.ExecuteSingle <KcbLuotkham>();
                if (objLuotkham != null)
                {
                    txtMaLanKham.Text = Utility.sDbnull(objLuotkham.MaLuotkham);
                    txtSoBHYT.Text    = Utility.sDbnull(objLuotkham.MatheBhyt);
                    DmucKhoaphong objDmucKhoaphong = DmucKhoaphong.FetchByID(objLuotkham.IdKhoanoitru);
                    if (objDmucKhoaphong != null)
                    {
                        txtDepartmentName.Tag  = Utility.sDbnull(objDmucKhoaphong.IdKhoaphong);
                        txtDepartment_ID.Text  = Utility.sDbnull(objDmucKhoaphong.IdKhoaphong);
                        txtDepartmentName.Text = Utility.sDbnull(objDmucKhoaphong.TenKhoaphong);
                    }

                    KcbDanhsachBenhnhan objPatientInfo = KcbDanhsachBenhnhan.FetchByID(objLuotkham.IdBenhnhan);
                    if (objPatientInfo != null)
                    {
                        txtPatient_Name.Text = Utility.sDbnull(objPatientInfo.TenBenhnhan);
                        txtPatient_ID.Text   = Utility.sDbnull(objLuotkham.IdBenhnhan);
                        txtNamSinh.Text      = Utility.sDbnull(objPatientInfo.NamSinh);
                        txtTuoi.Text         = Utility.sDbnull(DateTime.Now.Year - objPatientInfo.NamSinh);
                        txtPatientSex.Text   = objPatientInfo.GioiTinh;// Utility.Int32Dbnull(objPatientInfo.PatientSex) == 0 ? "Nam" : "Nữ";
                    }
                    objPhanbuonggiuong = NoitruPhanbuonggiuong.FetchByID(objLuotkham.IdRavien);
                    dtNgayvao.Value    = objPhanbuonggiuong.NgayVaokhoa;
                    if (objPhanbuonggiuong != null)
                    {
                        txtPatientDept_ID.Text = Utility.sDbnull(objPhanbuonggiuong.Id);
                        NoitruDmucBuong objRoom = NoitruDmucBuong.FetchByID(objPhanbuonggiuong.IdBuong);
                        if (objRoom != null)
                        {
                            txtSoPhong.Text = Utility.sDbnull(objRoom.TenBuong);
                            txtSoPhong.Tag  = Utility.sDbnull(objPhanbuonggiuong.IdBuong);
                        }
                        NoitruDmucGiuongbenh objNoitruDmucGiuongbenh = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong);
                        if (objNoitruDmucGiuongbenh != null)
                        {
                            txtSoGiuong.Text = Utility.sDbnull(objNoitruDmucGiuongbenh.TenGiuong);
                            txtSoGiuong.Tag  = Utility.sDbnull(objPhanbuonggiuong.IdGiuong);
                        }
                    }
                }
            }
            ModifyCommand();
        }
Example #4
0
        public void LoadList()
        {
            try
            {
                Try2SaveXML();
                UIAction.SetTextStatus(lblMsg, "Nạp thông tin cấu hình...", false);
                Utility.LoadProperties();
                globalVariables.gv_dtDangbaoche   = SPs.DmucLaydmucDangbaochethuoc().GetDataSet().Tables[0];
                globalVariables.gv_dtDmucChung    = new Select().From(DmucChung.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtDmucLoaibenh = THU_VIEN_CHUNG.LayDulieuDanhmucChung(new List <string> {
                    "LOAIBENH"
                }, false);
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu thuốc...", false);
                globalVariables.gv_dtQheDoituongThuoc = new Select().From(QheDoituongThuoc.Schema).ExecuteDataSet().Tables[0];

                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu hệ thống khác...", false);
                globalVariables.gv_dtSysparams = new Select().From(SysSystemParameter.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtSysTieude = new Select().From(SysTieude.Schema).ExecuteDataSet().Tables[0];


                globalVariables.IdKhoaNhanvien      = (Int16)THU_VIEN_CHUNG.LayIDPhongbanTheoUser(globalVariables.UserName);
                globalVariables.idKhoatheoMay       = (Int16)THU_VIEN_CHUNG.LayIDPhongbanTheoMay(globalVariables.MA_KHOA_THIEN);
                globalVariablesPrivate.objKhoaphong = DmucKhoaphong.FetchByID(globalVariables.idKhoatheoMay);
                globalVariablesPrivate.objNhanvien  = new Select().From(DmucNhanvien.Schema).Where(DmucNhanvien.Columns.UserName).IsEqualTo(globalVariables.UserName).ExecuteSingle <DmucNhanvien>();
                if (globalVariablesPrivate.objNhanvien != null)
                {
                    globalVariablesPrivate.objKhoaphongNhanvien = DmucKhoaphong.FetchByID(globalVariablesPrivate.objNhanvien.IdKhoa);
                }
                globalVariables.gv_dtDanhmucchung = new Select().From(DmucChung.Schema).ExecuteDataSet().Tables[0];
                globalVariables.g_dtMeasureUnit   = THU_VIEN_CHUNG.LayDulieuDanhmucChung(new List <string> {
                    "DONVITINH"
                }, false);
                globalVariables.gv_dtDmucPhongban = new Select().From(DmucKhoaphong.Schema).ExecuteDataSet().Tables[0];

                globalVariables.SysDate = THU_VIEN_CHUNG.GetSysDateTime();

                globalVariables.gv_dtDmucNhanvien = new Select().From(VDmucNhanvien.Schema).ExecuteDataSet().Tables[0];
                Utility.LoadImageLogo();
            }

            catch (Exception ex)
            {
                Utility.CatchException(ex);
            }
            finally
            {
                THU_VIEN_CHUNG.GetIP4Address();
                THU_VIEN_CHUNG.GetMACAddress();
                THU_VIEN_CHUNG.LoadThamSoHeThong();
            }
        }
Example #5
0
        public void LoadList()
        {
            try
            {
                globalVariables.idKhoatheoMay = (Int16)THU_VIEN_CHUNG.LayIDPhongbanTheoMay(globalVariables.MA_KHOA_THIEN);
                globalVariables.objKhoaphong  = DmucKhoaphong.FetchByID(globalVariables.idKhoatheoMay);
            }

            catch (Exception ex)
            {
            }
            finally
            {
            }
        }
Example #6
0
        private void GetData()
        {
            DmucKhoaphong objDepartment = DmucKhoaphong.FetchByID(Utility.Int32Dbnull(txtID.Text, -1));

            if (objDepartment != null)
            {
                txtDepartment_Code.Text = objDepartment.MaKhoaphong;
                txtDepartment_Name.Text = objDepartment.TenKhoaphong;
                txtintOrder.Text        = Utility.sDbnull(objDepartment.SttHthi);

                chkParent.Checked = objDepartment.MaCha.ToString() == "0" ? false : true;

                cboParent_ID.SelectedIndex =
                    Utility.GetSelectedIndex(cboParent_ID, Utility.sDbnull(objDepartment.MaCha, "-1"));
                txtDesc.Text     = Utility.sDbnull(objDepartment.MotaThem, "");
                optPhong.Checked = objDepartment.KieuKhoaphong == "PHONG";
                if (objDepartment.NoitruNgoaitru == "NOI")
                {
                    optNoitru.Checked = true;
                }
                else if (objDepartment.NoitruNgoaitru == "NGOAI")
                {
                    optNgoaitru.Checked = true;
                }
                else
                {
                    optKhac.Checked = true;
                }
                if (objDepartment.PhongChucnang == 1)
                {
                    optChucnang.Checked = true;
                }
                else
                {
                    optChuyenmon.Checked = true;
                }
                // cboParent_ID.Enabled=Utility.sDbnull(drDepartment[DmucKhoaphong.Columns.MaCha], "-1") == "0" ? true : false;
                // cboParent_ID.SelectedIndex = Utility.GetSelectedIndex(cboParent_ID,Utility.sDbnull(objDepartment.MaCha,-1));
                txtTIEN_TAM_UNG.Text  = Utility.sDbnull(objDepartment.TamUng, 0);
                txtDeptFee.Text       = Utility.sDbnull(objDepartment.DonGia, "0");
                chkKhoaCapCuu.Checked = Utility.Int32Dbnull(objDepartment.LaKhoacapcuu, 0) == 1;
                txtDonvitinh.SetCode(objDepartment.MaDonvitinh);
                txtMaphongXepStt.Text = Utility.sDbnull(objDepartment.MaPhongStt);
                txtPhong_Thien.Text   = Utility.sDbnull(objDepartment.ChiDan);
            }
        }
 private void frm_phanbuonggiuong_Load(object sender, EventArgs e)
 {
     if (ObjPhanbuonggiuong != null)
     {
         txtMaLanKham.Text      = ObjPhanbuonggiuong.MaLuotkham;
         txtPatientDept_ID.Text = Utility.sDbnull(ObjPhanbuonggiuong.Id);
         txtDepartment_ID.Text  = Utility.sDbnull(ObjPhanbuonggiuong.IdKhoanoitru);
         DmucKhoaphong objDepartment = DmucKhoaphong.FetchByID(Utility.Int32Dbnull(txtDepartment_ID.Text));
         if (objDepartment != null)
         {
             txtDepartmentName.Text = Utility.sDbnull(objDepartment.TenKhoaphong);
             txtDepartmentName.Tag  = Utility.sDbnull(objDepartment.IdKhoaphong);
         }
         dtNgayChuyen.Value = globalVariables.SysDate;
         txtGio.Text        = Utility.sDbnull(dtNgayChuyen.Value.Hour);
         txtPhut.Text       = Utility.sDbnull(dtNgayChuyen.Value.Minute);
         BindData();
         txtRoom_code.Focus();
         txtRoom_code.SelectAll();
     }
 }
        private void cmdDelete_Click(object sender, EventArgs e)
        {
            if (grdPhongBan.RowCount <= 0)
            {
                Utility.ShowMsg("Hiện chưa có bản ghi nào chọn", "Thông báo");
                grdPhongBan.Focus();
                return;
            }
            foreach (GridEXRow row in grdPhongBan.GetCheckedRows())
            {
                v_Department_id = Utility.Int32Dbnull(row.Cells[DmucKhoaphong.Columns.IdKhoaphong].Value, -1);
                SqlQuery q = new Select().From(KcbDangkyKcb.Schema)
                             .Where(KcbDangkyKcb.Columns.IdKhoakcb).IsEqualTo(v_Department_id)
                             .Or(KcbDangkyKcb.Columns.IdCha).IsEqualTo(v_Department_id)
                             .Or(KcbDangkyKcb.Columns.IdPhongkham).IsEqualTo(v_Department_id);
                if (q.GetRecordCount() > 0)
                {
                    Utility.ShowMsg("Khoa phòng này đã sử dụng nên không thể xóa", "Thông báo");
                    grdPhongBan.Focus();
                    return;
                }
                if (grdPhongBan.CurrentRow != null)
                {
                    if (Utility.AcceptQuestion("Bạn có muốn xoá bản ghi này không", "Thông bảo", true))
                    {
                        DmucKhoaphong.Delete(DmucKhoaphong.Columns.IdKhoaphong, v_Department_id);
                        DataRow[] array = dsTable.Select(DmucKhoaphong.Columns.IdKhoaphong + "=" + v_Department_id);
                        if (array.GetLength(0) > 0)
                        {
                            array[0].Delete();
                            dsTable.AcceptChanges();
                        }
                        row.Delete();
                    }

                    ModifyCommand();
                }
            }
        }
Example #9
0
        /// <summary>
        /// Hàm thực hiện khởi tạo thôngtin của khoa phòng
        /// </summary>
        /// <returns></returns>
        private Int16 CreateDepartment()
        {
            try
            {
                short Parent_ID = 0;

                var department = new DmucKhoaphong();
                department.MaKhoaphong    = txtDepartment_Code.Text;
                department.SttHthi        = Utility.Int16Dbnull(txtintOrder.Value, 0);
                department.TenKhoaphong   = txtDepartment_Name.Text;
                department.DonGia         = Utility.DecimaltoDbnull(txtDeptFee.Text, 0);
                department.MotaThem       = Utility.sDbnull(txtDesc.Text, "");
                department.NoitruNgoaitru = optNgoaitru.Checked ? "NGOAI" : (optNoitru.Checked ? "NOI" : "CAHAI");
                department.MaCha          =
                    (short?)(chkParent.Checked ? Utility.Int16Dbnull(cboParent_ID.SelectedValue, -1) : 0);
                department.TamUng      = Utility.DecimaltoDbnull(txtTIEN_TAM_UNG.Text, 0);
                department.MaDonvitinh = txtDonvitinh.myCode;
                department.NgayTao     = globalVariables.SysDate;
                department.NguoiTao    = globalVariables.UserName;
                department.MaPhongStt  = Utility.sDbnull(txtMaphongXepStt.Text);
                department.ChiDan      = Utility.sDbnull(txtPhong_Thien.Text);

                department.KieuKhoaphong = optPhong.Checked ? "PHONG" : "KHOA";

                department.PhongChucnang = (byte)(optChucnang.Checked ? 1 : 0);

                department.LaKhoacapcuu = (byte)(chkKhoaCapCuu.Checked ? 1 : 0);
                department.IsNew        = true;
                department.Save();
                return(department.IdKhoaphong);
            }
            catch
            {
                return(-1);
            }
        }
Example #10
0
        public void LoadList()
        {
            try
            {
                Try2SaveXML();
                UIAction.SetTextStatus(lblMsg, "Nạp thông tin cấu hình...", false);
                Utility.LoadProperties();
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục dạng bào chế...", false);
                globalVariables.gv_dtDangbaoche = SPs.DmucLaydmucDangbaochethuoc().GetDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục thuốc...", false);
                globalVariables.gv_dtDanhMucThuoc = new Select().From(VDmucThuoc.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục loại thuốc...", false);
                globalVariables.gv_dtLoaiThuoc = new Select().From(DmucLoaithuoc.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục chung...", false);
                globalVariables.gv_dtDmucChung = new Select().From(DmucChung.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục quan hệ giá thuốc...", false);
                globalVariables.gv_dtQheDoituongThuoc = new Select().From(QheDoituongThuoc.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục bệnh...", false);
                globalVariables.gv_dtDmucLoaibenh = THU_VIEN_CHUNG.LayDulieuDanhmucChung(new List <string> {
                    "LOAIBENH"
                }, false);
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục bệnh án...", false);
                globalVariables.gv_danhmucbenhan = new Select().From(DmucBenhan.Schema).Where(DmucBenhan.Columns.Trangthai).IsEqualTo(1).OrderAsc(DmucBenhan.Columns.SttHienthi).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục bệnh...", false);
                globalVariables.gv_dtDmucBenh = new Select().From(VDanhmucbenh.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục địa chính...", false);
                globalVariables.gv_dtDmucDiachinh = new Select().From(VDmucDiachinh.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục bệnh viện...", false);
                globalVariables.gv_dtDmucBenhVien = new Select().From(DmucBenhvien.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Ghép dữ liệu địa chính...", false);
                Utility.AutoCompeleteAddress(globalVariables.gv_dtDmucDiachinh);
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục nơi KCBBĐ...", false);
                globalVariables.gv_dtDmucNoiKCBBD = new Select().From(VDmucNoiKCBBD.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu dịch vụ cấm kê chỉ định...", false);
                globalVariables.gv_dtDmucQheCamCLSChungPhieu = new Select().From(QheCamchidinhChungphieu.Schema).Where(QheCamchidinhChungphieu.Columns.Loai).IsEqualTo(0).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu dịch vụ cận lâm sàng...", false);
                globalVariables.gv_dtDmucDichvuCls = new Select().From(VDmucDichvucl.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu dịch vụ cận lâm sàng chi tiết...", false);
                globalVariables.gv_dtDmucDichvuClsChitiet = new Select().From(VDmucDichvuclsChitiet.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu dịch vụ nhóm cận lâm sàng...", false);
                globalVariables.gv_dtNhomDichVuCLS = new Select().From(DmucNhomcanlamsang.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu quan hệ giá cận lâm sàngt...", false);
                globalVariables.gv_dtQheDoituongDichvu = new Select().From(QheDoituongDichvucl.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu cấu hình webservices ...", false);
                SysWebServicePath objServicePath =
                    new Select().From(SysWebServicePath.Schema)
                    .Where(SysWebServicePath.Columns.WebPathCode)
                    .IsEqualTo(globalVariables.BhxhWebCode).ExecuteSingle <SysWebServicePath>();
                if (objServicePath != null)
                {
                    globalVariables.BhxhWebPath = objServicePath.WebPathName;
                }
                SysWebServicePath objServicePathInvoice =
                    new Select().From(SysWebServicePath.Schema)
                    .Where(SysWebServicePath.Columns.WebPathCode)
                    .IsEqualTo(globalVariables.InvoiceWebCode).ExecuteSingle <SysWebServicePath>();
                if (objServicePathInvoice != null)
                {
                    globalVariables.InvoiceWebPath = objServicePathInvoice.WebPathName;
                }

                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu hệ thống khác...", false);
                globalVariables.gv_dtSysparams = new Select().From(SysSystemParameter.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtSysTieude = new Select().From(SysTieude.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtNhomInCLS = (from p in globalVariables.gv_dtDmucChung.AsEnumerable()
                                                  where p.Field <string>(DmucChung.Columns.Loai) == "NHOM_INPHIEU_CLS"
                                                  select p).CopyToDataTable();
                globalVariables.IdKhoaNhanvien = (Int16)THU_VIEN_CHUNG.LayIDPhongbanTheoUser(globalVariables.UserName);
                globalVariables.gv_dtDoituong  =
                    new Select().From(DmucDoituongkcb.Schema)
                    .OrderAsc(DmucDoituongkcb.Columns.SttHthi)
                    .ExecuteDataSet()
                    .Tables[0];
                globalVariables.idKhoatheoMay       = (Int16)THU_VIEN_CHUNG.LayIdPhongbanTheoMay(globalVariables.MA_KHOA_THIEN);
                globalVariablesPrivate.objKhoaphong = DmucKhoaphong.FetchByID(globalVariables.idKhoatheoMay);
                globalVariablesPrivate.objNhanvien  =
                    new Select().From(DmucNhanvien.Schema)
                    .Where(DmucNhanvien.Columns.UserName)
                    .IsEqualTo(globalVariables.UserName)
                    .ExecuteSingle <DmucNhanvien>();
                if (globalVariablesPrivate.objNhanvien != null)
                {
                    globalVariablesPrivate.objKhoaphongNhanvien =
                        DmucKhoaphong.FetchByID(globalVariablesPrivate.objNhanvien.IdKhoa);
                    globalVariables.qh_NhanVienPhongKham = new Select().From(QheBacsiKhoaphong.Schema)
                                                           .Where(QheBacsiKhoaphong.IdBacsiColumn).IsEqualTo(globalVariablesPrivate.objNhanvien.IdNhanvien)
                                                           .ExecuteDataSet().Tables[0];
                    globalVariables.IdPhongNhanvien = globalVariablesPrivate.objNhanvien.IdPhong;
                }
                //globalVariables.gv_dtKhoaPhongNgoaiTru =
                //    SPs.DmucLaydanhsachCacphongkhamTheoBacsi(globalVariables.UserName, globalVariables.idKhoatheoMay,
                //        Utility.Bool2byte(  globalVariables.IsAdmin), 0).GetDataSet().Tables[0];
                globalVariables.g_dtMeasureUnit = THU_VIEN_CHUNG.LayDulieuDanhmucChung(new List <string> {
                    "DONVITINH"
                },
                                                                                       false);
                globalVariables.gv_dtDmucPhongban = new Select().From(DmucKhoaphong.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtDantoc       =
                    new Select().From(DmucChung.Schema)
                    .Where(DmucChung.Columns.Loai)
                    .IsEqualTo("DAN_TOC")
                    .ExecuteDataSet()
                    .Tables[0];
                globalVariables.SysDate = THU_VIEN_CHUNG.GetSysDateTime();

                globalVariables.gv_dtDmucNhanvien = new Select().From(VDmucNhanvien.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Kiểm tra phiên bản người dùng ......", false);
                //if (PropertyLib._ConfigProperties.HIS_AppMode == AppEnum.AppMode.Demo)
                //{
                //    SqlQuery sql = new Select().Top("500").From(KcbLuotkham.Schema);
                //    if (sql.GetRecordCount() >= 500)
                //    {
                //        UIAction.SetTextStatus(lblMsg, "Phiên bản demo đã hết hiệu lực.......", false);
                //        Thread.Sleep(4000);
                //        Application.Exit();
                //    }
                //}
                Utility.LoadImageLogo();
            }

            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
            finally
            {
                THU_VIEN_CHUNG.GetIP4Address();
                THU_VIEN_CHUNG.GetMACAddress();
                THU_VIEN_CHUNG.LoadThamSoHeThong();
            }
        }
Example #11
0
        public void LoadList()
        {
            try
            {
                Try2SaveXML();
                UIAction.SetTextStatus(lblMsg, "Nạp thông tin cấu hình...", false);
                Utility.LoadProperties();
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục thuốc...", false);
                globalVariables.gv_dtDangbaoche       = SPs.DmucLaydmucDangbaochethuoc().GetDataSet().Tables[0];
                globalVariables.gv_dtDanhMucThuoc     = new Select().From(VDmucThuoc.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtLoaiThuoc        = new Select().From(DmucLoaithuoc.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtDmucChung        = new Select().From(DmucChung.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtQheDoituongThuoc =
                    new Select().From(QheDoituongThuoc.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục bệnh...", false);
                globalVariables.gv_dtDmucLoaibenh = THU_VIEN_CHUNG.LayDulieuDanhmucChung(new List <string> {
                    "LOAIBENH"
                },
                                                                                         false);
                globalVariables.gv_dtDmucBenh = new Select().From(VDanhmucbenh.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục địa chính...", false);
                globalVariables.gv_dtDmucDiachinh = new Select().From(VDmucDiachinh.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtDmucBenhVien = new Select().From(DmucBenhvien.Schema).ExecuteDataSet().Tables[0];
                Utility.AutoCompeleteAddress(globalVariables.gv_dtDmucDiachinh);
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu danh mục nơi KCBBĐ...", false);
                globalVariables.gv_dtDmucNoiKCBBD = new Select().From(VDmucNoiKCBBD.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu dịch vụ CLS...", false);
                globalVariables.gv_dtDmucQheCamCLSChungPhieu =
                    new Select().From(QheCamchidinhChungphieu.Schema).Where(QheCamchidinhChungphieu.Columns.Loai).
                    IsEqualTo(0).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtDmucDichvuCls        = new Select().From(VDmucDichvucl.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtDmucDichvuClsChitiet =
                    new Select().From(VDmucDichvuclsChitiet.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtNhomDichVuCLS =
                    new Select().From(DmucNhomcanlamsang.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtQheDoituongDichvu =
                    new Select().From(QheDoituongDichvucl.Schema).ExecuteDataSet().Tables[0];
                UIAction.SetTextStatus(lblMsg, "Nạp dữ liệu hệ thống khác...", false);
                globalVariables.gv_dtSysparams = new Select().From(SysSystemParameter.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtSysTieude = new Select().From(SysTieude.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtNhomInCLS = (from p in globalVariables.gv_dtDmucChung.AsEnumerable()
                                                  where p.Field <string>(DmucChung.Columns.Loai) == "NHOM_INPHIEU_CLS"
                                                  select p).CopyToDataTable();
                globalVariables.IdKhoaNhanvien = (Int16)THU_VIEN_CHUNG.LayIDPhongbanTheoUser(globalVariables.UserName);
                globalVariables.gv_dtDoituong  =
                    new Select().From(DmucDoituongkcb.Schema)
                    .OrderAsc(DmucDoituongkcb.Columns.SttHthi)
                    .ExecuteDataSet()
                    .Tables[0];
                globalVariables.idKhoatheoMay =
                    (Int16)THU_VIEN_CHUNG.LayIdPhongbanTheoMay(globalVariables.MA_KHOA_THIEN);
                globalVariablesPrivate.objKhoaphong = DmucKhoaphong.FetchByID(globalVariables.idKhoatheoMay);
                globalVariablesPrivate.objNhanvien  =
                    new Select().From(DmucNhanvien.Schema)
                    .Where(DmucNhanvien.Columns.UserName)
                    .IsEqualTo(globalVariables.UserName)
                    .ExecuteSingle <DmucNhanvien>();
                if (globalVariablesPrivate.objNhanvien != null)
                {
                    globalVariablesPrivate.objKhoaphongNhanvien =
                        DmucKhoaphong.FetchByID(globalVariablesPrivate.objNhanvien.IdKhoa);
                }

                globalVariables.gv_dtKhoaPhongNgoaiTru =
                    SPs.DmucLaydanhsachCacphongkhamTheoBacsi(globalVariables.UserName, globalVariables.idKhoatheoMay,
                                                             Utility.Bool2byte(
                                                                 globalVariables.IsAdmin), 0).GetDataSet().Tables[0];
                globalVariables.g_dtMeasureUnit = THU_VIEN_CHUNG.LayDulieuDanhmucChung(new List <string> {
                    "DONVITINH"
                },
                                                                                       false);
                globalVariables.gv_dtDmucPhongban = new Select().From(DmucKhoaphong.Schema).ExecuteDataSet().Tables[0];
                globalVariables.gv_dtDantoc       =
                    new Select().From(DmucChung.Schema)
                    .Where(DmucChung.Columns.Loai)
                    .IsEqualTo("DAN_TOC")
                    .ExecuteDataSet()
                    .Tables[0];
                globalVariables.SysDate = THU_VIEN_CHUNG.GetSysDateTime();

                globalVariables.gv_dtDmucNhanvien = new Select().From(VDmucNhanvien.Schema).ExecuteDataSet().Tables[0];
                Utility.LoadImageLogo();
            }

            catch (Exception ex)
            {
                Utility.CatchException(ex);
            }
            finally
            {
                THU_VIEN_CHUNG.GetIP4Address();
                THU_VIEN_CHUNG.GetMACAddress();
                THU_VIEN_CHUNG.LoadThamSoHeThong();
            }
        }
        /// <summary>
        /// Hàm thực hiện khởi tạo thôngtin của khoa phòng
        /// </summary>
        /// <returns></returns>
        private Int16 CreateDepartment()
        {
            try
            {
                short Parent_ID = 0;

                DmucKhoaphong department = new DmucKhoaphong();
                department.MaKhoaphong = txtDepartment_Code.Text;
                department.SttHthi = Utility.Int16Dbnull(txtintOrder.Value, 0);
                department.TenKhoaphong = txtDepartment_Name.Text;
                department.DonGia = Utility.DecimaltoDbnull(txtDeptFee.Text, 0);
                department.MotaThem = Utility.sDbnull(txtDesc.Text, "");
                department.NoitruNgoaitru = optNgoaitru.Checked ? "NGOAI" : (optNoitru.Checked ? "NOI" : "CAHAI");
                department.MaCha = (short?)(chkParent.Checked ? Utility.Int16Dbnull(cboParent_ID.SelectedValue, -1) : 0);
                department.TamUng = Utility.DecimaltoDbnull(txtTIEN_TAM_UNG.Text, 0);
                department.MaDonvitinh = txtDonvitinh.myCode;
                department.NgayTao = globalVariables.SysDate;
                department.NguoiTao = globalVariables.UserName;
                department.MaPhongStt = Utility.sDbnull(txtMaphongXepStt.Text);
                department.ChiDan = Utility.sDbnull(txtPhong_Thien.Text);

                department.KieuKhoaphong = optPhong.Checked ? "PHONG" : "KHOA";

                department.PhongChucnang = (byte)(optChucnang.Checked ? 1 : 0);

                department.LaKhoacapcuu = (byte)(chkKhoaCapCuu.Checked ? 1 : 0);
                department.IsNew = true;
                department.Save();
                return department.IdKhoaphong;
            }
            catch
            {
                return -1;
            }
        }
        private void getData()
        {
            TPhieuCapphatNoitru objPhieuCapphat = TPhieuCapphatNoitru.FetchByID(Utility.Int32Dbnull(txtID_CAPPHAT.Text));

            if (objPhieuCapphat != null)
            {
                txtID_CAPPHAT.Text   = Utility.sDbnull(objPhieuCapphat.IdCapphat);
                dtNgayCapPhat.Value  = dtNgayCapPhat.Value;
                txtID_KHOA_LINH.Text = Utility.sDbnull(objPhieuCapphat.IdKhoaLinh);
                idKhoaLinh           = Utility.Int32Dbnull(objPhieuCapphat.IdKhoaLinh);
                DmucKhoaphong objLDepartment = DmucKhoaphong.FetchByID(objPhieuCapphat.IdKhoaLinh);
                if (objLDepartment != null)
                {
                    txtTen_KHOA_LINH.Text = Utility.sDbnull(objLDepartment.TenKhoaphong);
                }
                //chkIsBoSung.Checked = Convert.ToBoolean(objPhieuCapphat.LinhBSung);

                IsPhieuBoSung         = Utility.Byte2Bool(objPhieuCapphat.LoaiPhieu);
                radLinhBoSung.Checked = IsPhieuBoSung;
                loaiphieu             = Utility.sDbnull(objPhieuCapphat.LoaiPhieu);
                radThuoc.Checked      = loaiphieu == "THUOC";
                radLinhVTYT.Checked   = loaiphieu == "VT";
                txtID_NVIEN.Text      = Utility.sDbnull(objPhieuCapphat.IdNhanviencapphat);
                DmucNhanvien objStaff = DmucNhanvien.FetchByID(objPhieuCapphat.IdNhanviencapphat);
                if (objStaff != null)
                {
                    txtTen_NVIEN.Text = Utility.sDbnull(objStaff.TenNhanvien);
                }
                txtId_KhoXuat.Text = Utility.sDbnull(objPhieuCapphat.IdKhoXuat);
                id_khoXuat         = Utility.Int32Dbnull(objPhieuCapphat.IdKhoXuat);
                DKho objKho = DKho.FetchByID(objPhieuCapphat.IdKhoXuat);
                if (objKho != null)
                {
                    txtTenKho.Text = Utility.sDbnull(objKho.TenKho);
                }
                madoituong         = Utility.sDbnull(objPhieuCapphat.MaDoiTuong);
                txtMaDoiTuong.Text = Utility.sDbnull(madoituong);
                SqlQuery    sqlQuery   = new Select().From <LObjectType>().Where(LObjectType.Columns.ObjectTypeCode).IsEqualTo(madoituong);
                LObjectType objectType = sqlQuery.ExecuteSingle <LObjectType>();
                if (objectType != null)
                {
                    txtObjectType_Name.Text = Utility.sDbnull(objectType.ObjectTypeName);
                }
                txtMOTA_THEM.Text = Utility.sDbnull(objPhieuCapphat.MotaThem);
            }
            else
            {
                dtNgayCapPhat.Value  = BusinessHelper.GetSysDateTime();
                txtID_KHOA_LINH.Text = Utility.sDbnull(idKhoaLinh);
                LDepartment objLDepartment = LDepartment.FetchByID(idKhoaLinh);
                if (objLDepartment != null)
                {
                    txtTen_KHOA_LINH.Text = Utility.sDbnull(objLDepartment.DepartmentName);
                }
                txtID_NVIEN.Text = Utility.sDbnull(globalVariables.gv_StaffID);
                LStaff objStaff = LStaff.FetchByID(globalVariables.gv_StaffID);
                if (objStaff != null)
                {
                    txtTen_NVIEN.Text = Utility.sDbnull(objStaff.StaffName);
                }

                txtId_KhoXuat.Text = Utility.sDbnull(id_khoXuat);
                DKho objKho = DKho.FetchByID(id_khoXuat);
                if (objKho != null)
                {
                    txtTenKho.Text = Utility.sDbnull(objKho.TenKho);
                }
                //loaiphieu = Utility.sDbnull(objPhieuCapphat.LoaiPhieu);
                radThuoc.Checked      = loaiphieu == "THUOC";
                radLinhVTYT.Checked   = loaiphieu == "VT";
                radLinhBoSung.Checked = IsPhieuBoSung;
                // IsPhieuBoSung = Convert.ToBoolean(objPhieuCapphat.LinhBSung);
                txtMaDoiTuong.Text = Utility.sDbnull(madoituong);
                SqlQuery    sqlQuery   = new Select().From <LObjectType>().Where(LObjectType.Columns.ObjectTypeCode).IsEqualTo(madoituong);
                LObjectType objectType = sqlQuery.ExecuteSingle <LObjectType>();
                if (objectType != null)
                {
                    txtObjectType_Name.Text = Utility.sDbnull(objectType.ObjectTypeName);
                }
            }
            LoadPhieuDonThuoc();
        }
Example #14
0
        private void getData()
        {
            TPhieuCapphatNoitru objPhieuCapphat = TPhieuCapphatNoitru.FetchByID(Utility.Int32Dbnull(txtID_CAPPHAT.Text));

            if (objPhieuCapphat != null)
            {
                txtID_CAPPHAT.Text = Utility.sDbnull(objPhieuCapphat.IdCapphat);
                if (!string.IsNullOrEmpty(Utility.sDbnull(objPhieuCapphat.NgayNhap)))
                {
                    dtNgayCapPhat.Value = Convert.ToDateTime(objPhieuCapphat.NgayNhap);
                }
                else
                {
                    dtNgayCapPhat.Value = DateTime.Now;
                }
                txtID_KHOA_LINH.Text = Utility.sDbnull(objPhieuCapphat.IdKhoaLinh);
                idKhoaLinh           = Utility.Int32Dbnull(objPhieuCapphat.IdKhoaLinh);
                DmucKhoaphong objLDepartment = DmucKhoaphong.FetchByID(objPhieuCapphat.IdKhoaLinh);
                if (objLDepartment != null)
                {
                    txtTen_KHOA_LINH.Text = Utility.sDbnull(objLDepartment.DepartmentName);
                }
                //chkIsBoSung.Checked = Convert.ToBoolean(objPhieuCapphat.LinhBSung);

                IsPhieuBoSung         = Convert.ToBoolean(objPhieuCapphat.loaiPhieu);
                radLinhBoSung.Checked = IsPhieuBoSung;
                loaiphieu             = Utility.sDbnull(objPhieuCapphat.LoaiPhieu);
                radThuoc.Checked      = loaiphieu == "THUOC";
                radLinhVTYT.Checked   = loaiphieu == "VT";
                txtID_NVIEN.Text      = Utility.sDbnull(objPhieuCapphat.idn);
                DmucNhanvien objStaff = DmucNhanvien.FetchByID(objPhieuCapphat.IdNvien);
                if (objStaff != null)
                {
                    txtTen_NVIEN.Text = Utility.sDbnull(objStaff.StaffName);
                }
                txtId_KhoXuat.Text = Utility.sDbnull(objPhieuCapphat.IdKhoXuat);
                id_khoXuat         = Utility.Int32Dbnull(objPhieuCapphat.IdKhoXuat);
                DKho objKho = DKho.FetchByID(objPhieuCapphat.IdKhoXuat);
                if (objKho != null)
                {
                    txtTenKho.Text = Utility.sDbnull(objKho.TenKho);
                }
                madoituong         = Utility.sDbnull(objPhieuCapphat.MaDoiTuong);
                txtMaDoiTuong.Text = Utility.sDbnull(madoituong);
                if (globalVariables.gv_TongHopDonThuocMaDoiTuong)
                {
                    SqlQuery sqlQuery =
                        new Select().From <LObjectType>().Where(LObjectType.Columns.ObjectTypeCode).IsEqualTo(madoituong);
                    var objectType = sqlQuery.ExecuteSingle <LObjectType>();
                    if (objectType != null)
                    {
                        txtObjectType_Name.Text = Utility.sDbnull(objectType.ObjectTypeName);
                    }
                }
                else
                {
                    txtObjectType_Name.Text = "Tất cả";
                }
                txtMOTA_THEM.Text = Utility.sDbnull(objPhieuCapphat.MotaThem);
                me_Action         = action.Update;
            }
            else
            {
                dtNgayCapPhat.Value  = globalVariables.SysDate;
                txtID_KHOA_LINH.Text = Utility.sDbnull(idKhoaLinh);
                LDepartment objLDepartment = LDepartment.FetchByID(idKhoaLinh);
                if (objLDepartment != null)
                {
                    txtTen_KHOA_LINH.Text = Utility.sDbnull(objLDepartment.DepartmentName);
                }
                txtID_NVIEN.Text = Utility.sDbnull(globalVariables.gv_StaffID);
                LStaff objStaff = LStaff.FetchByID(globalVariables.gv_StaffID);
                if (objStaff != null)
                {
                    txtTen_NVIEN.Text = Utility.sDbnull(objStaff.StaffName);
                }

                txtId_KhoXuat.Text = Utility.sDbnull(id_khoXuat);
                DKho objKho = DKho.FetchByID(id_khoXuat);
                if (objKho != null)
                {
                    txtTenKho.Text = Utility.sDbnull(objKho.TenKho);
                }
                //loaiphieu = Utility.sDbnull(objPhieuCapphat.LoaiPhieu);
                radThuoc.Checked      = loaiphieu == "THUOC";
                radLinhVTYT.Checked   = loaiphieu == "VT";
                radLinhBoSung.Checked = IsPhieuBoSung;
                // IsPhieuBoSung = Convert.ToBoolean(objPhieuCapphat.LinhBSung);
                txtMaDoiTuong.Text = Utility.sDbnull(madoituong);
                if (globalVariables.gv_TongHopDonThuocMaDoiTuong)
                {
                    SqlQuery sqlQuery =
                        new Select().From <LObjectType>().Where(LObjectType.Columns.ObjectTypeCode).IsEqualTo(madoituong);
                    var objectType = sqlQuery.ExecuteSingle <LObjectType>();
                    if (objectType != null)
                    {
                        txtObjectType_Name.Text = Utility.sDbnull(objectType.ObjectTypeName);
                    }
                }
                else
                {
                    txtObjectType_Name.Text = "Tất cả";
                }
            }
            LoadDonThuoc();
        }
        private bool IsValidData()
        {
            Utility.SetMsg(lblMsg, "", true);
            if (string.IsNullOrEmpty(txtMa.Text))
            {
                Utility.SetMsg(lblMsg, "Bạn phải nhập thông tin mã giường ", true);
                txtMa.Focus();
                return(false);
            }
            if (chkcodefrom.Checked)
            {
                if (Utility.DoTrim(txtCodefrom.Text) == "")
                {
                    Utility.SetMsg(lblMsg, "Bạn phải nhập mã bắt đầu", true);
                    txtCodefrom.Focus();
                    txtCodefrom.SelectAll();
                    return(false);
                }
                if (Utility.DecimaltoDbnull(txtCodefrom.Text, 0) <= 0)
                {
                    Utility.SetMsg(lblMsg, "Hậu tố mã phòng bắt đầu phải >0", true);
                    txtCodefrom.Focus();
                    txtCodefrom.SelectAll();
                    return(false);
                }
                if (Utility.DoTrim(txtCode2.Text) == "")
                {
                    Utility.SetMsg(lblMsg, "Bạn phải nhập mã kết thúc", true);
                    txtCode2.Focus();
                    txtCode2.SelectAll();
                    return(false);
                }
                if (Utility.DecimaltoDbnull(txtCodefrom.Text, 0) > Utility.DecimaltoDbnull(txtCode2.Text, 0))
                {
                    Utility.SetMsg(lblMsg, "Hậu tố mã phòng bắt đầu < mã phòng đến", true);
                    txtCode2.Focus();
                    txtCode2.SelectAll();
                    return(false);
                }
            }
            if (string.IsNullOrEmpty(txtTEN.Text))
            {
                Utility.SetMsg(lblMsg, "Bạn phải nhập thông tin tên giường ", true);
                txtTEN.Focus();
                return(false);
            }
            if (Utility.Int32Dbnull(txtSuChua.Text) <= 0)
            {
                Utility.SetMsg(lblMsg, "Sức chứa không được <=0 ", true);
                txtSuChua.Focus();
                return(false);
            }
            DmucKhoaphong objDmucKhoaphong = DmucKhoaphong.FetchByID(Utility.Int32Dbnull(cboKhoaNoiTru.SelectedValue));

            if (objDmucKhoaphong == null)
            {
                Utility.SetMsg(lblMsg, "Bạn chọn khoa nội trú ", true);
                cboKhoaNoiTru.Focus();
                return(false);
            }
            if (Utility.Int32Dbnull(txtBuong.MyID) <= 0)
            {
                Utility.SetMsg(lblMsg, "Bạn cần chọn phòng nội trú(Có thể nhấn phím cách để hiện thị các buồng thuộc phòng nội trú đang chọn)", true);
                txtBuong.Focus();
                return(false);
            }

            if (Utility.DecimaltoDbnull(txtDongia.Text, 0) < 0)
            {
                Utility.SetMsg(lblMsg, "Giá áp dụng cho đối tượng Dịch vụ phải >=0.", true);
                txtDongia.Focus();
                return(false);
            }
            if (Utility.DecimaltoDbnull(txtGiaBHYT.Text, 0) < 0)
            {
                Utility.SetMsg(lblMsg, "Giá áp dụng cho đối tượng BHYT phải >=0.", true);
                txtGiaBHYT.Focus();
                return(false);
            }
            if (Utility.DecimaltoDbnull(txtGiakhac.Text, 0) < 0)
            {
                Utility.SetMsg(lblMsg, "Giá áp dụng cho đối tượng khác phải >=0.", true);
                txtGiakhac.Focus();
                return(false);
            }
            if (Utility.DecimaltoDbnull(txtPTDT.Text, 0) < 0)
            {
                Utility.SetMsg(lblMsg, "Giá phụ thu đúng tuyến áp dụng cho đối tượng BHYT phải >=0.", true);
                txtPTDT.Focus();
                return(false);
            }
            if (Utility.DecimaltoDbnull(txtPTTT.Text, 0) < 0)
            {
                Utility.SetMsg(lblMsg, "Giá phụ thu trái tuyến áp dụng cho đối tượng BHYT phải >=0.", true);
                txtPTTT.Focus();
                return(false);
            }
            if (m_enAct == action.Insert)
            {
                if (!chkcodefrom.Checked)//Thêm đơn lẻ từng chiếc mới kiểm tra
                {
                    SqlQuery sqlQuery = new Select().From(NoitruDmucGiuongbenh.Schema)
                                        .Where(NoitruDmucGiuongbenh.Columns.IdBuong).IsEqualTo(Utility.sDbnull(txtBuong.MyID, ""));
                    sqlQuery.And(NoitruDmucGiuongbenh.Columns.MaGiuong).IsEqualTo(Utility.sDbnull(txtMa.Text));
                    if (sqlQuery.GetRecordCount() > 0)
                    {
                        Utility.ShowMsg("Mã giường đã tồn tại. Đề nghị bạn nhập mã khác", "Thông báo", MessageBoxIcon.Warning);
                        txtMa.Focus();
                        return(false);
                    }
                    sqlQuery = new Select().From(NoitruDmucGiuongbenh.Schema)
                               .Where(NoitruDmucGiuongbenh.Columns.IdBuong).IsEqualTo(Utility.sDbnull(txtBuong.MyID, ""));
                    sqlQuery.And(NoitruDmucGiuongbenh.Columns.TenGiuong).IsEqualTo(Utility.sDbnull(txtTEN.Text));
                    if (sqlQuery.GetRecordCount() > 0)
                    {
                        Utility.ShowMsg("Tên giường đã tồn tại. Đề nghị bạn nhập tên khác", "Thông báo", MessageBoxIcon.Warning);
                        txtTEN.Focus();
                        return(false);
                    }
                }
            }
            else
            {
                SqlQuery sqlQuery = new Select().From(NoitruDmucGiuongbenh.Schema)
                                    .Where(NoitruDmucGiuongbenh.Columns.IdBuong).IsEqualTo(Utility.sDbnull(txtBuong.MyID, ""))
                                    .And(NoitruDmucGiuongbenh.Columns.MaGiuong).IsEqualTo(Utility.sDbnull(txtMa.Text))
                                    .And(NoitruDmucGiuongbenh.Columns.IdGiuong).IsNotEqualTo(Utility.Int32Dbnull(txtID.Text));
                if (sqlQuery.GetRecordCount() > 0)
                {
                    Utility.ShowMsg("Mã giường đã tồn tại. Đề nghị bạn nhập mã khác", "Thông báo", MessageBoxIcon.Warning);
                    txtMa.Focus();
                    return(false);
                }
                sqlQuery = new Select().From(NoitruDmucGiuongbenh.Schema)
                           .Where(NoitruDmucGiuongbenh.Columns.IdBuong).IsEqualTo(Utility.sDbnull(txtBuong.MyID, ""))
                           .And(NoitruDmucGiuongbenh.Columns.TenGiuong).IsEqualTo(Utility.sDbnull(txtTEN.Text))
                           .And(NoitruDmucGiuongbenh.Columns.IdGiuong).IsNotEqualTo(Utility.Int32Dbnull(txtID.Text));
                if (sqlQuery.GetRecordCount() > 0)
                {
                    Utility.ShowMsg("Tên giường đã tồn tại. Đề nghị bạn nhập tên khác", "Thông báo", MessageBoxIcon.Warning);
                    txtTEN.Focus();
                    return(false);
                }
            }

            return(true);
        }
Example #16
0
        public void Insert(string MaKhoaphong,string TenKhoaphong,short? MaCha,short SttHthi,string MotaThem,decimal? DonGia,decimal? TamUng,string NoitruNgoaitru,byte? LaKhoacapcuu,string KieuKhoaphong,byte? PhongChucnang,string MaDonvitinh,string NguoiTao,DateTime? NgayTao,string NguoiSua,DateTime? NgaySua,string ChiDan,string MaPhongStt)
        {
            DmucKhoaphong item = new DmucKhoaphong();

            item.MaKhoaphong = MaKhoaphong;

            item.TenKhoaphong = TenKhoaphong;

            item.MaCha = MaCha;

            item.SttHthi = SttHthi;

            item.MotaThem = MotaThem;

            item.DonGia = DonGia;

            item.TamUng = TamUng;

            item.NoitruNgoaitru = NoitruNgoaitru;

            item.LaKhoacapcuu = LaKhoacapcuu;

            item.KieuKhoaphong = KieuKhoaphong;

            item.PhongChucnang = PhongChucnang;

            item.MaDonvitinh = MaDonvitinh;

            item.NguoiTao = NguoiTao;

            item.NgayTao = NgayTao;

            item.NguoiSua = NguoiSua;

            item.NgaySua = NgaySua;

            item.ChiDan = ChiDan;

            item.MaPhongStt = MaPhongStt;

            item.Save(UserName);
        }
        private void BindData()
        {
            SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema)
                                .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaLanKham.Text);

            if (sqlQuery.GetRecordCount() > 0)
            {
                _objPatientExam = sqlQuery.ExecuteSingle <KcbLuotkham>();
                if (_objPatientExam != null)
                {
                    if (ObjPhanbuonggiuong == null)
                    {
                        ObjPhanbuonggiuong = NoitruPhanbuonggiuong.FetchByID(Utility.Int32Dbnull(_objPatientExam.IdRavien, 0));
                    }
                    txtMaLanKham.Text = Utility.sDbnull(_objPatientExam.MaLuotkham);
                    txtSoBHYT.Text    = string.Format("{0}-{1}{2}", Utility.sDbnull(_objPatientExam.MatheBhyt),
                                                      Utility.sDbnull(_objPatientExam.MaNoicapBhyt), Utility.sDbnull(_objPatientExam.MaKcbbd));
                    txtphantramhuong.Text = Utility.sDbnull(_objPatientExam.PtramBhyt);
                    DmucKhoaphong objLDepartment = DmucKhoaphong.FetchByID(_objPatientExam.IdKhoanoitru);
                    if (objLDepartment != null)
                    {
                        txtDepartment_ID.Text  = Utility.sDbnull(objLDepartment.IdKhoaphong);
                        txtDepartmentName.Tag  = Utility.sDbnull(objLDepartment.IdKhoaphong);
                        txtDepartmentName.Text = Utility.sDbnull(objLDepartment.TenKhoaphong);
                        txtKhoadieutri.Text    = txtDepartmentName.Text;
                    }
                    KcbDanhsachBenhnhan objPatientInfo = KcbDanhsachBenhnhan.FetchByID(_objPatientExam.IdBenhnhan);
                    if (objPatientInfo != null)
                    {
                        txtPatient_Name.Text = Utility.sDbnull(objPatientInfo.TenBenhnhan);
                        txtPatient_ID.Text   = Utility.sDbnull(_objPatientExam.IdBenhnhan);
                        txtNamSinh.Text      = Utility.sDbnull(objPatientInfo.NamSinh);
                        txtTuoi.Text         = Utility.sDbnull(DateTime.Now.Year - objPatientInfo.NamSinh);
                        txtPatientSex.Text   = objPatientInfo.GioiTinh;
                        // Utility.Int32Dbnull(objPatientInfo.) == 0 ? "Nam" : "Nữ";
                    }
                    if (ObjPhanbuonggiuong != null)
                    {
                        txtPatientDept_ID.Text = Utility.sDbnull(ObjPhanbuonggiuong.Id);
                        txtsoluongghep.Text    = Utility.sDbnull(ObjPhanbuonggiuong.SoLuongGhep);
                        chkGhepgiuong.Checked  = Utility.Byte2Bool(ObjPhanbuonggiuong.IsGhepGiuong);
                    }
                    DataTable dtGia = new dmucgiagiuong_busrule().dsGetList("-1").Tables[0];
                    dtGia.DefaultView.Sort = NoitruGiabuonggiuong.Columns.SttHthi + "," +
                                             NoitruGiabuonggiuong.Columns.TenGia;
                    txtGia.Init(dtGia,
                                new List <string>
                    {
                        NoitruGiabuonggiuong.Columns.IdGia,
                        NoitruGiabuonggiuong.Columns.MaGia,
                        NoitruGiabuonggiuong.Columns.TenGia
                    });
                    cboGia.DataSource    = dtGia;
                    cboGia.DataMember    = NoitruGiabuonggiuong.Columns.IdGia;
                    cboGia.ValueMember   = NoitruGiabuonggiuong.Columns.IdGia;
                    cboGia.DisplayMember = NoitruGiabuonggiuong.Columns.TenGia;
                    _mDtDataRoom         = THU_VIEN_CHUNG.NoitruTimkiembuongTheokhoa(Utility.Int32Dbnull(txtDepartment_ID.Text));

                    Utility.SetDataSourceForDataGridEx_Basic(grdBuong, _mDtDataRoom, true, true, "1=1",
                                                             "sluong_giuong_trong desc,ten_buong");
                    txtRoom_code.Init(_mDtDataRoom,
                                      new List <string>
                    {
                        NoitruDmucBuong.Columns.IdBuong,
                        NoitruDmucBuong.Columns.MaBuong,
                        NoitruDmucBuong.Columns.TenBuong
                    });
                    if (grdBuong.DataSource != null)
                    {
                        grdBuong.MoveFirst();
                    }
                }
                else
                {
                    string tempt = txtMaLanKham.Text;
                    ClearControl();
                    if (_mDtDataRoom != null)
                    {
                        _mDtDataRoom.Clear();
                    }
                    if (_mDtDatabed != null)
                    {
                        if (_mDtDataRoom != null)
                        {
                            _mDtDataRoom.Clear();
                        }
                    }
                    txtMaLanKham.Text = tempt;
                    txtMaLanKham.SelectAll();
                    txtMaLanKham.Focus();
                }
            }
        }
Example #18
0
        private bool InValiData()
        {
            if (string.IsNullOrEmpty(txtMa.Text))
            {
                Utility.SetMsg(lblMessage, "Bạn phải nhập thông tin mã phòng ", true);
                txtMa.Focus();
                return(false);
            }
            if (chkcodefrom.Checked)
            {
                if (Utility.DoTrim(txtCodefrom.Text) == "")
                {
                    Utility.SetMsg(lblMessage, "Bạn phải nhập mã bắt đầu", true);
                    txtCodefrom.Focus();
                    txtCodefrom.SelectAll();
                    return(false);
                }
                if (Utility.DecimaltoDbnull(txtCodefrom.Text, 0) <= 0)
                {
                    Utility.SetMsg(lblMessage, "Hậu tố mã phòng bắt đầu phải >0", true);
                    txtCodefrom.Focus();
                    txtCodefrom.SelectAll();
                    return(false);
                }
                if (Utility.DoTrim(txtCode2.Text) == "")
                {
                    Utility.SetMsg(lblMessage, "Bạn phải nhập mã kết thúc", true);
                    txtCode2.Focus();
                    txtCode2.SelectAll();
                    return(false);
                }
                if (Utility.DecimaltoDbnull(txtCodefrom.Text, 0) > Utility.DecimaltoDbnull(txtCode2.Text, 0))
                {
                    Utility.SetMsg(lblMessage, "Hậu tố mã phòng bắt đầu < mã phòng đến", true);
                    txtCode2.Focus();
                    txtCode2.SelectAll();
                    return(false);
                }
            }
            if (string.IsNullOrEmpty(txtTEN.Text))
            {
                Utility.SetMsg(lblMessage, "Bạn phải nhập thông tin tên phòng ", true);
                txtTEN.Focus();
                return(false);
            }
            if (cboKhoaNoiTru.SelectedIndex < 0)
            {
                Utility.SetMsg(lblMessage, "Bạn phải chọn khoa nội trú ", true);
                cboKhoaNoiTru.Focus();
                return(false);
            }
            DmucKhoaphong objDmucKhoaphong = DmucKhoaphong.FetchByID(Utility.Int32Dbnull(cboKhoaNoiTru.SelectedValue));

            if (objDmucKhoaphong == null)
            {
                Utility.SetMsg(lblMessage, "Bạn chọn khoa nội trú ", true);
                cboKhoaNoiTru.Focus();
                return(false);
            }
            if (m_enAct == action.Insert)
            {
                if (!chkcodefrom.Checked)//Thêm đơn lẻ từng chiếc mới kiểm tra
                {
                    SqlQuery sqlQuery = new Select().From(NoitruDmucBuong.Schema)
                                        .Where(NoitruDmucBuong.Columns.IdKhoanoitru).IsEqualTo(Utility.Int32Dbnull(cboKhoaNoiTru.SelectedValue, ""));
                    sqlQuery.And(NoitruDmucBuong.Columns.MaBuong).IsEqualTo(Utility.sDbnull(txtMa.Text));
                    if (sqlQuery.GetRecordCount() > 0)
                    {
                        Utility.ShowMsg("Mã buồng đã tồn tại. Đề nghị bạn nhập mã khác", "Thông báo", MessageBoxIcon.Warning);
                        txtMa.Focus();
                        return(false);
                    }
                    sqlQuery = new Select().From(NoitruDmucBuong.Schema)
                               .Where(NoitruDmucBuong.Columns.IdKhoanoitru).IsEqualTo(Utility.Int32Dbnull(cboKhoaNoiTru.SelectedValue, ""));
                    sqlQuery.And(NoitruDmucBuong.Columns.TenBuong).IsEqualTo(Utility.sDbnull(txtTEN.Text));
                    if (sqlQuery.GetRecordCount() > 0)
                    {
                        Utility.ShowMsg("Tên buồng đã tồn tại. Đề nghị bạn nhập mã khác", "Thông báo", MessageBoxIcon.Warning);
                        txtTEN.Focus();
                        return(false);
                    }
                }
            }
            else
            {
                SqlQuery sqlQuery = new Select().From(NoitruDmucBuong.Schema)
                                    .Where(NoitruDmucBuong.Columns.IdKhoanoitru).IsEqualTo(Utility.sDbnull(cboKhoaNoiTru.SelectedValue, ""));
                sqlQuery.And(NoitruDmucBuong.Columns.MaBuong).IsEqualTo(Utility.sDbnull(txtMa.Text))
                .And(NoitruDmucBuong.Columns.IdBuong).IsNotEqualTo(Utility.Int32Dbnull(txtID.Text));
                if (sqlQuery.GetRecordCount() > 0)
                {
                    Utility.ShowMsg("Mã buồng đã tồn tại. Đề nghị bạn nhập mã khác", "Thông báo", MessageBoxIcon.Warning);
                    txtMa.Focus();
                    return(false);
                }
                sqlQuery = new Select().From(NoitruDmucBuong.Schema)
                           .Where(NoitruDmucBuong.Columns.IdKhoanoitru).IsEqualTo(Utility.sDbnull(cboKhoaNoiTru.SelectedValue, ""));
                sqlQuery.And(NoitruDmucBuong.Columns.TenBuong).IsEqualTo(Utility.sDbnull(txtTEN.Text))
                .And(NoitruDmucBuong.Columns.IdBuong).IsNotEqualTo(Utility.Int32Dbnull(txtID.Text));
                if (sqlQuery.GetRecordCount() > 0)
                {
                    Utility.ShowMsg("Tên buồng đã tồn tại. Đề nghị bạn nhập mã khác", "Thông báo", MessageBoxIcon.Warning);
                    txtTEN.Focus();
                    return(false);
                }
            }
            return(true);
        }
Example #19
0
        private void BindData()
        {
            SqlQuery sqlQuery = new Select().From(KcbLuotkham.Schema)
                                .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaLanKham.Text);

            if (sqlQuery.GetRecordCount() > 0)
            {
                objLuotkham = sqlQuery.ExecuteSingle <KcbLuotkham>();
                if (objLuotkham != null)
                {
                    txtMaLanKham.Text = Utility.sDbnull(objLuotkham.MaLuotkham);
                    txtSoBHYT.Text    = Utility.sDbnull(objLuotkham.MatheBhyt);
                    DmucKhoaphong objLDepartment = DmucKhoaphong.FetchByID(objLuotkham.IdKhoanoitru);
                    if (objLDepartment != null)
                    {
                        txtDepartment_ID.Text  = Utility.sDbnull(objLDepartment.IdKhoaphong);
                        txtDepartmentName.Tag  = Utility.sDbnull(objLDepartment.IdKhoaphong);
                        txtDepartmentName.Text = Utility.sDbnull(objLDepartment.TenKhoaphong);
                    }
                    KcbDanhsachBenhnhan objPatientInfo = KcbDanhsachBenhnhan.FetchByID(objLuotkham.IdBenhnhan);
                    if (objPatientInfo != null)
                    {
                        txtPatient_Name.Text = Utility.sDbnull(objPatientInfo.TenBenhnhan);
                        txtPatient_ID.Text   = Utility.sDbnull(objLuotkham.IdBenhnhan);
                        txtNamSinh.Text      = Utility.sDbnull(objPatientInfo.NamSinh);
                        txtTuoi.Text         = Utility.sDbnull(DateTime.Now.Year - objPatientInfo.NamSinh);
                        txtPatientSex.Text   = objPatientInfo.GioiTinh;                                        // Utility.Int32Dbnull(objPatientInfo.) == 0 ? "Nam" : "Nữ";
                    }
                    NoitruPhanbuonggiuong objPhanbuonggiuong = NoitruPhanbuonggiuong.FetchByID(IDBuonggiuong); // noitru_nhapvien.LaythongtinBuonggiuongHtai(objLuotkham);
                    if (objPhanbuonggiuong != null)
                    {
                        dtNgayvao.Value        = objPhanbuonggiuong.NgayVaokhoa;
                        txtPatientDept_ID.Text = Utility.sDbnull(objPhanbuonggiuong.Id);
                        NoitruDmucBuong objRoom = NoitruDmucBuong.FetchByID(objPhanbuonggiuong.IdBuong);
                        if (objRoom != null)
                        {
                            txtSoPhong.Text = Utility.sDbnull(objRoom.TenBuong);
                            txtSoPhong.Tag  = Utility.sDbnull(objPhanbuonggiuong.IdBuong);
                        }
                        NoitruDmucGiuongbenh objNoitruDmucGiuongbenh = NoitruDmucGiuongbenh.FetchByID(objPhanbuonggiuong.IdGiuong);
                        if (objNoitruDmucGiuongbenh != null)
                        {
                            txtSoGiuong.Text = Utility.sDbnull(objNoitruDmucGiuongbenh.TenGiuong);
                            txtSoGiuong.Tag  = Utility.sDbnull(objPhanbuonggiuong.IdGiuong);
                        }
                    }

                    DataTable dtGia = new dmucgiagiuong_busrule().dsGetList("-1").Tables[0];
                    dtGia.DefaultView.Sort = NoitruGiabuonggiuong.Columns.SttHthi + "," + NoitruGiabuonggiuong.Columns.TenGia;
                    txtGia.Init(dtGia,
                                new List <string>()
                    {
                        NoitruGiabuonggiuong.Columns.IdGia,
                        NoitruGiabuonggiuong.Columns.MaGia,
                        NoitruGiabuonggiuong.Columns.TenGia
                    });
                    cboGia.DataSource    = dtGia;
                    cboGia.DataMember    = NoitruGiabuonggiuong.Columns.IdGia;
                    cboGia.ValueMember   = NoitruGiabuonggiuong.Columns.IdGia;
                    cboGia.DisplayMember = NoitruGiabuonggiuong.Columns.TenGia;

                    m_dtDataRoom = THU_VIEN_CHUNG.NoitruTimkiembuongTheokhoa(Utility.Int32Dbnull(txtDepartment_ID.Text));
                    Utility.SetDataSourceForDataGridEx_Basic(grdBuong, m_dtDataRoom, true, true, "1=1", "sluong_giuong_trong desc,ten_buong");
                    txtRoom_code.Init(m_dtDataRoom, new List <string>()
                    {
                        NoitruDmucBuong.Columns.IdBuong, NoitruDmucBuong.Columns.MaBuong, NoitruDmucBuong.Columns.TenBuong
                    });
                    if (grdBuong.DataSource != null)
                    {
                        grdBuong.MoveFirst();
                    }
                }
                else
                {
                    string tempt = txtMaLanKham.Text;
                    ClearControl();
                    if (m_dtDataRoom != null)
                    {
                        m_dtDataRoom.Clear();
                    }
                    if (m_dtDatabed != null)
                    {
                        m_dtDataRoom.Clear();
                    }
                    txtMaLanKham.Text = tempt;
                    txtMaLanKham.SelectAll();
                    txtMaLanKham.Focus();
                }
            }
        }