示例#1
0
        private void btnRetriveById_Click(object sender, EventArgs e)
        {
            //Remember cursor and change to wait-cursor.
            var cursorState = Cursor;

            Cursor = Cursors.WaitCursor;

            //Try to display person info
            if (string.IsNullOrEmpty(txtPersonId.Text))
            {
                lblErrorMessage.Text = "Please enter a Person ID.";
            }
            else
            {
                //Copy ID to label
                lblPersonID.Text = txtPersonId.Text;

                //First clear old results (if any)
                HerbsTools.ClearAllTextBoxes(this.Controls);

                //Display person's data
                //bool result not needed at this point. Intended for future extensions
                bool displayResult = DisplayPersonByIdData(lblPersonID.Text);
            }

            // Restore Cursor.
            Cursor = cursorState;
        }
示例#2
0
        /// <summary>
        /// Collect data and display on form. Done before calling showDialog.
        /// Entry Point before form is displayed.
        /// </summary>
        /// <returns>true if successful, false otherwise.</returns>
        public bool PrepareData()
        {
            //Define local helper variable.
            UserState myUser;

            try
            {
                //Get current user.
                myUser = FamilyTree.ReadCurrentUser();
            }
            catch
            {
                //Return false for failure.
                return(false);
            }

            //Write ID from user profile to label.
            lblUserID.Text = myUser.User.PersonId;

            //Clear old results (if any).
            HerbsTools.ClearAllTextBoxes(Controls);

            //Display person's data.
            //bool result not needed at this point. Intended for future extensions.
            bool displayResult = displayPersonByIdData(lblUserID.Text);

            //Report: action was unsuccessful.
            return(true);
        }