예제 #1
0
        public void ButtonClickCommandImpl()
        {
            if (CheckIfEmpty.Method(_rp.TypePasswordTxtBox.Text, _rp.ConfirmPasswordTxtBox.Text) == true)
            {
                if (CheckIfEqual.Method(_rp.TypePasswordTxtBox.Text, _rp.ConfirmPasswordTxtBox.Text) == true)
                {
                    if (_rp.TypePasswordTxtBox.Text.Length < 26 && _rp.ConfirmPasswordTxtBox.Text.Length < 26)
                    {
                        UserData userData = new UserData();
                        userData.AccountNumber = int.Parse(_rp.AccountNumberLabelOutput.Content.ToString());
                        userData.Password      = _rp.TypePasswordTxtBox.Text;
                        userData.Amount        = 0;
                        userData.IsAdmin       = false;

                        _mw.db.UserDatas.Add(userData);
                        _mw.db.SaveChanges();

                        _mw.MainFrame.Content = new StartPage(_mw);
                    }
                    else
                    {
                        _rp.ConfirmPasswordTxtBox.Text = string.Empty;
                        _rp.TypePasswordTxtBox.Text    = string.Empty;
                    }
                }
            }
            else
            {
                _rp.TypePasswordTxtBox.Text    = string.Empty;
                _rp.ConfirmPasswordTxtBox.Text = string.Empty;
            }
        }
예제 #2
0
        private void btnMain_Click(object sender, RoutedEventArgs e)
        {
            if (CheckIfEmpty.Method(this.TypePasswordTxtBox.Text, this.ConfirmPasswordTxtBox.Text) == true && CheckIfEqual.Method(this.TypePasswordTxtBox.Text, this.ConfirmPasswordTxtBox.Text) == true)
            {
                UserData tempUserData = (from x in _mw.db.UserDatas
                                         where x.AccountNumber == _userData.AccountNumber
                                         select x).First();

                tempUserData.Password = this.ConfirmPasswordTxtBox.Text;
                _mw.db.SaveChanges();
                _mw.MainFrame.Content = new StartPage(_mw);
            }
            else
            {
                this.TypePasswordTxtBox.Text    = string.Empty;
                this.ConfirmPasswordTxtBox.Text = string.Empty;
            }
        }