Пример #1
0
        /// <summary>
        /// Opens a Modal instance of the Occupation Code Setup Screen.
        /// </summary>
        /// <param name="AOccupationCode">Pass in the selected Occupation's code.</param>
        /// <param name="AParentForm"></param>
        /// <returns>True if an Occupation was found and accepted by the user, otherwise false.</returns>
        public static bool OpenModalForm(ref String AOccupationCode,
                                         Form AParentForm)
        {
            DialogResult dlgResult;

            TFrmOccupationCodeSetup SelectOccupation = new TFrmOccupationCodeSetup(AParentForm);

            SelectOccupation.SetParameters(AOccupationCode);

            dlgResult = SelectOccupation.ShowDialog();

            if (dlgResult == DialogResult.OK)
            {
                POccupationRow SelectedRow = SelectOccupation.GetSelectedDetailRow();

                if (SelectedRow == null)
                {
                    MessageBox.Show(String.Format("No valid Occupation Code has been selected."), String.Format("Find Occupation Code"),
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    AOccupationCode = SelectOccupation.GetSelectedDetailRow().OccupationCode;
                }

                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Opens a Modal instance of the Occupation Code Setup Screen.
        /// </summary>
        /// <param name="AOccupationCode">Pass in the selected Occupation's code.</param>
        /// <param name="AParentForm"></param>
        /// <returns>True if an Occupation was found and accepted by the user, otherwise false.</returns>
        public static bool OpenModalForm(ref String AOccupationCode,
            Form AParentForm)
        {
            DialogResult dlgResult;

            TFrmOccupationCodeSetup SelectOccupation = new TFrmOccupationCodeSetup(AParentForm);

            SelectOccupation.SetParameters(AOccupationCode);

            dlgResult = SelectOccupation.ShowDialog();

            if (dlgResult == DialogResult.OK)
            {
                POccupationRow SelectedRow = SelectOccupation.GetSelectedDetailRow();

                if (SelectedRow == null)
                {
                    MessageBox.Show(String.Format("No valid Occupation Code has been selected."), String.Format("Find Occupation Code"),
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    AOccupationCode = SelectOccupation.GetSelectedDetailRow().OccupationCode;
                }

                return true;
            }

            return false;
        }