private void cboSelectTask_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //setting variables
            int intFirstCounter;
            int intFirstNumberOfRecords;
            int intSecondNumberOfRecords;
            int intSelectedIndex;
            int intEmployeeID;
            int intProjectID;

            try
            {
                intSelectedIndex = cboSelectTask.SelectedIndex - 1;

                if (intSelectedIndex > -1)
                {
                    MainWindow.gintWorkTaskID = TheCompareCrewTasksDataSet.worktasks[intSelectedIndex].WorkTaskID;
                    MainWindow.gstrWorkTask   = TheCompareCrewTasksDataSet.worktasks[intSelectedIndex].WorkTask;

                    intFirstNumberOfRecords = TheCompareCrewEmployeesDataSet.employees.Rows.Count - 1;

                    for (intFirstCounter = 0; intFirstCounter <= intFirstNumberOfRecords; intFirstCounter++)
                    {
                        intEmployeeID = TheCompareCrewEmployeesDataSet.employees[intFirstCounter].EmployeeID;
                        intProjectID  = TheCompareCrewEmployeesDataSet.employees[intFirstCounter].ProjectID;

                        TheFindEmployeeProjectTaskStatsDataSet = TheEmployeeProductivityStatsClass.FindEmployeeProjectTaskStats(intEmployeeID, gdatStartDate, gdatEndDate);

                        intSecondNumberOfRecords = TheFindEmployeeProjectTaskStatsDataSet.FindEmployeeProjectTaskStats.Rows.Count - 1;
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Compare Employee Crews // Select Task Combo Box " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            string strValueForValidation;
            string strErrorMessage    = "";
            bool   blnThereIsAProblem = false;
            bool   blnFatalError      = false;
            int    intCounter;
            int    intNumberOfRecords;
            string strProjectID;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();
            gdecTotalHours = 0;
            TheEmployeeProjectTaskDataSet.projecttask.Rows.Clear();

            try
            {
                if (cboSelectEmployee.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "An Employee Has Not Been Selected\n";
                }
                strValueForValidation = txtEnterStartDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Start Date is not a Date\n";
                }
                else
                {
                    gdatStartDate = Convert.ToDateTime(strValueForValidation);
                }
                strValueForValidation = txtEnterEndDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The End Date is not a Date\n";
                }
                else
                {
                    gdatEndDate = Convert.ToDateTime(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                blnFatalError = TheDataValidationClass.verifyDateRange(gdatStartDate, gdatEndDate);
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("The Start Date is after the End Date");
                    return;
                }

                TheFindEmployeeProjectTasksDataSet = TheEmployeeProductivityStatsClass.FindEmployeeProjectTaskStats(MainWindow.gintEmployeeID, gdatStartDate, gdatEndDate);
                TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(MainWindow.gintEmployeeID);

                intNumberOfRecords = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats.Rows.Count - 1;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        strProjectID = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].AssignedProjectID;
                        TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProjectID);

                        EmployeeProjectTaskDataSet.projecttaskRow NewProjectTaskRow = TheEmployeeProjectTaskDataSet.projecttask.NewprojecttaskRow();

                        NewProjectTaskRow.AssignedProjectID  = strProjectID;
                        NewProjectTaskRow.HomeOffice         = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].HomeOffice;
                        NewProjectTaskRow.ProjectName        = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectName;
                        NewProjectTaskRow.TotalFootagePieces = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].TotalFootage;
                        NewProjectTaskRow.TotalHours         = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].TaskTotalHours;
                        NewProjectTaskRow.WorkTask           = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].WorkTask;
                        gdecTotalHours += TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].TaskTotalHours;

                        TheEmployeeProjectTaskDataSet.projecttask.Rows.Add(NewProjectTaskRow);
                    }
                }


                dgrResults.ItemsSource = TheEmployeeProjectTaskDataSet.projecttask;
                txtTotalHours.Text     = Convert.ToString(gdecTotalHours);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Find Employee Hours // Generate Report Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }