Ejemplo n.º 1
0
        }/*private void BtnClear_Click(object sender, EventArgs e)*/

        /// <summary>
        /// Occurs when the user hits the Enter button. The code that the employee
        /// entered will be queried against the database. If the code exists within
        /// the system, open the MainPoSForm. Else, display and error message.
        /// </summary>
        /// <remarks>
        /// NAME: BtnEnter_Click
        /// AUTHOR: Ryan Osgood
        /// DATE: 8/17/2019
        /// </remarks>
        /// <param name="sender">The button that triggers this event - the Enter button.</param>
        /// <param name="e">The EventArgs associated with this event.</param>
        private void BtnEnter_Click(object sender, EventArgs e)
        {
            m_enteredCode = int.Parse(m_strCode);

            try
            {
                m_conn.Query    = @"SELECT * FROM public.tbl_employees WHERE employeeCode = :enteredCode";
                m_conn.SetLogin = m_enteredCode;

                m_pgresDataSet = m_conn.QueryEmployeeIdentification();
                m_maxRows      = m_pgresDataSet.Count;

                if (m_maxRows > 0 && m_serializedForm == null)
                {
                    var mainPoS = new MainPoSForm(m_enteredCode);
                    mainPoS.Show();
                    Hide();
                }
                else if (m_maxRows > 0 && m_serializedForm != null)
                {
                    MainPoSForm newMainPoSForm = new MainPoSForm(m_enteredCode);
                    newMainPoSForm = m_serializedForm;
                    newMainPoSForm.Show();
                    Hide();
                }
                else
                {
                    lblError.Text = @"Employee Code not found. Try again.";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }/*private void BtnEnter_Click(object sender, EventArgs e)*/
Ejemplo n.º 2
0
        } /*private void ClearMembers()*/

        /// <summary>
        /// This event occurs when this Form's visibility changes. The Owner
        /// property is not null when this Form is being manipulated from another Form.
        /// This allows the ability to 'save' the Owner Form, in this case MainPoSMenu.
        /// </summary>
        /// <remarks>
        /// NAME: Form1_VisibleChanged
        /// AUTHOR: Ryan Osgood
        /// DATE: 8/17/2019
        /// </remarks>
        /// <param name="sender">The object that triggered the event - Form1</param>
        /// <param name="e">The EventArgs associated with this event.</param>
        private void Form1_VisibleChanged(object sender, EventArgs e)
        {
            Form1 temp = sender as Form1;

            if (temp.Owner != null)
            {
                m_serializedForm = (MainPoSForm)temp.Owner;
            }

            ClearMembers();
        } /*private void Form1_VisibleChanged(object sender, EventArgs e)*/