예제 #1
0
        /// <summary>
        /// hàm thực hiện việc đăng nhập thông tin  kiểm tra
        /// quyền hợp lệ
        /// </summary>
        /// <returns></returns>
        private bool IsValid()
        {
            UIAction.SetTextStatus(lblMsg, "", false);
            if (string.IsNullOrEmpty(txtUserName.Text))
            {
                UIAction.SetTextStatus(lblMsg, "Bạn phải nhập tên đăng nhập", true);
                cmdLogin.Enabled = true;
                UIAction.FocusEditbox(txtUserName);
                b_HasSuccess = true;
                return(false);
            }
            PropertyLib._AppProperties.Makhoathien = Utility.sDbnull(cboKhoaKCB.SelectedValue, "KKB");
            globalVariables.MA_KHOA_THIEN          = PropertyLib._AppProperties.Makhoathien;
            string UserName = Utility.sDbnull(Utility.GetPropertyValue(txtUserName, "Text"));
            string Password = Utility.sDbnull(Utility.GetPropertyValue(txtPassWord, "Text"));

            b_Cancel = true;
            globalVariables.LoginSuceess = new LoginService().isAdmin(Utility.sDbnull(UserName), Utility.sDbnull(Password));
            if (globalVariables.LoginSuceess)
            {
                goto _Admin;
            }
            globalVariables.LoginSuceess = new LoginService().KiemTraUserName(Utility.sDbnull(UserName));
            if (!globalVariables.LoginSuceess)
            {
                UIAction.SetTextStatus(lblMsg, "Sai tên đăng nhập. Mời bạn nhập lại", true);
                globalVariables._NumberofBrlink = 0;
                UIAction.FocusEditbox(txtUserName);
                return(false);
            }
            globalVariables.LoginSuceess = new LoginService().KiemTraPassword(Utility.sDbnull(UserName), Utility.sDbnull(Password));
            if (!globalVariables.LoginSuceess)
            {
                UIAction.SetTextStatus(lblMsg, "Sai mật khẩu đăng nhập. Mời bạn nhập lại mật khẩu", true);
                globalVariables._NumberofBrlink = 0;
                UIAction.FocusEditbox(txtPassWord);
                return(false);
            }
            globalVariables.LoginSuceess = new LoginService().DangNhap(Utility.sDbnull(UserName), Utility.sDbnull(Password.Trim()));
            if (!globalVariables.LoginSuceess)
            {
                Utility.ShowMsg("Thông tin đăng nhập không đúng, Mời bạn nhập lại User hoặc Password", "Thông báo", MessageBoxIcon.Warning);
                globalVariables._NumberofBrlink = 0;
                UIAction.FocusEditbox(txtUserName);
                return(false);
            }

_Admin:
            b_Cancel = false;
            if (cbogiaodien.SelectedIndex == 0)
            {
                globalVariables.sMenuStyle = "MENU";
            }
            else
            {
                globalVariables.sMenuStyle = "DOCKING";
            }
            LoadDataForm();
            return(true);
        }
예제 #2
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();
            }
        }
예제 #3
0
 /// <summary>
 /// hàm thực hiện viecj đang nhập thông tin
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdLogin_Click(object sender, EventArgs e)
 {
     try
     {
         if (cboKhoaKCB.SelectedValue.ToString() == "-1")
         {
             UIAction.SetTextStatus(lblMsg, "Bạn cần chọn khoa làm việc", true);
             cboKhoaKCB.Focus();
             return;
         }
         if (cboKhoaKCB.SelectedValue.ToString().ToUpper() == globalVariables.objKhoaphong.MaKhoaphong.ToUpper())
         {
             UIAction.SetTextStatus(lblMsg, "Bạn cần chọn khoa làm việc khác khoa làm việc hiện tại (" + globalVariables.objKhoaphong.TenKhoaphong + ")", true);
             cboKhoaKCB.Focus();
             return;
         }
         if (!Utility.AcceptQuestion(string.Format("Bạn đã chắc chắn muốn chuyển từ {0} sang {1} để làm việc hay không?\nChú ý: Sau khi chuyển hệ thống sẽ tắt toàn bộ các chức năng bạn đang bật và tự động bật lại ở chế độ mới mở(Do vậy tốt hơn hết bạn cần kết thúc các công việc đang làm dang dở ở khoa {2} trước khi chuyển khoa làm việc mới)",
                                                   globalVariables.objKhoaphong.TenKhoaphong, cboKhoaKCB.Text, globalVariables.objKhoaphong.TenKhoaphong), "Xác nhận chuyển khoa", true))
         {
             return;
         }
         Application.DoEvents();
         Utility.WaitNow(this);
         cmdLogin.Enabled = false;
         if (!IsValid())
         {
             cmdLogin.Enabled = true;
             Utility.DefaultNow(this);
             return;
         }
         PropertyLib._AppProperties.Makhoathien = Utility.sDbnull(cboKhoaKCB.SelectedValue, "KKB");
         globalVariables.MA_KHOA_THIEN          = PropertyLib._AppProperties.Makhoathien;
         PropertyLib.SaveProperty(PropertyLib._AppProperties);
         b_Cancel = false;
         this.Close();
         _OnChangedDepartment();
         Utility.DefaultNow(this);
     }
     catch
     { }
     finally
     {
         cmdLogin.Enabled = true;
         Utility.DefaultNow(this);
     }
 }
