コード例 #1
0
        /// <summary>
        /// Account creation event handler.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void createAccount_btn_Click(object sender, EventArgs e)
        {
            string potentialUser = username_txtBox.Text;
            string potentialPass = password_txtBox.Text;

            if (potentialUser != "" && password_txtBox.TextLength >= REQ_PASS_LENGTH && legalNames(potentialUser, potentialPass))
            {
                if (!controller.isDuplicateUsername(potentialUser))
                {
                    Account newAccount = new Account(potentialUser, potentialPass);
                    controller.addAccount(newAccount);
                    invalidcredentials_lbl.Text = "";
                    controller.writeNewAccountToFile(newAccount);
                    this.Hide();
                    ListRecordForm lrf = new ListRecordForm(recController);
                    lrf.ShowDialog();
                    this.Close();
                }
                else
                {
                    invalidcredentials_lbl.Text = "Username Taken";
                }
            }
            else if (password_txtBox.TextLength < REQ_PASS_LENGTH)
            {
                invalidcredentials_lbl.Text = "Pass Too Short. (6+)";
            }
            else
            {
                invalidcredentials_lbl.Text = "Invalid Character: ' : '";
            }
        }
コード例 #2
0
        /// <summary>
        /// Naviagtes back to ListRecordForm after operations are done on this form.
        /// </summary>
        private void NavigateBackToHome()
        {
            this.Hide();
            ListRecordForm lrf = new ListRecordForm(controller);

            lrf.ShowDialog();
            this.Close();
        }
コード例 #3
0
        private void backBtn_Click(object sender, EventArgs e)
        {
            this.Hide();
            ListRecordForm lrf = new ListRecordForm(controller);

            lrf.ShowDialog();
            this.Close();
        }
コード例 #4
0
        /// <summary>
        /// Event handler for logging in
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void login_btn_Click(object sender, EventArgs e)
        {
            Account acct = controller.verifyAccountLogin(username_txtBox.Text, password_txtBox.Text);

            if (acct != null)
            {
                this.Hide();
                ListRecordForm lrf = new ListRecordForm(recController);
                lrf.ShowDialog();
                this.Close();
            }

            else
            {
                invalidcredentials_lbl.Text = "Invalid Credentials";
            }
        }