Example #1
0
        public FindActiveEmployeesDataSet FindActiveEmployees()
        {
            try
            {
                aFindActiveEmployeesDataSet      = new FindActiveEmployeesDataSet();
                aFindActiveEmployeesTableAdapter = new FindActiveEmployeesDataSetTableAdapters.FindActiveEmployeesTableAdapter();
                aFindActiveEmployeesTableAdapter.Fill(aFindActiveEmployeesDataSet.FindActiveEmployees);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Employee DLL // Find Active Employee // " + Ex.Message);
            }

            return(aFindActiveEmployeesDataSet);
        }
        private void CheckEmployeePayRate()
        {
            int intCounter;
            int intNumberOfRecords;
            int intEmployeeID;
            int intRecordsReturned;
            bool blnFatalError = false;

            try
            {
                TheFindActiveEmployeesDataSet = TheEmployeeClass.FindActiveEmployees();

                intNumberOfRecords = TheFindActiveEmployeesDataSet.FindActiveEmployees.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    intEmployeeID = TheFindActiveEmployeesDataSet.FindActiveEmployees[intCounter].EmployeeID;

                    TheFindEmployeeLaborRateDataSet = TheEmployeeLaborRateClass.FindEmployeeLaborRate(intEmployeeID);

                    intRecordsReturned = TheFindEmployeeLaborRateDataSet.FindEmployeeLaborRate.Rows.Count;

                    if(intRecordsReturned == 0)
                    {
                        blnFatalError = TheEmployeeLaborRateClass.InsertEmployeeLaborRate(intEmployeeID, 1);

                        if (blnFatalError == true)
                            throw new Exception();
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Event Log Tracker // Cheeck Employee Pay Rate " + Ex.Message);

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

            
            
        }
        private void LoadDataSet()
        {
            int intCounter;
            int intNumberOfRecords;
            int intManagerID;

            try
            {
                TheEmployeeRosterDataSet.employees.Rows.Clear();

                TheFindActiveEmployeesDataSet = TheEmployeeClass.FindActiveEmployees();

                intNumberOfRecords = TheFindActiveEmployeesDataSet.FindActiveEmployees.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    intManagerID = TheFindActiveEmployeesDataSet.FindActiveEmployees[intCounter].ManagerID;

                    TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intManagerID);

                    EmployeeRosterDataSet.employeesRow NewEmployeeRow = TheEmployeeRosterDataSet.employees.NewemployeesRow();

                    NewEmployeeRow.Department       = TheFindActiveEmployeesDataSet.FindActiveEmployees[intCounter].Department;
                    NewEmployeeRow.FirstName        = TheFindActiveEmployeesDataSet.FindActiveEmployees[intCounter].FirstName;
                    NewEmployeeRow.HomeOffice       = TheFindActiveEmployeesDataSet.FindActiveEmployees[intCounter].HomeOffice;
                    NewEmployeeRow.LastName         = TheFindActiveEmployeesDataSet.FindActiveEmployees[intCounter].LastName;
                    NewEmployeeRow.ManagerFirstName = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName;
                    NewEmployeeRow.ManagerLastName  = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].LastName;

                    TheEmployeeRosterDataSet.employees.Rows.Add(NewEmployeeRow);
                }

                dgrResults.ItemsSource = TheEmployeeRosterDataSet.employees;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Employee Roster // Employee Roster Load Data Set " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void ResetControls()
        {
            //setting local variables
            int    intCounter;
            int    intNumberOfRecords;
            string strEmployee;
            string strPhoneNumber;
            string strEmailAddress;
            string strDepartment;
            string strLocation;
            string strManager;
            int    intManagerID;

            try
            {
                TheActiveEmployeeDataSet.activeemployees.Rows.Clear();

                TheFindActiveEmployeeDataSet = TheEmployeeClass.FindActiveEmployees();

                intNumberOfRecords = TheFindActiveEmployeeDataSet.FindActiveEmployees.Rows.Count;

                for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                {
                    strEmailAddress = "";
                    intManagerID    = TheFindActiveEmployeeDataSet.FindActiveEmployees[intCounter].ManagerID;
                    strEmployee     = TheFindActiveEmployeeDataSet.FindActiveEmployees[intCounter].FirstName + " ";
                    strEmployee    += TheFindActiveEmployeeDataSet.FindActiveEmployees[intCounter].LastName;
                    strPhoneNumber  = TheFindActiveEmployeeDataSet.FindActiveEmployees[intCounter].PhoneNumber;

                    if (TheFindActiveEmployeeDataSet.FindActiveEmployees[intCounter].IsEmailAddressNull() == false)
                    {
                        strEmailAddress = TheFindActiveEmployeeDataSet.FindActiveEmployees[intCounter].EmailAddress;
                    }

                    strDepartment = TheFindActiveEmployeeDataSet.FindActiveEmployees[intCounter].Department;
                    strLocation   = TheFindActiveEmployeeDataSet.FindActiveEmployees[intCounter].HomeOffice;

                    TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intManagerID);

                    strManager  = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName + " ";
                    strManager += TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].LastName;

                    ActiveEmployeeDataSet.activeemployeesRow NewEmployeeRow = TheActiveEmployeeDataSet.activeemployees.NewactiveemployeesRow();

                    NewEmployeeRow.Department   = strDepartment;
                    NewEmployeeRow.EmailAddress = strEmailAddress;
                    NewEmployeeRow.EmployeeName = strEmployee;
                    NewEmployeeRow.Location     = strLocation;
                    NewEmployeeRow.Manager      = strManager;
                    NewEmployeeRow.PhoneNumber  = strPhoneNumber;

                    TheActiveEmployeeDataSet.activeemployees.Rows.Add(NewEmployeeRow);
                }

                dgrEmployees.ItemsSource = TheActiveEmployeeDataSet.activeemployees;

                TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Employee Roster");
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Employee Roster // Reset Controls " + Ex.Message);

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