Exemplo n.º 1
0
        private void TxtEnterTask_TextChanged(object sender, TextChangedEventArgs e)
        {
            string strWorkTask;
            int    intLength;
            int    intCounter;
            int    intNumberOfRecords;

            strWorkTask = txtEnterTask.Text;
            intLength   = strWorkTask.Length;
            if (intLength > 2)
            {
                TheFindWorkTaskKeywordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strWorkTask);

                intNumberOfRecords = TheFindWorkTaskKeywordDataSet.FindWorkTaskByTaskKeyword.Rows.Count - 1;

                if (intNumberOfRecords < 0)
                {
                    TheMessagesClass.ErrorMessage("Task Not Found");
                    return;
                }

                cboSelectTask.Items.Clear();
                cboSelectTask.Items.Add("Select Work Task");

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    cboSelectTask.Items.Add(TheFindWorkTaskKeywordDataSet.FindWorkTaskByTaskKeyword[intCounter].WorkTask);
                }

                cboSelectTask.SelectedIndex = 0;
            }
        }
        private void txtNewTask_TextChanged(object sender, TextChangedEventArgs e)
        {
            int    intNumberOfRecords;
            string strWorkTask;
            int    intLength;

            try
            {
                strWorkTask = txtNewTask.Text;
                intLength   = strWorkTask.Length;

                if (intLength > 2)
                {
                    //dgrNewTask.Items.Clear();

                    TheFindWorktaskByTaskKeywordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strWorkTask);

                    intNumberOfRecords = TheFindWorktaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword.Rows.Count - 1;

                    if (intNumberOfRecords < 0)
                    {
                        TheMessagesClass.ErrorMessage("The Work Task Entered Does Not Exist");
                        return;
                    }

                    dgrNewTask.ItemsSource = TheFindWorktaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Project Work // New Task Text Box " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemplo n.º 3
0
        public FindWorkTaskByTaskKeywordDataSet FindWorkTaskByTaskKeyword(string strWorkTask)
        {
            try
            {
                aFindWorkTaskByTaskKeywordDataSet      = new FindWorkTaskByTaskKeywordDataSet();
                aFindWorkTaskByTaskKeywordTableAdapter = new FindWorkTaskByTaskKeywordDataSetTableAdapters.FindWorkTaskByTaskKeywordTableAdapter();
                aFindWorkTaskByTaskKeywordTableAdapter.Fill(aFindWorkTaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword, strWorkTask);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Work Task Class // Find Work Task By Task Key Word " + Ex.Message);
            }

            return(aFindWorkTaskByTaskKeywordDataSet);
        }
        private void txtOldTaskName_TextChanged(object sender, TextChangedEventArgs e)
        {
            string strOldTask;
            int    intLength;
            int    intCounter;
            int    intnumberOfRecords;

            try
            {
                strOldTask = txtOldTaskName.Text;
                intLength  = strOldTask.Length;

                if (intLength >= 2)
                {
                    TheOldWorkTasksDataSet.worktask.Rows.Clear();

                    TheFindWorktaskByTaskKeywordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strOldTask);

                    intnumberOfRecords = TheFindWorktaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword.Rows.Count - 1;

                    if (intnumberOfRecords < 0)
                    {
                        TheMessagesClass.ErrorMessage("The Work Task Was Not Found ");
                        return;
                    }

                    for (intCounter = 0; intCounter <= intnumberOfRecords; intCounter++)
                    {
                        OldWorkTasksDataSet.worktaskRow NewTaskRow = TheOldWorkTasksDataSet.worktask.NewworktaskRow();

                        NewTaskRow.ChangeItems = false;
                        NewTaskRow.WorkTask    = TheFindWorktaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword[intCounter].WorkTask;
                        NewTaskRow.WorkTaskID  = TheFindWorktaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword[intCounter].WorkTaskID;

                        TheOldWorkTasksDataSet.worktask.Rows.Add(NewTaskRow);
                    }

                    dgrOldTasks.ItemsSource = TheOldWorkTasksDataSet.worktask;
                }
            }
            catch (Exception EX)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Project Work Task // Old Task Name Change " + EX.Message);

                TheMessagesClass.ErrorMessage(EX.ToString());
            }
        }
