Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.ValidateChildren())
            {
                myJuve.BirthDate     = Convert.ToDateTime(dtpBirthDate.Text);
                myJuve.FirstName     = txtFirstName.Text;
                myJuve.MiddleInitial = txtMidInit.Text;
                myJuve.LastName      = txtLastName.Text;
                myJuve.AdultMemberID = Convert.ToInt16(txtAdultMemberID.Text);

                try
                {
                    myDb.AddMember(myJuve);
                    frmMemberInfo memberInfo = new frmMemberInfo((Member)myJuve);
                    memberInfo.MdiParent = this.MdiParent;
                    memberInfo.Show();
                    this.Close();
                }
                catch (LibraryException)
                {
                    string myErr = string.Format("Add Juvenile Failed");
                    tsslStatusLabel.Text = myErr;
                    return;
                }
            }
        }
Пример #2
0
        private void getMemberInfoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //create a new member info panel, set its parent to form1 (this)
            //and open the bad boy!
            Form memberInfo = new frmMemberInfo();

            memberInfo.MdiParent = this;
            memberInfo.Show();
        }
Пример #3
0
        /// <summary>
        /// Main form that is displayed.
        /// </summary>
        public frmMain()
        {
            InitializeComponent();
            arrangeIconsToolStripMenuItem.Enabled = false;
            arrangeIconsToolStripMenuItem.Visible = false;
            //center on the screen.
            CenterToScreen();
            //open the member info panel on load.
            Form memberInfo = new frmMemberInfo();

            memberInfo.MdiParent = this;
            memberInfo.Show();
        }
Пример #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.ValidateChildren())
            {
                myAdult.FirstName     = txtFirstName.Text;
                myAdult.MiddleInitial = txtMidInit.Text;
                myAdult.LastName      = txtLastName.Text;
                myAdult.Street        = txtStreet.Text;
                myAdult.City          = txtCity.Text;
                myAdult.State         = cbState.Text;
                myAdult.ZipCode       = txtZip.Text;
                myAdult.PhoneNumber   = txtPhone.Text;

                try
                {
                    myDb.AddMember(myAdult);
                    frmMemberInfo memberInfo = new frmMemberInfo((Member)myAdult);
                    memberInfo.MdiParent = this.MdiParent;
                    memberInfo.Show();
                    this.Close();
                }
                catch (LibraryException ex)
                {
                    if (ex.LibraryErrorCode == ErrorCode.AddAdultFailed)
                    {
                        string myErr = string.Format("Add Adult Failed");
                        tsslLabel.Text = myErr;
                        return;
                    }
                    if (ex.LibraryErrorCode == ErrorCode.GenericException)
                    {
                        tsslLabel.Text = "ERROR: " + ex.Message;
                        return;
                    }
                }
            }
        }