예제 #4
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();
            }
        }
예제 #5
0
        /// <summary>
        ///     hàm thực hiện việc đăng nhập thông tin  kiểm tra
        ///     quyền hợp lệ
        /// </summary>
        /// <returns></returns>
        private bool IsValid()
        {
            UIAction.SetTextStatus(lblMsg, "", false);

            if (string.IsNullOrEmpty(txtUserName.Text))
            {
                UIAction.SetTextStatus(lblMsg, "Bạn phải nhập tên đăng nhập", true);
                cmdLogin.Enabled = true;
                UIAction.FocusEditbox(txtUserName);
                return(false);
            }
            if (cboKhoaKCB.Items.Count == 0 || cboKhoaKCB.SelectedValue == null ||
                cboKhoaKCB.SelectedValue.ToString() == "-1" || cboKhoaKCB.SelectedIndex < 0)
            {
                UIAction.SetTextStatus(lblMsg, "Bạn cần chọn khoa làm việc", true);
                cboKhoaKCB.Focus();
                return(false);
            }
            DmucNhanvien objNhanvien =
                new Select().From(DmucNhanvien.Schema)
                .Where(DmucNhanvien.Columns.MaNhanvien)
                .IsEqualTo(txtUserName.Text.Trim())
                .And(DmucNhanvien.Columns.TrangThai).IsEqualTo(1)
                .ExecuteSingle <DmucNhanvien>();

            if (objNhanvien == null && txtUserName.Text != @"ADMIN")
            {
                UIAction.SetTextStatus(lblMsg, "Tài khoản không được hoạt động", true);
                cmdLogin.Enabled = true;
                UIAction.FocusEditbox(txtUserName);
                return(false);
            }
            PropertyLib._AppProperties.Makhoathien = Utility.sDbnull(cboKhoaKCB.SelectedValue, "KKB");
            globalVariables.MA_KHOA_THIEN          = PropertyLib._AppProperties.Makhoathien;
            string userName = Utility.sDbnull(Utility.GetPropertyValue(txtUserName, "Text"));
            string password = Utility.sDbnull(Utility.GetPropertyValue(txtPassWord, "Text"));

            BCancel = true;
            globalVariables.LoginSuceess = new LoginService().isAdmin(Utility.sDbnull(userName),
                                                                      Utility.sDbnull(password));
            if (globalVariables.LoginSuceess)
            {
                goto _Admin;
            }

            globalVariables.LoginSuceess = new LoginService().KiemTraUserName(Utility.sDbnull(userName));
            if (!globalVariables.LoginSuceess)
            {
                UIAction.SetTextStatus(lblMsg, "Sai tên đăng nhập. Mời bạn nhập lại", true);
                globalVariables._NumberofBrlink = 0;
                UIAction.FocusEditbox(txtUserName);
                return(false);
            }
            globalVariables.LoginSuceess = new LoginService().KiemTraPassword(Utility.sDbnull(userName),
                                                                              Utility.sDbnull(password));
            if (!globalVariables.LoginSuceess)
            {
                UIAction.SetTextStatus(lblMsg, "Sai mật khẩu đăng nhập. Mời bạn nhập lại mật khẩu", true);
                globalVariables._NumberofBrlink = 0;
                UIAction.FocusEditbox(txtPassWord);
                return(false);
            }
            globalVariables.LoginSuceess = new LoginService().DangNhap(Utility.sDbnull(userName),
                                                                       Utility.sDbnull(password.Trim()));
            if (!globalVariables.LoginSuceess)
            {
                Utility.ShowMsg("Thông tin đăng nhập không đúng, Mời bạn nhập lại User hoặc Password", "Thông báo",
                                MessageBoxIcon.Warning);
                globalVariables._NumberofBrlink = 0;
                UIAction.FocusEditbox(txtUserName);
                return(false);
            }

_Admin:
            BCancel = false;
            globalVariables.sMenuStyle = cbogiaodien.SelectedIndex == 0 ? "MENU" : "DOCKING";
            if (!BlnRelogin && PropertyLib._ConfigProperties.HIS_AppMode != AppEnum.AppMode.Demo)
            {
                UIAction.SetTextStatus(lblMsg, "Đang kiểm tra giấy phép sử dụng phần mềm...", false);
                if (PropertyLib._ConfigProperties.RunUnderWS)
                {
                    //if (!IsValidSoftKey())
                    if (!WS._AdminWS.IsValidLicense())
                    {
                        globalVariables.LoginSuceess = false;
                        UIAction.SetTextStatus(lblMsg, "Phần mềm chưa đăng ký license. Đề nghị liên hệ nhà sản xuất phần mềm để được trợ giúp: 0977994312 (Mr.Ánh)",
                                               true);
                        return(false);
                    }
                    else
                    {
                        if (!WS._AdminWS.IsValidLicenseType())
                        {
                            Utility.ShowMsg("Phần mềm đã hết hạn sử dụng. Đề nghị liên hệ nhà sản xuất phần mềm để được trợ giúp:  0977994312 (Mr.Ánh)");
                            UIAction.SetTextStatus(lblMsg,
                                                   "Phần mềm đã hết hạn sử dụng. Đề nghị liên hệ nhà sản xuất phần mềm để được trợ giúp:  0977994312 (Mr.Ánh)",
                                                   true);
                            return(false);
                        }
                        //return true;
                    }
                }
                else
                {
                    if (!IsValidSoftKey())
                    {
                        globalVariables.LoginSuceess = false;
                        Utility.ShowMsg("Phần mềm chưa đăng ký license. Đề nghị liên hệ nhà sản xuất phần mềm để được trợ giúp:  0977994312 (Mr.Ánh)");
                        UIAction.SetTextStatus(lblMsg, "Phần mềm chưa đăng ký license. Đề nghị liên hệ nhà sản xuất phần mềm để được trợ giúp:  0977994312 (Mr.Ánh)",
                                               true);
                        return(false);
                    }
                    else
                    {
                        if (!IsValidLicenseType())
                        {
                            Utility.ShowMsg("Phần mềm đã hết hạn sử dụng. Đề nghị liên hệ nhà sản xuất phần mềm để được trợ giúp:  0977994312 (Mr.Ánh)");
                            UIAction.SetTextStatus(lblMsg,
                                                   "Phần mềm đã hết hạn sử dụng. Đề nghị liên hệ nhà sản xuất phần mềm để được trợ giúp:  0977994312 (Mr.Ánh)",
                                                   true);
                            return(false);
                        }
                        //return true;
                    }
                }
            }
            LoadDataForm();
            return(true);
        }