Exemplo n.º 5
0
        private void txtEnterWorkTask_TextChanged(object sender, TextChangedEventArgs e)
        {
            string strWorkTask;
            int    intLength;
            int    intNumberOfRecords;
            int    intCounter;

            try
            {
                strWorkTask = txtEnterWorkTask.Text;

                intLength = strWorkTask.Length;

                if (intLength >= 2)
                {
                    cboSelectWorkTask.Items.Clear();
                    cboSelectWorkTask.Items.Add("Select Work Task");

                    TheFindWorkTaskByTaskKeywordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strWorkTask);

                    intNumberOfRecords = TheFindWorkTaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword.Rows.Count - 1;

                    if (intNumberOfRecords == -1)
                    {
                        TheMessagesClass.InformationMessage("The Work Task Entered Does Not Exist");
                        return;
                    }

                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        cboSelectWorkTask.Items.Add(TheFindWorkTaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword[intCounter].WorkTask);
                    }

                    cboSelectWorkTask.SelectedIndex = 0;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Work Task // Enter Work Task Text Box " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemplo n.º 6
0
        private void txtEnterTaskCode_TextChanged(object sender, TextChangedEventArgs e)
        {
            //setting local variables
            string strWorkTask;
            int    intCounter;
            int    intNumberOfRecords;

            try
            {
                strWorkTask = txtEnterTaskCode.Text;

                if (strWorkTask.Length > 2)
                {
                    TheFindWorkTaskByTaskKeywordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strWorkTask);

                    cboSelectTask.Items.Clear();
                    cboSelectTask.Items.Add("Select Task");

                    intNumberOfRecords = TheFindWorkTaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword.Rows.Count;

                    if (intNumberOfRecords < 1)
                    {
                        TheMessagesClass.ErrorMessage("Task Was Not Found");
                        return;
                    }

                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        cboSelectTask.Items.Add(TheFindWorkTaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword[intCounter].WorkTask);
                    }

                    cboSelectTask.SelectedIndex = 0;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Assign Work Task Business Lines // Enter Task Code Text Box " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemplo n.º 7
0
        private void txtEnterTask_TextChanged(object sender, TextChangedEventArgs e)
        {
            string strWorkTask;
            int    intCounter;
            int    intNumberOfRecords;

            try
            {
                strWorkTask = txtEnterTask.Text;
                if (strWorkTask.Length > 2)
                {
                    TheFindWorkTaskByTaskKeyWordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strWorkTask);
                    cboSelectTask.Items.Clear();
                    cboSelectTask.Items.Add("Select Work Task");

                    intNumberOfRecords = TheFindWorkTaskByTaskKeyWordDataSet.FindWorkTaskByTaskKeyword.Rows.Count;

                    if (intNumberOfRecords < 1)
                    {
                        TheMessagesClass.ErrorMessage("The Work Task was not Found");
                        return;
                    }

                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        cboSelectTask.Items.Add(TheFindWorkTaskByTaskKeyWordDataSet.FindWorkTaskByTaskKeyword[intCounter].WorkTask);
                    }

                    cboSelectTask.SelectedIndex = 0;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Productivity Work Task // Enter Task Text Box " + Ex.Message);

                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Add Productivity Work Task // Enter Task Text Box " + Ex.ToString());

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemplo n.º 8
0
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            string   strWorkTask;
            string   strCode;
            int      intRecordsReturned;
            bool     blnFatalError   = false;
            string   strErrorMessage = "";
            decimal  decCost;
            int      intEmployeeID;
            DateTime datTransactionDate = DateTime.Now;

            try
            {
                decCost       = 0;
                intEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;

                strWorkTask = txtEnterWorkTask.Text;
                if (strWorkTask.Length < 5)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Work Task is not Long Enough\n";
                }
                else
                {
                    strCode = strWorkTask.Substring(0, 7);

                    TheFindWorkTaskByTaskKeywordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strCode);

                    intRecordsReturned = TheFindWorkTaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Code is Already Been Used\n";
                    }
                }
                if (cboSelectBusinesLine.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Business Line was not Selected\n";
                }
                if (cboSelectDepartment.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Department was not Selected\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                blnFatalError = TheWorkTaskClass.InsertWorkTask(strWorkTask, decCost);

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

                TheFindWorkTaskByTaskKeywordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strWorkTask);

                gintWorkTaskID = TheFindWorkTaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword[0].WorkTaskID;

                if (gstrDepartment == "AERIAL")
                {
                    TheFindDepartmentByNameDataSet = TheDepartmentClass.FindDepartmentByName(gstrDepartment);

                    gintDepartment = TheFindDepartmentByNameDataSet.FindDepartmentByName[0].DepartmentID;

                    blnFatalError = TheWorkTaskClass.InsertWorkTaskDepartment(gintWorkTaskID, gintBusinesLineID, gintDepartment, intEmployeeID, datTransactionDate);

                    if (blnFatalError == true)
                    {
                        throw new Exception();
                    }
                }
                else if (gstrDepartment == "UNDERGROUND")
                {
                    TheFindDepartmentByNameDataSet = TheDepartmentClass.FindDepartmentByName(gstrDepartment);

                    gintDepartment = TheFindDepartmentByNameDataSet.FindDepartmentByName[0].DepartmentID;

                    blnFatalError = TheWorkTaskClass.InsertWorkTaskDepartment(gintWorkTaskID, gintBusinesLineID, gintDepartment, intEmployeeID, datTransactionDate);

                    if (blnFatalError == true)
                    {
                        throw new Exception();
                    }
                }
                else if (gstrDepartment == "BOTH")
                {
                    gstrDepartment = "AERIAL";

                    TheFindDepartmentByNameDataSet = TheDepartmentClass.FindDepartmentByName(gstrDepartment);

                    gintDepartment = TheFindDepartmentByNameDataSet.FindDepartmentByName[0].DepartmentID;

                    blnFatalError = TheWorkTaskClass.InsertWorkTaskDepartment(gintWorkTaskID, gintBusinesLineID, gintDepartment, intEmployeeID, datTransactionDate);

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

                    gstrDepartment = "UNDERGROUND";

                    TheFindDepartmentByNameDataSet = TheDepartmentClass.FindDepartmentByName(gstrDepartment);

                    gintDepartment = TheFindDepartmentByNameDataSet.FindDepartmentByName[0].DepartmentID;

                    blnFatalError = TheWorkTaskClass.InsertWorkTaskDepartment(gintWorkTaskID, gintBusinesLineID, gintDepartment, intEmployeeID, datTransactionDate);

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

                TheMessagesClass.InformationMessage("The Work Task Has Been Inserted");

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Add Work Task // Process Button " + Ex.Message);

                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Work Task // Process Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemplo n.º 9
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());
            }
        }
