コード例 #1
0
        private void BtRegister_Click(object sender, RoutedEventArgs e)
        {
            string username    = tbrUsername.Text;
            string password    = tbrPassword.Text;
            string first       = tbrFirst.Text;
            string last        = tbrLast.Text;
            string title       = tbrTitle.Text;
            string description = tbrDescription.Text;

            if (inputOk(username) &&
                inputOk(password) &&
                inputOk(first) &&
                inputOk(last) &&
                inputOk(title) &&
                inputOk(description))
            {
                int userId = db.Register(username, password, first, last, title, description);
                if (userId != -1)
                {
                    ChoiceWindow main = new ChoiceWindow(userId);
                    this.Hide();
                    main.Show();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Fill all the fields");
            }
        }
コード例 #2
0
        private void BtLogin_Click(object sender, RoutedEventArgs e)
        {
            string username = tbaUsername.Text;
            string password = tbaPassword.Password;

            if (db.Login(username, password))
            {
                ChoiceWindow main = new ChoiceWindow(db.GetUserId(username, password));
                this.Hide();
                main.Show();
                this.Close();
            }
        }