Esempio n. 1
0
        public VerifyLogonDataSet VerifyLogon(int intEmployeeID, string strLastName)
        {
            try
            {
                aVerifyLogonDataSet      = new VerifyLogonDataSet();
                aVerifyLogonTableAdapter = new VerifyLogonDataSetTableAdapters.VerifyLogonTableAdapter();
                aVerifyLogonTableAdapter.Fill(aVerifyLogonDataSet.VerifyLogon, intEmployeeID, strLastName);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Employee DLL // Verify Employee // " + Ex.Message);
            }

            return(aVerifyLogonDataSet);
        }
        private void btnSignIn_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string strLastName;
            bool   blnThereIsAproblem = false;
            bool   blnFatalError      = false;
            string strValueForValidation;
            string strErrorMessage = "";
            int    intRecordsReturned;
            bool   blnOpenSession = false;

            TheFindPartsWarehouseDataSet = TheEmployeeClass.FindPartsWarehouses();

            try
            {
                //data validation
                strValueForValidation = pbxEmployeeID.Password;
                blnThereIsAproblem    = TheDataValidationClass.VerifyIntegerData(strValueForValidation);
                if (blnThereIsAproblem == true)
                {
                    blnFatalError   = true;
                    strErrorMessage = strErrorMessage + "The Employee ID is not an Integer\n";
                }
                else
                {
                    gintEmployeeID = Convert.ToInt32(strValueForValidation);
                }
                strLastName = txtLastName.Text;
                if (strLastName == "")
                {
                    blnFatalError   = true;
                    strErrorMessage = strErrorMessage + "The Last Name Was Not Entered\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                TheVerifyLogonDataSet = TheEmployeeClass.VerifyLogon(gintEmployeeID, strLastName);

                intRecordsReturned = TheVerifyLogonDataSet.VerifyLogon.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    LogonFailed();
                }
                else
                {
                    if (TheVerifyLogonDataSet.VerifyLogon[0].EmployeeGroup == "USERS")
                    {
                        LogonFailed();
                    }
                    else
                    {
                        blnOpenSession = CheckForOpenSession();

                        blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(gintEmployeeID, "ENTER INVENTORY // USER LOGIN");

                        if (blnFatalError == true)
                        {
                            throw new Exception();
                        }

                        if (blnOpenSession == false)
                        {
                            MainMenu MainMenu = new EnterInventory.MainMenu();
                            MainMenu.Show();
                            this.Hide();
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Enter Inventory // Main Window // Sign In Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }