/// <summary>
        /// Does the login.
        /// </summary>
        /// <param name="window">The window.</param>
        /// <param name="bcApp">The bc application.</param>
        /// <param name="function_code">The function_code.</param>
        /// <param name="isForceChack">if set to <c>true</c> [is force chack].</param>
        /// <returns>Boolean.</returns>
        public static Boolean doLogin(System.Windows.Forms.IWin32Window window, BCApplication bcApp, string function_code, bool isForceChack)//A0.01
        {
            //return true;
            string  loginUserID = bcApp.LoginUserID;
            Boolean hasAuth     = false;

            if (!isForceChack && !SCUtility.isEmpty(loginUserID))
            {
                hasAuth = bcApp.SCApplication.UserBLL.checkUserAuthority(loginUserID, function_code);
            }

            if (hasAuth)
            {
                return(true);
            }

            //            LoginPopupForm loginForm = new LoginPopupForm(function_code);
            //如果已經有人登入了,就必須已切換帳號的方式再次登入
            LoginPopupForm loginForm = new LoginPopupForm(function_code, isForceChack ? false : BCUtility.isLogin(bcApp));

            System.Windows.Forms.DialogResult result = loginForm.ShowDialog(window);
            loginUserID = loginForm.getLoginUserID();
            string loginPassword = loginForm.getLoginPassword();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                loginForm.Dispose();
            }
            else
            {
                loginForm.Dispose();
                return(false);
            }
            Boolean loginSuccess = false;

            if (!SCUtility.isEmpty(loginUserID))
            {
                loginSuccess = bcApp.SCApplication.UserBLL.checkUserPassword(loginUserID, loginPassword);
            }
            if (loginSuccess)
            {
                bcApp.login(loginUserID);
                hasAuth = bcApp.SCApplication.UserBLL.checkUserAuthority(loginUserID, function_code);
            }

            if (!hasAuth)
            {
                MessageBox.Show(window, BCApplication.getMessageString("NO_AUTHORITY"),
                                BCApplication.getMessageString("WARNING"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            return(hasAuth);
        }
        /// <summary>
        /// 單純進行Login動作
        /// </summary>
        /// <param name="window">The window.</param>
        /// <param name="bcApp">The bc application.</param>
        /// <returns>Boolean.</returns>
        public static Boolean doLogin(System.Windows.Forms.IWin32Window window, BCApplication bcApp)
        {
            string  loginUserID = bcApp.LoginUserID;
            Boolean hasAuth     = false;

            if (!SCUtility.isEmpty(loginUserID))
            {
                MessageBox.Show(window, BCApplication.getMessageString("Already_Login"),
                                BCApplication.getMessageString("INFO"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            LoginPopupForm loginForm = new LoginPopupForm(BCAppConstants.FUNC_LOGIN);

            System.Windows.Forms.DialogResult result = loginForm.ShowDialog(window);
            loginUserID = loginForm.getLoginUserID();
            string loginPassword = loginForm.getLoginPassword();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                loginForm.Dispose();
            }
            else
            {
                loginForm.Dispose();
                return(false);
            }
            Boolean loginSuccess = false;

            if (!SCUtility.isEmpty(loginUserID))
            {
                loginSuccess = bcApp.SCApplication.UserBLL.checkUserPassword(loginUserID, loginPassword);
            }
            if (loginSuccess)
            {
                bcApp.login(loginUserID);
                hasAuth = bcApp.SCApplication.UserBLL.checkUserAuthority(loginUserID, BCAppConstants.FUNC_LOGIN);
                MessageBox.Show(window, BCApplication.getMessageString("Log in success."),
                                BCApplication.getMessageString("INFO"), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            if (!hasAuth)
            {
                MessageBox.Show(window, BCApplication.getMessageString("NO_AUTHORITY"),
                                BCApplication.getMessageString("WARNING"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            return(hasAuth);
        }