コード例 #1
0
        private void btnAddType_Click(object sender, EventArgs e)
        {
            decimal tmpDecimal;

            if (txtTypeId.Text == "" || !Members.validateTextBox(txtTypeId.Text))
            {
                MessageBox.Show("Please enter a Type ID. TypeID is two characters in length.", "Invalid Information");
                txtTypeId.Focus();
            }
            else if (txtTypeName.Text == "" || !Members.validateTextBox(txtTypeName.Text))
            {
                MessageBox.Show("Please enter a valid description.", "Invalid Information");
                txtTypeName.Focus();
            }
            else if (txtTypePrice.Text == "" || !decimal.TryParse(txtTypePrice.Text, out tmpDecimal))
            {
                MessageBox.Show("Please enter a valid Type Price to 2 decimal places.", "Invalid Information");
            }
            else
            {
                MemberTypes newType = new MemberTypes();

                newType.setTypeID(txtTypeId.Text);
                newType.setTypeName(txtTypeName.Text);
                newType.setTypePrice(Convert.ToDecimal(txtTypePrice.Text));

                newType.addMemberType();

                MessageBox.Show("Member Type Added!");
                frmAddType refresh = new frmAddType();
                this.Close();
                refresh.Show();
            }
        }
コード例 #2
0
        private void addMembershipTypeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmAddType newType = new frmAddType();

            this.Hide();
            newType.Show();
        }