예제 #6
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();
            }
        }
예제 #7
0
 /// <summary>
 /// hàm thực hiện việc đăng nhập thông tin  kiểm tra
 /// quyền hợp lệ
 /// </summary>
 /// <returns></returns>
 private bool IsValid()
 {
     UIAction.SetTextStatus(lblMsg, "", false);
     LoadDataForm();
     return(true);
 }
예제 #8
0
        /// <summary>
        /// hàm thực hiện việc đăng nhập thông tin  kiểm tra
        /// quyền hợp lệ
        /// </summary>
        /// <returns></returns>
        private bool IsValid()
        {
            UIAction.SetTextStatus(lblMsg, "", false);

            if (string.IsNullOrEmpty(txtUserName.Text))
            {
                UIAction.SetTextStatus(lblMsg, "Bạn phải nhập tên đăng nhập", true);
                cmdLogin.Enabled = true;
                UIAction.FocusEditbox(txtUserName);
                b_HasSuccess = true;
                return(false);
            }
            //if (cboKhoaKCB.Items.Count==0 || cboKhoaKCB.SelectedValue==null || cboKhoaKCB.SelectedValue.ToString() == "-1" || cboKhoaKCB.SelectedIndex < 0)
            //{
            //    UIAction.SetTextStatus(lblMsg, "Bạn cần chọn khoa làm việc", true);
            //    cboKhoaKCB.Focus();
            //    return false;
            //}
            PropertyLib._AppProperties.Makhoathien = Utility.sDbnull(cboKhoaKCB.SelectedValue, "KKB");
            globalVariables.MA_KHOA_THIEN          = PropertyLib._AppProperties.Makhoathien;
            string UserName = Utility.sDbnull(Utility.GetPropertyValue(txtUserName, "Text"));
            string Password = Utility.sDbnull(Utility.GetPropertyValue(txtPassWord, "Text"));

            b_Cancel = true;
            globalVariables.LoginSuceess = new LoginService().isAdmin(Utility.sDbnull(UserName), Utility.sDbnull(Password));
            if (globalVariables.LoginSuceess)
            {
                goto _Admin;
            }
            globalVariables.LoginSuceess = new LoginService().KiemTraUserName(Utility.sDbnull(UserName));
            if (!globalVariables.LoginSuceess)
            {
                UIAction.SetTextStatus(lblMsg, "Sai tên đăng nhập. Mời bạn nhập lại", true);
                globalVariables._NumberofBrlink = 0;
                UIAction.FocusEditbox(txtUserName);
                return(false);
            }
            globalVariables.LoginSuceess = new LoginService().KiemTraPassword(Utility.sDbnull(UserName), Utility.sDbnull(Password));
            if (!globalVariables.LoginSuceess)
            {
                UIAction.SetTextStatus(lblMsg, "Sai mật khẩu đăng nhập. Mời bạn nhập lại mật khẩu", true);
                globalVariables._NumberofBrlink = 0;
                UIAction.FocusEditbox(txtPassWord);
                return(false);
            }
            globalVariables.LoginSuceess = new LoginService().DangNhap(Utility.sDbnull(UserName), Utility.sDbnull(Password.Trim()));
            if (!globalVariables.LoginSuceess)
            {
                Utility.ShowMsg("Thông tin đăng nhập không đúng, Mời bạn nhập lại User hoặc Password", "Thông báo", MessageBoxIcon.Warning);
                globalVariables._NumberofBrlink = 0;
                UIAction.FocusEditbox(txtUserName);
                return(false);
            }

_Admin:
            b_Cancel = false;
            if (cbogiaodien.SelectedIndex == 0)
            {
                globalVariables.sMenuStyle = "MENU";
            }
            else
            {
                globalVariables.sMenuStyle = "DOCKING";
            }
            if (!blnRelogin && PropertyLib._ConfigProperties.HIS_AppMode != VNS.Libs.AppType.AppEnum.AppMode.Demo)
            {
                UIAction.SetTextStatus(lblMsg, "Đang kiểm tra giấy phép sử dụng phần mềm...", false);
                if (PropertyLib._ConfigProperties.RunUnderWS)
                {
                    if (!WS._AdminWS.IsValidLicense())
                    {
                        globalVariables.LoginSuceess = false;
                        UIAction.SetTextStatus(lblMsg, "Phần mềm chưa đăng ký license. Đề nghị liên hệ nhà sản xuất phần mềm để được trợ giúp: 09 15 15 01 48 (Mr.Cường)", true);
                        return(false);
                    }
                }
                else
                if (!isValidSoftKey())
                {
                    globalVariables.LoginSuceess = false;
                    Utility.ShowMsg("Phần mềm chưa đăng ký license. Đề nghị liên hệ nhà sản xuất phần mềm để được trợ giúp: 09 15 15 01 48 (Mr.Cường)");
                    UIAction.SetTextStatus(lblMsg, "Phần mềm chưa đăng ký license. Đề nghị liên hệ nhà sản xuất phần mềm để được trợ giúp: 09 15 15 01 48 (Mr.Cường)", true);
                    return(false);
                }
            }
            LoadDataForm();
            return(true);
        }
