public FindWorkTaskDepartmentWorkTaskMatchDataSet FindWorkTaskDepartmentWorkTaskMatch(int intWorkTaskID, int intBusinessLineID, int intDepartmentID)
        {
            try
            {
                aFindWorkTaskDepartmentWorkTaskMatchDataSet      = new FindWorkTaskDepartmentWorkTaskMatchDataSet();
                aFindWorkTaskDepartmentWorkTaskMatchTableAdapter = new FindWorkTaskDepartmentWorkTaskMatchDataSetTableAdapters.FindWorkTaskDepartmentWorkTaskMatchTableAdapter();
                aFindWorkTaskDepartmentWorkTaskMatchTableAdapter.Fill(aFindWorkTaskDepartmentWorkTaskMatchDataSet.FindWorkTaskDepartmentWorkTaskMatch, intWorkTaskID, intBusinessLineID, intDepartmentID);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Work Task Class // Find Work Task Department Work Task Match " + Ex.Message);
            }

            return(aFindWorkTaskDepartmentWorkTaskMatchDataSet);
        }
Exemple #2
0
        private void expProcessImport_Expanded(object sender, RoutedEventArgs e)
        {
            int      intCounter;
            int      intNumberOfRecords;
            int      intWorkTaskID;
            int      intDepartmentID;
            int      intBusinessLineID;
            int      intEmployeeID;
            DateTime datTransactionDate;
            bool     blnFatalError = false;
            string   strWorkTask;
            int      intRecordsReturned;

            try
            {
                expProcessImport.IsExpanded = false;

                intNumberOfRecords = TheProductionCodesForImportDataSet.productioncodes.Rows.Count;
                intEmployeeID      = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;

                for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                {
                    datTransactionDate = DateTime.Now;
                    intWorkTaskID      = TheProductionCodesForImportDataSet.productioncodes[intCounter].WorkTaskID;
                    intDepartmentID    = TheProductionCodesForImportDataSet.productioncodes[intCounter].DepartmentID;
                    intBusinessLineID  = TheProductionCodesForImportDataSet.productioncodes[intCounter].BusinessLineID;

                    if (intWorkTaskID < 0)
                    {
                        strWorkTask = TheProductionCodesForImportDataSet.productioncodes[intCounter].WorkTask;

                        TheFindWorkTaskByTaskKeyWordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strWorkTask);

                        intRecordsReturned = TheFindWorkTaskByTaskKeyWordDataSet.FindWorkTaskByTaskKeyword.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            blnFatalError = TheWorkTaskClass.InsertWorkTask(strWorkTask, 0);

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

                            TheFindWorkTaskByTaskKeyWordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strWorkTask);

                            intWorkTaskID = TheFindWorkTaskByTaskKeyWordDataSet.FindWorkTaskByTaskKeyword[0].WorkTaskID;
                        }
                        else if (intRecordsReturned > 0)
                        {
                            intWorkTaskID = TheFindWorkTaskByTaskKeyWordDataSet.FindWorkTaskByTaskKeyword[0].WorkTaskID;
                        }
                    }

                    TheFindWorkTaskDepartmentWorkTaskMatchDataSet = TheWorkTaskClass.FindWorkTaskDepartmentWorkTaskMatch(intWorkTaskID, intBusinessLineID, intDepartmentID);

                    intRecordsReturned = TheFindWorkTaskDepartmentWorkTaskMatchDataSet.FindWorkTaskDepartmentWorkTaskMatch.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        blnFatalError = TheWorkTaskClass.InsertWorkTaskDepartment(intWorkTaskID, intBusinessLineID, intDepartmentID, intEmployeeID, datTransactionDate);

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

                TheMessageClass.InformationMessage("The Codes have been Imported");

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Codes For Sheets // Process Import Expanded " + Ex.Message);

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