Ejemplo n.º 1
0
        //Logs in the member if the log in details are correct and passes it on as the current member
        private void buttonLoginStartpage_Click(object sender, EventArgs e)
        {
            labelLogInMessageStartpage.Text = "";
            string logInMemberId = textBoxUsernameAlreadyAMemberStartpage.Text;
            string logInPassword = textBoxPasswordAlreadyAMemberStartpage.Text;

            if (CheckAllLogInTextBoxes())
            {
                try
                {
                    Member m = controller.FindMember(logInMemberId);
                    if (m.Password.Equals(logInPassword))
                    {
                        LunchSwitchProgram lunchSwitchProgram = new LunchSwitchProgram(m.MemberId);
                        this.Visible = false;
                        lunchSwitchProgram.Visible = true;
                    }
                    else
                    {
                        toolStripStatusLabelLunchSwitch.Text = "The password is incorrect";
                    }
                }
                catch (Exception ex)
                {
                    toolStripStatusLabelLunchSwitch.Text = ExceptionHandler.HandleExceptions(ex);
                }
            }
        }
Ejemplo n.º 2
0
        //Registers (creates) the new member if all information is filled in correctly
        // and passes it on as the current member
        private void buttonRegisterStartpage_Click(object sender, EventArgs e)
        {
            toolStripStatusLabelLunchSwitch.Text = "";

            string registerUserid      = textBoxUsernameStartpage.Text;
            string registerPassword    = textBoxPasswordStartpage.Text;
            string retypePassword      = textBoxRetypePassword.Text;
            string registerFullName    = textBoxNameStartpage.Text;
            string registerMobile      = textBoxPhoneStartpage.Text;
            string registerEmail       = textBoxEmailStartpage.Text;
            string registerCity        = textBoxCityStartpage.Text;
            string registerDescription = textBoxDescripstionStartpage.Text;
            string registerUserId      = textBoxUsernameAlreadyAMemberStartpage.Text;

            if (CheckAllRegisterTextBoxes())
            {
                if (registerPassword.Equals(retypePassword))
                {
                    try
                    {
                        if (controller.FindMember(registerUserid) == null)
                        {
                            Member m = new Member(registerUserid, registerCity, registerDescription, registerEmail,
                                                  registerFullName, registerMobile, registerPassword);
                            controller.AddMember(m);
                            LunchSwitchProgram lunchSwitchProgram = new LunchSwitchProgram(m.MemberId);
                            this.Visible = false;
                            lunchSwitchProgram.Visible = true;
                        }
                        else
                        {
                            toolStripStatusLabelLunchSwitch.Text = "The userid is occupied, please try another one";
                        }
                    }
                    catch (Exception ex)
                    {
                        toolStripStatusLabelLunchSwitch.Text = ExceptionHandler.HandleExceptions(ex);
                    }
                }
                else
                {
                    toolStripStatusLabelLunchSwitch.Text = "The specified passwords do not match";
                }
            }
        }