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

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

                member.Username = txtUsername3.Text;

                member.FirstName = txtFirstName2.Text;

                member.LastName = txtLastName2.Text;

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

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

                if (MemberDB.IsMember(member))
                {
                    MessageBox.Show("Already a member. Try again.");
                }
                else
                {
                    if (MemberDB.Register(member))
                    {
                        MessageBox.Show("Registration successful.");
                    }
                    else
                    {
                        MessageBox.Show("Registration failed. Try again.");
                    }
                }
            }
            else
            {
                MessageBox.Show("Incorrect submission. " +
                                "Fields empty or incorrectly filled.");
            }

            LoadBoxes();
        }