Exemplo n.º 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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }