Пример #1
0
        } // end method AuditFields()

        /// <summary>
        /// To prompt the user to confirm form closing
        /// </summary>
        /// <param name="e">The event args</param>
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            //Get reference to admin form
            FrmEmp_Login form = Application.OpenForms["FrmEmp_Login"] as FrmEmp_Login;

            //If this general form was initiated by the login form
            if (!Owner.Equals(form))
            {
                //If user did not initiate close
                if (!userCloseFlag)
                {
                    //Prompt user - form is closing
                    DialogResult result = MessageBox.Show(GENERAL_CLOSE_MSG, GENERAL_CLOSE_CAPTION, MessageBoxButtons.YesNo);

                    //If user does want to close
                    if (result.Equals(DialogResult.No))
                    {
                        //Cancel the event
                        e.Cancel = true;

                        //Pass event changes to base method
                        base.OnFormClosing(e);
                    } // end else
                }     // end if

                userCloseFlag = false;
            } // end if
        }     // end method FrmEmp_General_FormClosing()
Пример #2
0
        } // end method PBxAdmin_Click()

        /// <summary>
        /// To show the employee login form
        /// </summary>
        /// <param name="sender">the object generating the event</param>
        /// <param name="e">the event args</param>
        private void PBxEmpPort_Click(object sender, EventArgs e)
        {
            //Create new instance of FrmEmp_Login
            FrmEmp_Login form = new FrmEmp_Login();

            //Show form
            form.ShowDialog(this);
        } // end method PBxEmpPort_Click()