Beispiel #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bool isFound = false;
            int  member2 = thisOwlMemberList.searchOwlMemberList(Convert.ToInt32(txtTargetID.Text), out isFound);

            if (isFound)
            {
                OwlMember p = thisOwlMemberList.getAnItem(member2);
                p.Display(this);

                if (MessageBox.Show("Are you sure you want to delete", "", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                {
                    thisOwlMemberList.removeFromList(p);
                    FormController.clear(this);
                    txtTargetID.Text = "";
                }
                else
                {
                    FormController.clear(this);
                }
            }
            else
            {
                MessageBox.Show("No member exists with that ID");
            }
        }
Beispiel #2
0
        }//end btnFind

        // Validates OwlID and Tries to Find It
        private bool findAnItem
            (string operationType)
        {
            bool success;

            btnEdit.Enabled           = false;
            btnDelete.Enabled         = false;
            btnSaveEditUpdate.Enabled = false;
            if (txtTargetID.Text.Length != 9)
            {
                MessageBox.Show("Valid Owl ID required for a " + operationType + " Renter ID.",
                                "Invalid ID for " + operationType, MessageBoxButtons.OK);
                FormController.clear(this);
                txtOwlMemberID.Text = "";
                txtOwlMemberID.Focus();
                // FormController.resetForm(this);
                success = false;
            }
            else if (thisOwlMemberList.getCount() == 0)
            {
                MessageBox.Show("No Owls to " + operationType + "Try a different command.",
                                "No " + operationType + " Empty List", MessageBoxButtons.OK);
                FormController.clear(this);
                txtOwlMemberID.Text = "";
                txtOwlMemberID.Focus();
                // FormController.resetForm(this);
                success = false;
            }
            else
            {
                // Try to find and display item to process
                bool found;
                currentIndex = thisOwlMemberList.searchOwlMemberList(Convert.ToInt32(txtTargetID.Text), out found);
                if (!found)  // Display results for processing (Find, Delete, or Edit/Update)
                {
                    MessageBox.Show("Error. ID entered does not appear in the OwlList. Reenter.",
                                    "ID Not Found Error on " + operationType, MessageBoxButtons.OK);
                    txtOwlMemberID.Text = "";
                    txtOwlMemberID.Focus();
                    success = false;
                }
                else
                // Verify and then display list element and DB element
                {
                    OwlMember p = thisOwlMemberList.getAnItem(currentIndex);
                    displayRelevantFormPart(p);
                    p.Display(this);
                    success = true;
                    recordsProcessedCount++;
                } // end if-else on found
            }     // end multiple alternative if
            return(success);
        }         // end findAnItem
Beispiel #3
0
        private void btnFind_Click_1(object sender, EventArgs e)
        {
            bool isFound = false;
            int  member2 = thisOwlMemberList.searchOwlMemberList(Convert.ToInt32(txtTargetID.Text), out isFound);

            if (isFound)
            {
                OwlMember p = thisOwlMemberList.getAnItem(member2);
                p.Display(this);
            }
            else
            {
                MessageBox.Show("No member exists with that ID");
            }
        }