Ejemplo n.º 1
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtDisk.Text.TrimEnd() != "" && this.txtRegister.Text.TrimEnd() != "")
                {
                    //先校验注册码是否合法
                    string strDiskID = LBEncrypt.GetDiskID();//硬盘ID
                    try
                    {
                        string strDecrypt = LBEncrypt.DecryptAes(this.txtRegister.Text, "linrubin" + strDiskID);
                        if (!strDecrypt.Contains("ProductType"))
                        {
                            throw new Exception("注册码不合法!");
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("注册码不合法!");
                    }

                    string   strIniPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LBTSR.ini");
                    IniClass iniClass   = new IniClass(strIniPath);
                    iniClass.WriteValue("TSR", "value", this.txtRegister.Text.TrimEnd());

                    MessageBox.Show("注册成功!");
                    this.Close();
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
Ejemplo n.º 2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                this.txtDisk.Text     = LBEncrypt.GetDiskID();
                this.txtRegister.Text = LBEncrypt.GetRegisterCode();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
Ejemplo n.º 3
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);
            }
        }