예제 #9
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 bệnh...", false);
                //  globalVariables.gv_dtDmucChung = new Select().From(DmucChung.Schema).ExecuteDataSet().Tables[0];
                // 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];
                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_dtDmucDichvuCls = new Select().From(VDmucDichvucl.Schema).ExecuteDataSet().Tables[0];
                //   globalVariables.gv_dtDmucDichvuClsChitiet = new Select().From(VDmucDichvuclsChitiet.Schema).ExecuteDataSet().Tables[0];
                //globalVariables.gv_dtQheDoituongDichvu =
                //  new Select().From(QheDoituongDichvucl.Schema).ExecuteDataSet().Tables[0];
                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);
                //     globalVariables.objKhoaphong = DmucKhoaphong.FetchByID(globalVariables.idKhoatheoMay);
                //      globalVariables.objNhanvien = new Select().From(DmucNhanvien.Schema).Where(DmucNhanvien.Columns.UserName).IsEqualTo(globalVariables.UserName).ExecuteSingle<DmucNhanvien>();

                //    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();


                //var query = from o in Directory.GetFiles(Application.StartupPath + @"/Hislink_log", "*.*",
                //SearchOption.AllDirectories)
                //            let x = new FileInfo(o)
                //            where x.CreationTime <= THU_VIEN_CHUNG.GetSysDateTime().AddMonths(-6)

                //            select o;
                //foreach (var item in query)
                //{
                //    File.Delete(item);

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

            catch (Exception ex)
            {
            }
            finally
            {
                THU_VIEN_CHUNG.GetIP4Address();
                THU_VIEN_CHUNG.GetMACAddress();
                THU_VIEN_CHUNG.LoadThamSoHeThong();
            }
        }