Esempio n. 1
0
        private void btnLoginIn_Click(object sender, EventArgs e)
        {
            try
            {
                //校验权限
                LBRegisterPermission.VerifyPermission();
                //bool IsRegister;
                //DateTime DeadLine;
                //int ProductType;
                //string RegisterInfoJson;
                //ExecuteSQL.ReadRegister(out IsRegister, out ProductType, out RegisterInfoJson, out DeadLine);
                if (LBRegisterPermission.ProductType != 0 || !LBRegisterPermission.IsRegister)
                {
                    throw new Exception("该系统未注册,请与供应商联系!");
                }
                else if (LBRegisterPermission.DeadLine.Subtract(DateTime.Now).TotalHours <= 0)
                {
                    throw new Exception("该系统注册已过期,请与供应商联系!");
                }

                VerisyIsEmpty();

                string strLoginName = this.txtLoginName.Text.TrimEnd();
                string strPassword  = this.txtPassword.Text.TrimEnd();
                bool   bolPass      = LoginInfo.VerifyLogin(strLoginName, strPassword);

                if (bolPass)
                {
                    IsLogin = true;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Esempio n. 2
0
        private void btnLoginIn_Click(object sender, EventArgs e)
        {
            try
            {
                //校验注册码
                LBEncrypt.Decrypt();

                if (LBEncrypt.ProductType != 3 || !LBEncrypt.IsRegister)
                {
                    if (LBCommonHelper.ConfirmMessage("当前电脑客户端未注册,是否现在注册?", "注册提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        frmDisk frm = new frmDisk();
                        frm.ShowDialog();
                        Application.Exit();
                    }
                    else
                    {
                        return;
                    }
                }
                if (LBEncrypt.ProductType == 3 && LBEncrypt.IsRegister && LBEncrypt.DeadLine.Subtract(DateTime.Now).TotalDays < 0)
                {
                    if (LBCommonHelper.ConfirmMessage("当前电脑客户端注册码已过期,是否现在注册?", "注册提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        frmDisk frm = new frmDisk();
                        frm.ShowDialog();
                        Application.Exit();
                    }
                    else
                    {
                        return;
                    }
                }
                //校验权限
                LBRegisterPermission.VerifyPermission();
                //bool IsRegister;
                //DateTime DeadLine;
                //int ProductType;
                //string RegisterInfoJson;
                //ExecuteSQL.ReadRegister(out IsRegister,out ProductType, out RegisterInfoJson, out DeadLine);
                if (LBRegisterPermission.ProductType != 0 || !LBRegisterPermission.IsRegister)
                {
                    throw new Exception("该系统未注册,请与供应商联系!");
                }
                else if (LBRegisterPermission.DeadLine.Subtract(DateTime.Now).TotalHours <= 0)
                {
                    throw new Exception("该系统注册已过期,请与供应商联系!");
                }

                VerisyIsEmpty();

                string strLoginName = this.txtLoginName.Text.TrimEnd();
                string strPassword  = this.txtPassword.Text.TrimEnd();
                //Thread.Sleep(2000);
                //throw new Exception("无法连接服务器,请检查网络是否畅通!");
                bool bolPass = LoginInfo.VerifyLogin(strLoginName, strPassword);

                if (bolPass)
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                LBCommonHelper.DealWithErrorMessage(ex);
            }
        }