Пример #1
0
        public FindDepartmentByNameDataSet FindDepartmentByName(string strDepartment)
        {
            try
            {
                aFindDepartmentByNameDataSet      = new FindDepartmentByNameDataSet();
                aFindDepartmentByNameTableAdapter = new FindDepartmentByNameDataSetTableAdapters.FindDepartmentByNameTableAdapter();
                aFindDepartmentByNameTableAdapter.Fill(aFindDepartmentByNameDataSet.FindDepartmentByName, strDepartment);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Department Class // Find Department By Name " + Ex.Message);
            }

            return(aFindDepartmentByNameDataSet);
        }
Пример #2
0
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            string strDepartment;
            int    intRecordsReturned;
            bool   blnFatalError = false;

            try
            {
                strDepartment = txtDepartment.Text;
                if (strDepartment.Length < 4)
                {
                    TheMessagesClass.ErrorMessage("The Department is not Long Enough");
                    return;
                }

                TheFindDepartmentByNameDataSet = TheDepartmentClass.FindDepartmentByName(strDepartment);

                intRecordsReturned = TheFindDepartmentByNameDataSet.FindDepartmentByName.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    TheMessagesClass.ErrorMessage("The Department Currently Exists");
                    return;
                }

                blnFatalError = TheDepartmentClass.InsertDepartment(strDepartment, gblnCustomerLine);

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

                TheMessagesClass.InformationMessage("The Department has been Inserted");

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Department // Submit Button " + Ex.Message);

                TheSendEmailClass.SendEventLog(Ex.ToString());

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Пример #3
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string strDepartment;
            int    intRecordsReturned;
            bool   blnFatalError = false;

            try
            {
                strDepartment = txtDepartment.Text;
                if (strDepartment == "")
                {
                    TheMessagesClass.ErrorMessage("Department Was Not Entered");
                    return;
                }

                TheFindDepartmentByNameDataSet = TheDepartmentClass.FindDepartmentByName(strDepartment);

                intRecordsReturned = TheFindDepartmentByNameDataSet.FindDepartmentByName.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    TheMessagesClass.ErrorMessage("Department was Already Added");
                    return;
                }

                blnFatalError = TheDepartmentClass.InsertDepartment(strDepartment, true);

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

                TheMessagesClass.InformationMessage("The Department Was Added");

                txtDepartment.Text = "";
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Add Department // Save Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Пример #4
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());
            }
        }
Пример #5
0
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            //this will add the files
            int      intDepartmentID;
            string   strErrorMessage = "";
            bool     blnFatalError   = false;
            int      intEmployeeID;
            DateTime datTransactionDate = DateTime.Now;
            bool     blnBoth;

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

                if (cboSelectTask.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Task Was Not Selected\n";
                }
                if (cboSelectBusinessLine.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Businesss Line Was Not Selected\n";
                }
                if (cboSelectFunction.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Function Was Not Selected\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

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

                    intDepartmentID = TheFindDepartmentByNameDataSet.FindDepartmentByName[0].DepartmentID;

                    blnFatalError = TheWorkTaskClass.InsertWorkTaskDepartment(MainWindow.gintWorkTaskID, gintBusinessLineID, intDepartmentID, intEmployeeID, datTransactionDate);

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

                    intDepartmentID = TheFindDepartmentByNameDataSet.FindDepartmentByName[0].DepartmentID;

                    blnFatalError = TheWorkTaskClass.InsertWorkTaskDepartment(MainWindow.gintWorkTaskID, gintBusinessLineID, intDepartmentID, intEmployeeID, datTransactionDate);

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

                    TheFindDepartmentByNameDataSet = TheDepartmentClass.FindDepartmentByName(gstrFunction);

                    intDepartmentID = TheFindDepartmentByNameDataSet.FindDepartmentByName[0].DepartmentID;

                    blnFatalError = TheWorkTaskClass.InsertWorkTaskDepartment(MainWindow.gintWorkTaskID, gintBusinessLineID, intDepartmentID, intEmployeeID, datTransactionDate);

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

                    gstrFunction = "UNDERGROUND";

                    TheFindDepartmentByNameDataSet = TheDepartmentClass.FindDepartmentByName(gstrFunction);

                    intDepartmentID = TheFindDepartmentByNameDataSet.FindDepartmentByName[0].DepartmentID;

                    blnFatalError = TheWorkTaskClass.InsertWorkTaskDepartment(MainWindow.gintWorkTaskID, gintBusinessLineID, intDepartmentID, intEmployeeID, datTransactionDate);

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

                TheMessagesClass.InformationMessage("The Information Has Been Inserted");

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Assign Work Task Business Line // Process Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Пример #6
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());
            }
        }