Ejemplo n.º 1
0
        private void AddMember(object sender, EventArgs e)
        {
            Member member = new Member();

            if (MemberSubmission())
            {
                member.MemberID = MemberHelper.CreateMemberID();

                member.Username = txtUsername.Text;

                member.FirstName = txtFirstName.Text;

                member.LastName = txtLastName.Text;

                member.PIN = Convert.ToInt32(txtPIN.Text);

                if (chkAdmin.Checked is true)
                {
                    member.IsAdmin = true;
                }

                if (MemberHelper.IsMember(member))
                {
                    MessageBox.Show("Already a member. Try again.");
                }
                else
                {
                    if (MemberHelper.Register(member))
                    {
                        MessageBox.Show("Registration successful.");
                    }
                    else
                    {
                        MessageBox.Show("Registration failed. Try again.");
                    }
                }
            }
            else
            {
                MessageBox.Show("Incorrect submission. " +
                                "Please check your input.");
            }

            LoadBoxes();
        }