private void cboSelectCrew_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //setting local variables
            int      intSelectedIndex;
            string   strCrewID;
            int      intEmployeeCounter;
            int      intEmployeeID;
            int      intProjectID;
            int      intCounter;
            int      intNumberOfRecords;
            int      intSecondCounter;
            int      intSecondNumberOfRecords;
            DateTime datTransactionDate;


            try
            {
                intSelectedIndex = cboSelectCrew.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    strCrewID = TheFindEmployeeCrewAssignmentComboBoxDataSet.FindEmployeeCrewAssignmentComboBox[intSelectedIndex].CrewID;

                    TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet = TheEmployeeCrewAssignmentClass.FindDetailedEmployeeCrewAssignmentByCrewID(strCrewID, gdatStartDate, gdatEndDate);

                    intNumberOfRecords     = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID.Rows.Count - 1;
                    gintEmployeeCounter    = TheCompareCrewEmployeesDataSet.employees.Rows.Count;
                    gintEmployeeUpperLimit = gintEmployeeCounter - 1;

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            intEmployeeID      = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].EmployeeID;
                            intProjectID       = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].ProjectID;
                            datTransactionDate = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].TransactionDate;

                            TheFindProjectTaskForProductivityReportDataSet = TheProjectTaskClass.FindProjectTaskForProductivityReport(intEmployeeID, intProjectID, datTransactionDate);

                            intSecondNumberOfRecords = TheFindProjectTaskForProductivityReportDataSet.FindProjectTaskForProductivityReport.Rows.Count;

                            for (intSecondCounter = 0; intSecondCounter < intSecondNumberOfRecords; intSecondCounter++)
                            {
                                CompareCrewEmployeesDataSet.employeesRow NewEmployeeRow = TheCompareCrewEmployeesDataSet.employees.NewemployeesRow();

                                NewEmployeeRow.AssignedProjectID = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].AssignedProjectID;
                                NewEmployeeRow.Date        = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].TransactionDate;
                                NewEmployeeRow.FirstName   = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].FirstName;
                                NewEmployeeRow.HomeOffice  = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].HomeOffice;
                                NewEmployeeRow.LastName    = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].LastName;
                                NewEmployeeRow.CrewID      = strCrewID;
                                NewEmployeeRow.WorkTask    = TheFindProjectTaskForProductivityReportDataSet.FindProjectTaskForProductivityReport[intSecondCounter].WorkTask;
                                NewEmployeeRow.TaskFootage = TheFindProjectTaskForProductivityReportDataSet.FindProjectTaskForProductivityReport[intSecondCounter].FootagePieces;

                                TheCompareCrewEmployeesDataSet.employees.Rows.Add(NewEmployeeRow);
                                gintEmployeeUpperLimit = gintEmployeeCounter;
                                gintEmployeeCounter++;
                            }
                        }
                    }

                    dgrCrews.ItemsSource = TheCompareCrewEmployeesDataSet.employees;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Compare Crews // Select Crew Combo Box " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void cboSelectCrew_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //setting local variables
            int    intSelectedIndex;
            string strCrewID;
            int    intEmployeeCounter;
            int    intEmployeeID;
            int    intProjectID;
            int    intCounter;
            int    intNumberOfRecords;
            bool   blnItemFound;
            bool   blnCrewMemberFound;


            try
            {
                intSelectedIndex = cboSelectCrew.SelectedIndex - 1;
                TheCompareCrewTasksDataSet.worktasks.Rows.Clear();
                cboSelectTask.Items.Clear();
                cboSelectTask.Items.Add("Select Work Task");

                if (intSelectedIndex > -1)
                {
                    strCrewID = TheFindEmployeeCrewAssignmentComboBoxDataSet.FindEmployeeCrewAssignmentComboBox[intSelectedIndex].CrewID;

                    TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet = TheEmployeeCrewAssignmentClass.FindDetailedEmployeeCrewAssignmentByCrewID(strCrewID, gdatStartDate, gdatEndDate);

                    intNumberOfRecords     = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID.Rows.Count - 1;
                    gintEmployeeCounter    = TheCompareCrewEmployeesDataSet.employees.Rows.Count;
                    gintEmployeeUpperLimit = gintEmployeeCounter - 1;

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            intEmployeeID      = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].EmployeeID;
                            intProjectID       = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].ProjectID;
                            blnItemFound       = false;
                            blnCrewMemberFound = false;

                            if (gintEmployeeCounter > 0)
                            {
                                for (intEmployeeCounter = 0; intEmployeeCounter <= gintEmployeeUpperLimit; intEmployeeCounter++)
                                {
                                    if (intEmployeeID == TheCompareCrewEmployeesDataSet.employees[intEmployeeCounter].EmployeeID)
                                    {
                                        blnCrewMemberFound = true;

                                        if (intProjectID == TheCompareCrewEmployeesDataSet.employees[intEmployeeCounter].ProjectID)
                                        {
                                            blnItemFound = true;
                                        }
                                    }
                                }
                            }

                            if (blnItemFound == false)
                            {
                                CompareCrewEmployeesDataSet.employeesRow NewEmployeeRow = TheCompareCrewEmployeesDataSet.employees.NewemployeesRow();

                                NewEmployeeRow.AssignedProjectID = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].AssignedProjectID;
                                NewEmployeeRow.Date       = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].TransactionDate;
                                NewEmployeeRow.EmployeeID = intEmployeeID;
                                NewEmployeeRow.FirstName  = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].FirstName;
                                NewEmployeeRow.HomeOffice = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].HomeOffice;
                                NewEmployeeRow.LastName   = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].LastName;
                                NewEmployeeRow.ProjectID  = intProjectID;
                                NewEmployeeRow.CrewID     = strCrewID;

                                TheCompareCrewEmployeesDataSet.employees.Rows.Add(NewEmployeeRow);
                                gintEmployeeUpperLimit = gintEmployeeCounter;
                                gintEmployeeCounter++;
                            }

                            if (blnCrewMemberFound == false)
                            {
                                CrewMembersDataSet.crewmembersRow NewMemberRow = TheCrewMembersDataSet.crewmembers.NewcrewmembersRow();

                                NewMemberRow.CrewID     = strCrewID;
                                NewMemberRow.EmployeeID = intEmployeeID;
                                NewMemberRow.FirstName  = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].FirstName;
                                NewMemberRow.LastName   = TheFindDetailedEmployeeCrewAssignmentByCrewIDDataSet.FindDetailedEmployeeCrewAssignmentByCrewID[intCounter].LastName;

                                TheCrewMembersDataSet.crewmembers.Rows.Add(NewMemberRow);
                            }
                        }
                    }

                    LoadTaskComboBox();

                    dgrResults.ItemsSource = TheCrewMembersDataSet.crewmembers;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Compare Employee Crews // Select Crew Combo Box " + Ex.Message);

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