private void ResetControls()
        {
            int intCounter;
            int intNumberOfRecords;

            TheFindSortedWorkTaskDataSet = TheWorkTaskClass.FindSortedWorkTask();

            intNumberOfRecords = TheFindSortedWorkTaskDataSet.FindSortedWorkTask.Rows.Count - 1;
            cboWorkTask.Items.Clear();
            cboWorkTask.Items.Add("Select Work Task");

            for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
            {
                cboWorkTask.Items.Add(TheFindSortedWorkTaskDataSet.FindSortedWorkTask[intCounter].WorkTask);
            }

            cboWorkTask.SelectedIndex = 0;

            txtEndDate.Text   = "";
            txtStartDate.Text = "";
            TheProjectTaskTotalsDataSet.projecttasktotals.Rows.Clear();
            dgrResults.ItemsSource = TheProjectTaskTotalsDataSet.projecttasktotals;
            lblWorkTask.Visibility = Visibility.Hidden;
            cboWorkTask.Visibility = Visibility.Hidden;
            cboSelectReport.Items.Clear();
            cboSelectReport.Items.Add("Select Report Type");
            cboSelectReport.Items.Add("All Work Tasks");
            cboSelectReport.Items.Add("One Work Task");
            cboSelectReport.SelectedIndex = 0;
            gblnAllTasks = true;
        }
Beispiel #2
0
        public FindSortedWorkTaskDataSet FindSortedWorkTask()
        {
            try
            {
                aFindSortedWorkTaksDataSet      = new FindSortedWorkTaskDataSet();
                aFindSortedWorkTaskTableAdapter = new FindSortedWorkTaskDataSetTableAdapters.FindSortedWorkTaskTableAdapter();
                aFindSortedWorkTaskTableAdapter.Fill(aFindSortedWorkTaksDataSet.FindSortedWorkTask);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Work Task Class // Find Sorted Work Task " + Ex.Message);
            }

            return(aFindSortedWorkTaksDataSet);
        }
        private void MitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string  strValueForValidation;
            string  strErrorMessage    = "";
            bool    blnThereIsAProblem = false;
            bool    blnFatalError      = false;
            int     intTaskCounter;
            int     intTaskNumberOfRecords;
            int     intProjectTaskCounter;
            int     intProjectTaskNumberOfRecords;
            decimal decTotalFootages;
            int     intWorkTaskID;
            string  strWorkTask;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                strValueForValidation = txtStartDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Start Date is not a Date\n";
                }
                else
                {
                    MainWindow.gdatStartDate = Convert.ToDateTime(strValueForValidation);
                }
                strValueForValidation = txtEndDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The End Date is not a Date\n";
                }
                else
                {
                    MainWindow.gdatEndDate = Convert.ToDateTime(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }
                else
                {
                    blnFatalError = TheDataValidationClass.verifyDateRange(MainWindow.gdatStartDate, MainWindow.gdatEndDate);
                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage("The Start Date is after the End Date");
                        return;
                    }
                }

                TheProjectTaskTotalsDataSet.projecttasktotals.Rows.Clear();

                if (gblnAllTasks == true)
                {
                    TheFindSortedWorkTaskDataSet = TheWorkTaskClass.FindSortedWorkTask();

                    intTaskNumberOfRecords = TheFindSortedWorkTaskDataSet.FindSortedWorkTask.Rows.Count - 1;

                    for (intTaskCounter = 0; intTaskCounter <= intTaskNumberOfRecords; intTaskCounter++)
                    {
                        intWorkTaskID = TheFindSortedWorkTaskDataSet.FindSortedWorkTask[intTaskCounter].WorkTaskID;
                        strWorkTask   = TheFindSortedWorkTaskDataSet.FindSortedWorkTask[intTaskCounter].WorkTask;

                        TheFindProjectTasksForFootageDataSet = TheProjectTaskClass.FindProjectTasksForFootage(intWorkTaskID, MainWindow.gdatStartDate, MainWindow.gdatEndDate);

                        intProjectTaskNumberOfRecords = TheFindProjectTasksForFootageDataSet.FindProjectTasksForFootage.Rows.Count - 1;

                        if (intProjectTaskNumberOfRecords > -1)
                        {
                            decTotalFootages = 0;

                            for (intProjectTaskCounter = 0; intProjectTaskCounter <= intProjectTaskNumberOfRecords; intProjectTaskCounter++)
                            {
                                decTotalFootages += TheFindProjectTasksForFootageDataSet.FindProjectTasksForFootage[intProjectTaskCounter].FootagePieces;
                            }

                            ProjectTaskTotalsDataSet.projecttasktotalsRow NewTaskRow = TheProjectTaskTotalsDataSet.projecttasktotals.NewprojecttasktotalsRow();

                            NewTaskRow.WorkTaskID    = intWorkTaskID;
                            NewTaskRow.WorkTask      = strWorkTask;
                            NewTaskRow.FootagePieces = decTotalFootages;

                            TheProjectTaskTotalsDataSet.projecttasktotals.Rows.Add(NewTaskRow);
                        }
                    }
                }
                else if (gblnAllTasks == false)
                {
                    TheFindProjectTasksForFootageDataSet = TheProjectTaskClass.FindProjectTasksForFootage(MainWindow.gintWorkTaskID, MainWindow.gdatStartDate, MainWindow.gdatEndDate);

                    intProjectTaskNumberOfRecords = TheFindProjectTasksForFootageDataSet.FindProjectTasksForFootage.Rows.Count - 1;

                    if (intProjectTaskNumberOfRecords > -1)
                    {
                        decTotalFootages = 0;

                        for (intProjectTaskCounter = 0; intProjectTaskCounter <= intProjectTaskNumberOfRecords; intProjectTaskCounter++)
                        {
                            decTotalFootages += TheFindProjectTasksForFootageDataSet.FindProjectTasksForFootage[intProjectTaskCounter].FootagePieces;
                        }

                        ProjectTaskTotalsDataSet.projecttasktotalsRow NewTaskRow = TheProjectTaskTotalsDataSet.projecttasktotals.NewprojecttasktotalsRow();

                        NewTaskRow.WorkTaskID    = MainWindow.gintWorkTaskID;
                        NewTaskRow.WorkTask      = MainWindow.gstrWorkTask;
                        NewTaskRow.FootagePieces = decTotalFootages;

                        TheProjectTaskTotalsDataSet.projecttasktotals.Rows.Add(NewTaskRow);
                    }
                }


                dgrResults.ItemsSource = TheProjectTaskTotalsDataSet.projecttasktotals;

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // View Work Task Footages // Generate Report Menu Item " + Ex.Message);

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