Пример #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            User newUserLogin = new User();

            newUserLogin.UserId  = txtLoginID.Text;
            newUserLogin.UserPwd = txtPassword.Text;
            if (chbRememberLogin.Checked)
            {
                Properties.Settings.Default.user     = txtLoginID.Text;
                Properties.Settings.Default.password = txtPassword.Text;
                Properties.Settings.Default.Save();
            }
            else
            {
                Properties.Settings.Default.user     = "";
                Properties.Settings.Default.password = "";
                Properties.Settings.Default.Save();
            }
            if (ValidateUser(newUserLogin))
            {
                MessageBox.Show("Welcome Back " + txtLoginID.Text);
                frmContacts fContact = new frmContacts();
                fContact.frmName = txtLoginID.Text;
                this.Visible     = false;
                fContact.ShowDialog();
            }
            else
            {
                MessageBox.Show("User or Password is incorrect");
                txtLoginID.Focus();
            }
        }
Пример #2
0
        private void btnSignUp_Click(object sender, EventArgs e)
        {
            User newUser = new User();

            newUser.UserId = txtUsername.Text;
            string password   = txtPassword.Text;
            string rePassword = txtRePassword.Text;

            if (password == rePassword)
            {
                newUser.UserPwd = txtPassword.Text;
                if (users.SignUpNewUser(newUser))
                {
                    MessageBox.Show("Sign Up Successfull");
                    MessageBox.Show("Welcome" + txtUsername.Text);
                    this.Visible = false;
                    frmContacts fContact = new frmContacts();
                    fContact.frmName = txtUsername.Text;
                    fContact.ShowDialog();
                }
            }
        }