Exemple #1
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (txtPassword.Text.Trim() != txtPassword2.Text.Trim())
            {
                MessageBox.Show("两次密码输入不一致!");
                return;
            }
            Users u = new Users();

            u.UserName = txtUser.Text.Trim();
            u.Password = txtPassword.Text.Trim();
            if (FileOption.readFile(u.UserName))
            {
                MessageBox.Show("当前用户已被注册!");
            }
            else
            {
                if (FileOption.writerFile(u))
                {
                    MessageBox.Show("注册成功!");
                    frmLogin l = new frmLogin();
                    l.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("注册失败!");
                }
            }
        }
Exemple #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            Users u = new Users();

            u.UserName = txtUser.Text.Trim();
            u.Password = txtPassword.Text.Trim();
            if (FileOption.readFile(u))
            {
                frmMain frmmain1 = new frmMain();
                frmmain1.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("用户名或密码错误!");
            }
        }