Exemplo n.º 10
0
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            int    intWorkTaskID = 0;
            string strWorkTask   = "";
            string strWorkTaskID = "";
            string strBusinessLine;
            string strBusinessLineID;
            int    intBusinessLineID;
            string strDepartment;
            int    intDepartmentID;
            int    intDepartmentID2 = 0;
            string strDepartment2   = "";
            bool   blnAll           = false;
            int    intRecordsReturned;


            try
            {
                expImportExcel.IsExpanded = false;
                TheProductionCodesForImportDataSet.productioncodes.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    blnAll          = false;
                    strWorkTaskID   = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strWorkTask     = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();
                    intWorkTaskID   = Convert.ToInt32(strWorkTaskID);
                    strBusinessLine = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();
                    strDepartment   = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2).ToUpper();

                    TheFindWorkTaskByTaskKeyWordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strWorkTask);

                    intRecordsReturned = TheFindWorkTaskByTaskKeyWordDataSet.FindWorkTaskByTaskKeyword.Rows.Count;

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

                    TheFindDepartmentByNameDataSet = TheDepartmentClass.FindDepartmentByName(strBusinessLine);

                    intBusinessLineID = TheFindDepartmentByNameDataSet.FindDepartmentByName[0].DepartmentID;

                    if (strDepartment == "ALL")
                    {
                        strDepartment  = "AERIAL";
                        strDepartment2 = "UNDERGROUND";
                        blnAll         = true;
                    }

                    TheFindDepartmentByNameDataSet = TheDepartmentClass.FindDepartmentByName(strDepartment);

                    intDepartmentID = TheFindDepartmentByNameDataSet.FindDepartmentByName[0].DepartmentID;

                    TheFindWorkTaskByTaskIDDataSet = TheWorkTaskClass.FindWorkTaskByWorkTaskID(intWorkTaskID);

                    ProductionCodesForImportDataSet.productioncodesRow NewProductionCode = TheProductionCodesForImportDataSet.productioncodes.NewproductioncodesRow();

                    NewProductionCode.BusinessLine   = strBusinessLine;
                    NewProductionCode.BusinessLineID = intBusinessLineID;
                    NewProductionCode.Department     = strDepartment;
                    NewProductionCode.DepartmentID   = intDepartmentID;
                    NewProductionCode.WorkTask       = strWorkTask;
                    NewProductionCode.WorkTaskID     = intWorkTaskID;

                    TheProductionCodesForImportDataSet.productioncodes.Rows.Add(NewProductionCode);

                    if (blnAll == true)
                    {
                        TheFindDepartmentByNameDataSet = TheDepartmentClass.FindDepartmentByName(strDepartment2);

                        intDepartmentID2 = TheFindDepartmentByNameDataSet.FindDepartmentByName[0].DepartmentID;

                        ProductionCodesForImportDataSet.productioncodesRow NewProductionCode2 = TheProductionCodesForImportDataSet.productioncodes.NewproductioncodesRow();

                        NewProductionCode2.BusinessLine   = strBusinessLine;
                        NewProductionCode2.BusinessLineID = intBusinessLineID;
                        NewProductionCode2.Department     = strDepartment2;
                        NewProductionCode2.DepartmentID   = intDepartmentID2;
                        NewProductionCode2.WorkTask       = strWorkTask;
                        NewProductionCode2.WorkTaskID     = intWorkTaskID;

                        TheProductionCodesForImportDataSet.productioncodes.Rows.Add(NewProductionCode2);
                    }
                }

                dgrProductionCodes.ItemsSource = TheProductionCodesForImportDataSet.productioncodes;

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Codes for Sheets // Import Excel  " + Ex.Message);

                TheMessageClass.ErrorMessage(Ex.ToString());
            }
        }
        private void mitProcess_Click(object sender, RoutedEventArgs e)
        {
            //setting variables
            int  intTaskCounter;
            int  intTaskNumberOfRecords;
            int  intTaskID;
            int  intEmployeeCounter;
            int  intEmployeeNumberOfRecords;
            int  intTransactionID;
            bool blnFatalError = false;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                intTaskNumberOfRecords = TheOldWorkTasksDataSet.worktask.Rows.Count - 1;

                for (intTaskCounter = 0; intTaskCounter <= intTaskNumberOfRecords; intTaskCounter++)
                {
                    if (TheOldWorkTasksDataSet.worktask[intTaskCounter].ChangeItems == true)
                    {
                        intTaskID = TheOldWorkTasksDataSet.worktask[intTaskCounter].WorkTaskID;

                        TheFindEmployeeProjectAssignmentByTaskIDDataSet = TheEmployeeProjectAssignmentClass.FindEmployeeProjectAssignementByTaskID(intTaskID);

                        intEmployeeNumberOfRecords = TheFindEmployeeProjectAssignmentByTaskIDDataSet.FindEmployeeProjectAssignmentByTaskID.Rows.Count - 1;

                        for (intEmployeeCounter = 0; intEmployeeCounter <= intEmployeeNumberOfRecords; intEmployeeCounter++)
                        {
                            intTransactionID = TheFindEmployeeProjectAssignmentByTaskIDDataSet.FindEmployeeProjectAssignmentByTaskID[intEmployeeCounter].TransactionID;

                            blnFatalError = TheEmployeeProjectAssignmentClass.UpdateEmployeeProjectAssignmentTaskID(intTransactionID, gintNewTaskID);

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

                        blnFatalError = TheWorkTaskClass.UpdateWorkTaskActive(intTaskID, false);

                        TheFindProjectTaskByTaskIDDataSet = TheProjectTaskClass.FindProjectTaskByTaskID(intTaskID);

                        intEmployeeNumberOfRecords = TheFindProjectTaskByTaskIDDataSet.FindProjectTaskByTaskID.Rows.Count - 1;

                        for (intEmployeeCounter = 0; intEmployeeCounter <= intEmployeeNumberOfRecords; intEmployeeCounter++)
                        {
                            intTransactionID = TheFindProjectTaskByTaskIDDataSet.FindProjectTaskByTaskID[intEmployeeCounter].TransactionID;

                            blnFatalError = TheProjectTaskClass.UpdateProjectTaskID(intTransactionID, intTaskCounter);

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

                TheMessagesClass.InformationMessage("All Tasks Have Been Updated");
                TheOldWorkTasksDataSet.worktask.Rows.Clear();
                dgrOldTasks.ItemsSource             = TheOldWorkTasksDataSet.worktask;
                TheFindWorktaskByTaskKeywordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword("llllllllll");
                dgrNewTask.ItemsSource = TheFindWorktaskByTaskKeywordDataSet.FindWorkTaskByTaskKeyword;
                txtNewTask.Text        = "";
                txtOldTaskName.Text    = "";
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Project Work Task // Process Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }
Exemplo n.º 12
0
        private void txtEnterLastName_TextChanged(object sender, TextChangedEventArgs e)
        {
            string   strValueForValidation;
            bool     blnFatalError = false;
            string   strLastName;
            int      intLength;
            int      intCounter;
            int      intNumberOfRecords;
            DateTime datEndDate;

            try
            {
                CheckProject();


                strValueForValidation = txtDriveTime.Text;
                blnFatalError         = TheDataValidationClass.VerifyDoubleData(strValueForValidation);
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("The Drive Time is not Entered");
                    return;
                }
                else
                {
                    gdecDriveTime = Convert.ToDecimal(strValueForValidation);

                    if (gdecDriveTime == 0)
                    {
                        TheMessagesClass.ErrorMessage("The Drive Time Cannot be 0");
                        return;
                    }
                    else if (gdecDriveTime > 16)
                    {
                        TheMessagesClass.ErrorMessage("Drive Time Cannot Be Greater Than 16");
                        return;
                    }

                    TheFindWorkTaskByKeywordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword("DRIVE TIME");

                    gintDriveTimeTaskID = TheFindWorkTaskByKeywordDataSet.FindWorkTaskByTaskKeyword[0].WorkTaskID;
                }
                strValueForValidation = txtNonProductive.Text;
                blnFatalError         = TheDataValidationClass.VerifyDoubleData(strValueForValidation);
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("The Non-Productivity Time is not Numeric\n");
                    return;
                }
                else
                {
                    gdecNonProductiveTime = Convert.ToDecimal(strValueForValidation);
                }


                datEndDate = TheDateSearchClass.SubtractingDays(DateTime.Now, 21);

                strLastName = txtEnterLastName.Text;
                intLength   = strLastName.Length;

                if (intLength > 2)
                {
                    cboSelectEmployee.Items.Clear();
                    cboSelectEmployee.Items.Add("Select Employee");

                    TheFindEmployeeByLastNameEndDateDataSet = TheEmployeeClass.FindEmployeeByLastNameEndDate(strLastName, datEndDate);

                    intNumberOfRecords = TheFindEmployeeByLastNameEndDateDataSet.FindEmployeesByLastNameEndDate.Rows.Count - 1;

                    if (intNumberOfRecords == -1)
                    {
                        TheMessagesClass.InformationMessage("Employee Not Found");
                        return;
                    }
                    else
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            cboSelectEmployee.Items.Add(TheFindEmployeeByLastNameEndDateDataSet.FindEmployeesByLastNameEndDate[intCounter].FirstName + " " + TheFindEmployeeByLastNameEndDateDataSet.FindEmployeesByLastNameEndDate[intCounter].LastName);
                        }
                    }

                    cboSelectEmployee.SelectedIndex = 0;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Project Labor // Enter Last Name Text Box " + Ex.Message);

                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Add Project Labor // Enter Last Name Text Box " + Ex.ToString());

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void expProcessImport_Expanded(object sender, RoutedEventArgs e)
        {
            int    intCounter;
            int    intNumberOfRecords;
            int    intWorkTaskID;
            string strWorkTask;
            string strLaborCode;
            string strLaborType;
            string strItemFunction;
            string strItemDescription;
            string strUnitOfMeasure;
            int    intRecordsReturned;
            bool   blnFatalError = false;

            try
            {
                intNumberOfRecords = TheImportWorkTaskDataSet.importworktask.Rows.Count;

                for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                {
                    intWorkTaskID      = TheImportWorkTaskDataSet.importworktask[intCounter].WorkTaskID;
                    strWorkTask        = TheImportWorkTaskDataSet.importworktask[intCounter].WorkTask;
                    strLaborCode       = TheImportWorkTaskDataSet.importworktask[intCounter].LaborCode;
                    strLaborType       = TheImportWorkTaskDataSet.importworktask[intCounter].LaborType;
                    strItemFunction    = TheImportWorkTaskDataSet.importworktask[intCounter].ItemFunction;
                    strItemDescription = TheImportWorkTaskDataSet.importworktask[intCounter].ItemDescription;
                    strUnitOfMeasure   = TheImportWorkTaskDataSet.importworktask[intCounter].UnitOfMeasure;

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

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

                        TheFindWorkTaskByKeywordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strLaborCode);

                        intWorkTaskID = TheFindWorkTaskByKeywordDataSet.FindWorkTaskByTaskKeyword[0].WorkTaskID;
                    }
                    else if (intWorkTaskID > 0)
                    {
                        blnFatalError = TheWorkTaskClass.UpdateWorkTask(intWorkTaskID, strWorkTask, 0);

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

                    TheFindWorkTaskImportByLaborCodeDataSet = TheWorkTaskClass.FindWorkTaskImportByLaborCode(strLaborCode);

                    intRecordsReturned = TheFindWorkTaskImportByLaborCodeDataSet.FindWorkTaskImportByLaborCode.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        blnFatalError = TheWorkTaskClass.InsertWorkTaskImport(intWorkTaskID, strLaborCode, strLaborType, strItemFunction, strItemDescription, strUnitOfMeasure);

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

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

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

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            int    intRecordsReturned;
            int    intWorkTaskID = 0;
            string strWorkTask   = "";
            string strLaborCode;
            string strLaborType;
            string strItemFunction;
            string strItemDescription;
            string strUnitOfMeasure;


            try
            {
                expImportExcel.IsExpanded = false;
                TheImportWorkTaskDataSet.importworktask.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName   = "Document";             // Default file name
                dlg.DefaultExt = ".xlsx";                // Default file extension
                dlg.Filter     = "Excel (.xlsx)|*.xlsx"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strLaborCode       = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strLaborType       = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();
                    strItemFunction    = Convert.ToString((range.Cells[intCounter, 3] as Excel.Range).Value2).ToUpper();
                    strItemDescription = Convert.ToString((range.Cells[intCounter, 4] as Excel.Range).Value2).ToUpper();
                    strUnitOfMeasure   = Convert.ToString((range.Cells[intCounter, 5] as Excel.Range).Value2).ToUpper();

                    TheFindWorkTaskImportByLaborCodeDataSet = TheWorkTaskClass.FindWorkTaskImportByLaborCode(strLaborCode);

                    intRecordsReturned = TheFindWorkTaskImportByLaborCodeDataSet.FindWorkTaskImportByLaborCode.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        TheFindWorkTaskByKeywordDataSet = TheWorkTaskClass.FindWorkTaskByTaskKeyword(strLaborCode);

                        intRecordsReturned = TheFindWorkTaskByKeywordDataSet.FindWorkTaskByTaskKeyword.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            intWorkTaskID = intCounter * -1;
                            strWorkTask   = strLaborCode + " - " + strItemFunction;
                        }
                        else if (intRecordsReturned > 0)
                        {
                            intWorkTaskID = TheFindWorkTaskByKeywordDataSet.FindWorkTaskByTaskKeyword[0].WorkTaskID;
                            strWorkTask   = TheFindWorkTaskByKeywordDataSet.FindWorkTaskByTaskKeyword[0].WorkTask;
                        }

                        ImportWorkTaskDataSet.importworktaskRow NewWorkTaskRow = TheImportWorkTaskDataSet.importworktask.NewimportworktaskRow();

                        NewWorkTaskRow.ItemDescription = strItemDescription;
                        NewWorkTaskRow.ItemFunction    = strItemDescription;
                        NewWorkTaskRow.LaborCode       = strLaborCode;
                        NewWorkTaskRow.LaborType       = strLaborType;
                        NewWorkTaskRow.UnitOfMeasure   = strUnitOfMeasure;
                        NewWorkTaskRow.WorkTask        = strWorkTask;
                        NewWorkTaskRow.WorkTaskID      = intWorkTaskID;

                        TheImportWorkTaskDataSet.importworktask.Rows.Add(NewWorkTaskRow);
                    }
                }

                dgrProductionCodes.ItemsSource = TheImportWorkTaskDataSet.importworktask;


                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Import Production Codes // Import Excel  " + Ex.Message);

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