示例#1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            CompanyAccount companyAccount = new CompanyAccount()
            {
                CompanyID   = this.txtAccount.Text,
                CompanyName = this.txtCompanyName.Text,
                CompanyPwd  = this.txtPwd.Text,
                ServiceURL  = this.txtUrl.Text
            };

            if (companyAccount.CompanyID.Length == 0)
            {
                MessageBox.Show("请输入合法的企业账号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //检查账号密码是否正确,执行一次登录尝试
            if (LoginChecker.getInstance().BindingCheck(companyAccount))
            {
                using (CompanyAccountServiceBF bf = new CompanyAccountServiceBF())
                {
                    if (bf.ICompanyAccount.BindCompanyAccount(companyAccount) == "")
                    {
                        MessageBox.Show("账号绑定设置成功,请重启收费系统完成绑定操作!!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("账号绑定失败,请检查输入的URL、账号和密码是否正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
        public WebKitFrom(IMainFrm mainFrm, Iot_FunctionDefine funcDefine) : base(mainFrm)
        {
            InitializeComponent();

            this.mainFrm = mainFrm;
            this.funName = funcDefine;

            this.Text = funcDefine.FunName;

            //登陆检查
            if (LoginChecker.getInstance().Login(mainFrm))
            {
                //登录成功
                string strURL = string.Format("{0}/{1}", LoginChecker.getInstance().CompanyAccount.ServiceURL,
                                              funcDefine.URI);
                Uri url = new System.Uri(strURL, System.UriKind.Absolute);
                this.webKitBrowser1.Url = url;

                //加载
                CreateDefineBar();
                if (this.DefineBar != null)
                {
                    this.DefineBar.BarName = "bar_" + funcDefine.FunName;
                    this.DefineBar.Text    = funcDefine.FunName;
                    this.SetDock();
                }
            }
            else
            {
                this.webKitBrowser1.Url = new System.Uri(string.Format("{0}/{1}", LoginChecker.getInstance().CompanyAccount.ServiceURL,
                                                                       "Fail.html"), System.UriKind.Absolute);;
            }

            //下面加载自定义bar工具条
        }
示例#3
0
        public CompanyAccountFrom()
        {
            InitializeComponent();

            CompanyAccount companyAccount = LoginChecker.getInstance().CompanyAccount;

            if (companyAccount != null)
            {
                this.txtAccount.Text     = companyAccount.CompanyID;
                this.txtCompanyName.Text = companyAccount.CompanyName;
                this.txtUrl.Text         = companyAccount.ServiceURL;
            }
        }
 public static LoginChecker getInstance()
 {
     if (_loginChecker == null)
     {
         lock (_lock)
         {
             if (_loginChecker == null)
             {
                 _loginChecker = new LoginChecker();
             }
         }
     }
     return(_loginChecker);
 }
        public BarWebKitFrom(IMainFrm mainFrm, Iot_ChildFunctionBar functionBar)
        {
            InitializeComponent();
            this.mainFrm     = mainFrm;
            this.functionBar = functionBar;
            this.Text        = functionBar.FunName;

            //登陆检查
            if (LoginChecker.getInstance().Login(mainFrm))
            {
                //登录成功
                string strURL = string.Format("{0}/{1}", LoginChecker.getInstance().CompanyAccount.ServiceURL,
                                              functionBar.URI);
                Uri url = new System.Uri(strURL, System.UriKind.Absolute);
                this.webKitBrowser1.Url = url;
            }
            else
            {
                this.webKitBrowser1.Url = new System.Uri(string.Format("{0}/{1}", LoginChecker.getInstance().CompanyAccount.ServiceURL,
                                                                       "Fail.html"), System.UriKind.Absolute);;
            }
        }
        private void webKitBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            //登录验证
            if (this.webKitBrowser1.Url.AbsoluteUri == this.url.AbsoluteUri && isLogin)
            {
                string strScript = string.Format("$('#loginID').val('{0}@{0}');$('#loginPsw').val('{1}');", LoginChecker.getInstance().CompanyAccount.CompanyID, LoginChecker.getInstance().CompanyAccount.CompanyPwd);
                webKitBrowser1.StringByEvaluatingJavaScriptFromString(strScript);
                //MessageBox.Show(this.webKitBrowser1.DocumentText);
                webKitBrowser1.Document.InvokeScriptMethod("SFXTLogin");
                return;
            }
            //登录检查
            if (this.webKitBrowser1.Url.AbsoluteUri == this.url.AbsoluteUri && !isLogin)
            {
                webKitBrowser1.Document.InvokeScriptMethod("SfxtCheckLogin");
                return;
            }

            string result = this.webKitBrowser1.DocumentText;

            if (result.ToUpper().IndexOf("TRUE") >= 0)
            {
                this.OK = true;
            }
            else
            {
                this.OK = false;
            }
            this.Close();
        }