Exemple #1
0
        private void dgrProjects_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataGrid     dataGrid;
            DataGridRow  selectedRow;
            DataGridCell ProjectID;
            string       strProjectID;

            try
            {
                if (dgrProjects.SelectedIndex > -1)
                {
                    //setting local variable
                    dataGrid     = dgrProjects;
                    selectedRow  = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromIndex(dataGrid.SelectedIndex);
                    ProjectID    = (DataGridCell)dataGrid.Columns[0].GetCellContent(selectedRow).Parent;
                    strProjectID = ((TextBlock)ProjectID.Content).Text;

                    TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID);

                    //find the record
                    MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;

                    UpdateSelectedProject UpdateSelectedProject = new UpdateSelectedProject();
                    UpdateSelectedProject.ShowDialog();

                    ResetControls();
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Invoiced Project Reports // Projects Grid Selection " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemple #2
0
        private void txtCustomerProjectID_TextChanged(object sender, TextChangedEventArgs e)
        {
            string strCustomerProjectID;
            int    intLength;
            int    intRecordsReturned;
            int    intBusinessLineID;

            try
            {
                strCustomerProjectID  = txtCustomerProjectID.Text;
                gstrAssignedProjectID = strCustomerProjectID;
                intLength             = strCustomerProjectID.Length;

                if (((intLength > 5) && (intLength < 12)) && gblnDoNotRun == false)
                {
                    TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strCustomerProjectID);

                    intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        gintProjectID     = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;
                        intBusinessLineID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].BusinessLineID;

                        TheFindProductionProjectInfoDataSet = TheProductionProjectClass.FindProductionProjectInfo(gintProjectID);

                        intRecordsReturned = TheFindProductionProjectInfoDataSet.FindProductionProjectInfo.Rows.Count;

                        if ((intRecordsReturned < 1) && (intBusinessLineID == 1009))
                        {
                            TheMessagesClass.InformationMessage("There is no Production Project Info Entered, The Window will now Open");

                            MainWindow.gintProjectID = gintProjectID;

                            AddProductionProjectInfo AddProductionProjectInfo = new AddProductionProjectInfo();
                            AddProductionProjectInfo.ShowDialog();
                        }

                        gblnProjectExists = true;

                        FillControls();
                    }
                }
                else if (intLength >= 12)
                {
                    TheMessagesClass.ErrorMessage("The Project is not the Correct Format");
                    return;
                }
            }
            catch (Exception Ex)
            {
                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Edit Project // Customer Project ID Text Box " + Ex.ToString());

                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Edit Project // Customer Project ID Text Box " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemple #3
0
        private void btnFindProduction_Click(object sender, RoutedEventArgs e)
        {
            string strProjectID;
            int    intProjectID = 0;
            int    intLength;
            int    intRecordsReturned;

            try
            {
                strProjectID = txtEnterProjectID.Text;

                TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID);

                intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count;

                if (intRecordsReturned < 1)
                {
                    TheFindProjectmatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID);

                    intRecordsReturned = TheFindProjectmatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        TheMessagesClass.ErrorMessage("Project Not Found");
                        return;
                    }

                    intProjectID = TheFindProjectmatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;
                }
                else if (intRecordsReturned > 0)
                {
                    intProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID;
                }

                TheFindProductionCostsByProjectIDDataSet = TheEmployeeProjectAssignmentClass.FindProjectProductionCostsByProjectID(intProjectID);

                dgrProduction.ItemsSource = TheFindProductionCostsByProjectIDDataSet.FindProjectProductionCostsByProjectID;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Project Management Report // Find Production Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void mitCheckProject_Click(object sender, RoutedEventArgs e)
        {
            string strProjectID;
            int    intRecordsReturned;

            if (gblnProjectFound == false)
            {
                strProjectID = txtEnterProjectID.Text;

                TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID);

                intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID);

                    intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheMessagesClass.ErrorMessage("Project Not Found, A Valid Project Must Be Entered");
                        return;
                    }
                    else
                    {
                        MainWindow.gintProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID;
                    }
                }
                else
                {
                    MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;
                }

                TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(MainWindow.gintProjectID);

                MainWindow.gstrAssignedProjectID = strProjectID;

                txtProjectName.Text = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectName;
            }
        }
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            int    intRecordsReturned;
            string strProjectID         = "";
            string strAssignedProjectID = "";
            string strProjectName       = "";
            string strBusinessLine      = "";
            int    intManagerID;
            int    intInspectionEmployeeID;
            string strFirstName;
            string strLastName;
            int    intCounter;
            int    intNumberOfRecords;

            try
            {
                strProjectID = txtEnterProjectID.Text;

                TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID);

                intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                if (intRecordsReturned < 1)
                {
                }
                else if (intRecordsReturned > 0)
                {
                    strAssignedProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].AssignedProjectID;
                    //strProjectName = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].n
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // JSI Project Reports // Find Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemple #6
0
        private void expCheckProject_Expanded(object sender, RoutedEventArgs e)
        {
            string strCustomerProjectID;
            int    intRecordsReturned;

            expCheckProject.IsExpanded = false;
            strCustomerProjectID       = txtCustomerProjectID.Text;

            TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strCustomerProjectID);

            intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

            if (intRecordsReturned < 1)
            {
                TheMessagesClass.ErrorMessage("Project Not Found");
                return;
            }
            else
            {
                gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;

                FillControls();
            }
        }
        private void expFindItems_Expanded(object sender, RoutedEventArgs e)
        {
            bool     blnThereIsAProblem = false;
            bool     blnFatalError      = false;
            string   strErrorMessage    = "";
            string   strValueForValidation;
            string   strProjectID;
            DateTime datTransactionDate = DateTime.Now;
            int      intRecordsReturned;
            int      intProjectID = 0;
            int      intCounter;
            int      intNumberForRecords;

            try
            {
                expFindItems.IsExpanded = false;

                TheDriveTimeForVoidingDataSet.drivetimeforvoiding.Rows.Clear();

                if (cboSelectEmployee.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Employee Has Not Been Selected\n";
                }
                strProjectID = txtProjectID.Text;
                if (strProjectID.Length < 4)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Project ID Is Not Long Enough\n";
                }
                else
                {
                    TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID);

                    intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        intProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;
                    }
                    else if (intRecordsReturned < 1)
                    {
                        TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID);

                        intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            intProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID;
                        }
                        else if (intRecordsReturned < 1)
                        {
                            strErrorMessage += "The Project Was Not Found\n";
                        }
                    }
                }
                strValueForValidation = txtDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Date Entered is not a Date\n";
                }
                else
                {
                    datTransactionDate = Convert.ToDateTime(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                TheFindDriveTimeForVoidingDataSet = TheEmployeeProjectAssignmentClass.FindDriveTimeForVoiding(datTransactionDate, MainWindow.gintEmployeeID, intProjectID);

                intNumberForRecords = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding.Rows.Count;

                if (intNumberForRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberForRecords; intCounter++)
                    {
                        DriveTimeForVoidingDataSet.drivetimeforvoidingRow NewDriveTime = TheDriveTimeForVoidingDataSet.drivetimeforvoiding.NewdrivetimeforvoidingRow();

                        NewDriveTime.FirstName        = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding[intCounter].FirstName;
                        NewDriveTime.LastName         = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding[intCounter].LastName;
                        NewDriveTime.ProjectID        = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding[intCounter].CustomerAssignedID;
                        NewDriveTime.TransactionDate  = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding[intCounter].TransactionDate;
                        NewDriveTime.TransactionID    = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding[intCounter].TransactionID;
                        NewDriveTime.VoidTransactions = false;
                        NewDriveTime.WorkTask         = TheFindDriveTimeForVoidingDataSet.FindDriveTimeForVoiding[intCounter].WorkTask;

                        TheDriveTimeForVoidingDataSet.drivetimeforvoiding.Rows.Add(NewDriveTime);
                    }
                }

                dgrResults.ItemsSource = TheDriveTimeForVoidingDataSet.drivetimeforvoiding;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Void Drive Time // Find Items Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void btnProcess_Click(object sender, RoutedEventArgs e)
        {
            bool     blnThereIsAProblem = false;
            bool     blnFatalError      = false;
            string   strErrorMessage    = "";
            string   strProjectID;
            string   strPartNumber;
            string   strPONumber;
            string   strAssignedReelID;
            int      intReelFootage = 0;
            int      intRecordsReturned;
            string   strValueForValidation;
            DateTime datTransactionDate = DateTime.Now;
            int      intPartID          = 0;
            int      intTransactionID;
            int      intTotalFootage;

            try
            {
                blnFatalError = TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Add Cable Reel ");

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

                if (cboSelectWarehouse.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Warehouse Was Not Selected\n";
                }
                strProjectID = txtProjectID.Text;
                if (strProjectID.Length < 3)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Project ID is not Long Enough\n";
                }
                else
                {
                    TheFindProjectMatrixByCustomerIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID);

                    intRecordsReturned = TheFindProjectMatrixByCustomerIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID);

                        intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            blnFatalError    = true;
                            strErrorMessage += "The Project ID Was Not Found\n";
                        }
                    }
                    else if (intRecordsReturned > 0)
                    {
                        MainWindow.gintProjectID = TheFindProjectMatrixByCustomerIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;
                    }
                }
                strPartNumber = txtPartNumber.Text;
                if (strPartNumber.Length < 3)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Part Number is not Long Enough\n";
                }
                else
                {
                    TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                    intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Part Number Was Not Found\n";
                    }
                    else if (intRecordsReturned > 0)
                    {
                        intPartID = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                    }
                }
                if (cboSelectEmployee.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Employee Was Not Selected\n";
                }
                strPONumber = txtPONumber.Text;
                if (strPONumber.Length < 3)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The MSR/PO Number is not Long Enough\n";
                }
                strAssignedReelID = txtAssignedReelID.Text;
                if (strAssignedReelID.Length < 3)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Assigned Reel ID is not Long Enough\n";
                }
                else
                {
                    TheFindCableReelIDByAssignedCableReelIDDataSet = TheCableInventoryClass.FindCableReelIDByAssignedCableReelID(strAssignedReelID);

                    intRecordsReturned = TheFindCableReelIDByAssignedCableReelIDDataSet.FindCableReelIDByAssignedCableReelID.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Assigned Reel ID has been Used\n";
                    }
                }
                strValueForValidation = txtReelFootage.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyIntegerData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Reel Footage is not an Integer\n";
                }
                else
                {
                    intReelFootage = Convert.ToInt32(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                //adding cable reel
                if (gblnReelIDChecked == true)
                {
                    blnFatalError = TheCableInventoryClass.UpdateCableAssignedReelID(gintReelID, strAssignedReelID);

                    if (blnFatalError == true)
                    {
                        throw new Exception();
                    }
                }
                else if (gblnReelIDChecked == false)
                {
                    blnFatalError = TheCableInventoryClass.InsertCableReelID(datTransactionDate, intPartID, MainWindow.gintEmployeeID, strAssignedReelID);

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

                TheFindCableReelIDByAssignedCableReelIDDataSet = TheCableInventoryClass.FindCableReelIDByAssignedCableReelID(strAssignedReelID);

                gintReelID = TheFindCableReelIDByAssignedCableReelIDDataSet.FindCableReelIDByAssignedCableReelID[0].CableReelID;

                //inserting the reel into the table
                blnFatalError = TheCableInventoryClass.InsertCableReelInventory(intPartID, MainWindow.gintWarehouseID, strAssignedReelID, intReelFootage);

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

                //updating total footage
                TheFindCableTotalInventoryByPartWarehouseDataSet = TheCableInventoryClass.FindCableTotalInventoryByPartWarehouse(MainWindow.gintWarehouseID, intPartID);

                intRecordsReturned = TheFindCableTotalInventoryByPartWarehouseDataSet.FindCableTotalInventoryByPartWarehouse.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    intTransactionID = TheFindCableTotalInventoryByPartWarehouseDataSet.FindCableTotalInventoryByPartWarehouse[0].TransactionID;
                    intTotalFootage  = TheFindCableTotalInventoryByPartWarehouseDataSet.FindCableTotalInventoryByPartWarehouse[0].TotalFootage;

                    intTotalFootage = intTotalFootage + intReelFootage;

                    blnFatalError = TheCableInventoryClass.UpdateCableIventoryTotalFootage(intTransactionID, intTotalFootage);

                    if (blnFatalError == true)
                    {
                        throw new Exception();
                    }
                }
                else if (intRecordsReturned < 1)
                {
                    blnFatalError = TheCableInventoryClass.InsertCableTotalInventory(intPartID, MainWindow.gintWarehouseID, intReelFootage);

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

                TheMessagesClass.InformationMessage("Cable Reel Has Been Received");

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

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void expImportExcel_Expanded(object sender, RoutedEventArgs e)
        {
            //setting up local variables
            string   strValueForValidation = "";
            int      intEmployeeID         = 0;
            bool     blnFatalError         = false;
            bool     blnThereIsAProblem    = false;
            string   strErrorMessage       = "";
            int      intRecordsReturned;
            string   strAssignedProjectID = "";
            string   strCustomerProjectID = "";
            int      intProjectID         = 0;
            DateTime datTransactionDate   = DateTime.Now;
            int      intSecondProjectID   = 0;
            int      intColumnRange       = 0;
            int      intCounter;
            int      intNumberOfRecords;
            bool     blnDoNotImport;

            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            try
            {
                expImportExcel.IsExpanded = false;

                if (cboSelectDepartment.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Department Was Not Selected\n";
                }
                if (cboSelectOffice.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Office Was Not Selected\n";
                }
                strValueForValidation = txtEmployeeID.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyIntegerData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Employee ID Was Not An Integer\n";
                }
                else
                {
                    intEmployeeID = Convert.ToInt32(strValueForValidation);

                    TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intEmployeeID);

                    intRecordsReturned = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "Employee Was Not Found\n";
                    }
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                TheImportProjectsDataSet.importprojects.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 = 1; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strCustomerProjectID = Convert.ToString((range.Cells[intCounter, 1] as Excel.Range).Value2).ToUpper();
                    strAssignedProjectID = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2).ToUpper();
                    intProjectID         = 0;
                    intSecondProjectID   = 0;
                    blnDoNotImport       = false;

                    TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strCustomerProjectID);

                    if (TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count > 0)
                    {
                        intProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;
                    }

                    TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strAssignedProjectID);

                    if (TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count > 0)
                    {
                        intSecondProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;
                    }

                    TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strCustomerProjectID);

                    if (TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count > 0)
                    {
                        if (TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].AssignedProjectID == strAssignedProjectID)
                        {
                            blnDoNotImport = true;
                        }
                    }

                    if (intProjectID == 0)
                    {
                        if (intSecondProjectID != 0)
                        {
                            intProjectID = intSecondProjectID;
                        }
                    }

                    if ((intProjectID == 0) && intSecondProjectID == 0)
                    {
                        blnFatalError = TheProjectClass.InsertProject(strCustomerProjectID, strCustomerProjectID);

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

                        TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strCustomerProjectID);

                        intProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;
                    }

                    ImportProjectsDataSet.importprojectsRow NewProjectRow = TheImportProjectsDataSet.importprojects.NewimportprojectsRow();

                    NewProjectRow.AssignedProjectID = strAssignedProjectID;
                    NewProjectRow.CustomerProjectID = strCustomerProjectID;
                    NewProjectRow.DepartmentID      = gintDepartmentID;
                    NewProjectRow.EmployeeID        = intEmployeeID;
                    NewProjectRow.ProjectID         = intProjectID;
                    NewProjectRow.SecondProjectID   = intSecondProjectID;
                    NewProjectRow.TransactionDate   = DateTime.Now;
                    NewProjectRow.WarehouseID       = gintOfficeID;
                    NewProjectRow.DoNotImport       = blnDoNotImport;

                    TheImportProjectsDataSet.importprojects.Rows.Add(NewProjectRow);
                }

                PleaseWait.Close();

                dgrProjects.ItemsSource = TheImportProjectsDataSet.importprojects;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Import Projects // Main Window // Import Excel Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void btnMainProcess_Click(object sender, RoutedEventArgs e)
        {
            //this will insert into the table
            string   strValueForValidation = "";
            string   strErrorMessage       = "";
            bool     blnFatalError         = false;
            bool     blnThereIsAProblem    = false;
            string   strAssignedProjectID;
            string   strVehicleNumber;
            DateTime datTransactionDate = DateTime.Now;
            int      intRecordsReturned;
            DateTime datInspectionDate = DateTime.Now;
            int      intCounter;
            int      intNumberOfRecords;
            int      intEmployeeID;

            try
            {
                strAssignedProjectID = txtAssignedProjectID.Text;
                if (strAssignedProjectID == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Project Was Not Entered\n";
                }
                else
                {
                    TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strAssignedProjectID);

                    intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strAssignedProjectID);

                        intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            MainWindow.gintProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID;
                        }
                        else if (intRecordsReturned < 1)
                        {
                            blnFatalError    = true;
                            strErrorMessage += "The Project Was Not Found\n";
                        }
                    }
                    else
                    {
                        MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;
                    }
                }
                if (cboSelectEmployee.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Employee Was Not Selected\n";
                }
                if (cboSelectDepartment.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Department Was Not Selected\n";
                }
                strVehicleNumber = txtVehicleNumber.Text;
                if (strVehicleNumber == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "Vehicle Number Was Not Entered\n";
                }
                else
                {
                    TheFindActiveVehicleMainByVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainByVehicleNumber(strVehicleNumber);

                    intRecordsReturned = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Vehicle Number Was Not Found\n";
                    }
                    else
                    {
                        MainWindow.gintVehicleID = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VehicleID;
                    }
                }
                strValueForValidation = txtInspectionDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnFatalError == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Inspection Date is not a Date\n";
                }
                else
                {
                    datInspectionDate = Convert.ToDateTime(strValueForValidation);

                    blnThereIsAProblem = TheDataValidationClass.verifyDateRange(datInspectionDate, DateTime.Now);

                    if (blnThereIsAProblem == true)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Inspection is after Today\n";
                    }
                }
                if (cboSelectManager.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Manager Was Not Selected\n";
                }
                if (cboSelectInspector.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Inspector Was Not Selected\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                MainWindow.gdatInspectionDate = datInspectionDate;

                intNumberOfRecords = TheJSIEmployeeAssignedDataSet.jsiemployeeassigned.Rows.Count - 1;

                if (intNumberOfRecords < 0)
                {
                    TheMessagesClass.ErrorMessage("No Employees Were Added");
                    return;
                }

                MainWindow.gintEmployeeID = TheJSIEmployeeAssignedDataSet.jsiemployeeassigned[0].EmployeeID;

                blnFatalError = TheJSIMainClass.InsertIntoJSIMain(datTransactionDate, MainWindow.gintProjectID, MainWindow.gintEmployeeID, MainWindow.gintDepartmentID, MainWindow.gintVehicleID, datInspectionDate, MainWindow.gintManagerID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, MainWindow.gintInspectingEmployeeID);

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

                TheFindJSIMainByDateMatchDataSet = TheJSIMainClass.FindJSIMainByDateMatch(datTransactionDate);

                MainWindow.gintJSITransationID = TheFindJSIMainByDateMatchDataSet.FindJSIMainByDateMatch[0].JSITransactionID;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    blnFatalError = TheJSIMainClass.InsertJSIEmployee(MainWindow.gintJSITransationID, TheJSIEmployeeAssignedDataSet.jsiemployeeassigned[intCounter].EmployeeID, datTransactionDate);

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

                blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Create JSI Entry // JSI Created");

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

                JSIPPEWindow JSIPPEWindow = new JSIPPEWindow();
                JSIPPEWindow.ShowDialog();

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create JSI Entry // Main Process Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void txtLastName_TextChanged(object sender, TextChangedEventArgs e)
        {
            //setting up local variables
            int      intCounter;
            int      intNumberOfRecords;
            int      intLength;
            string   strLastName;
            string   strAssignedProjectID;
            int      intRecordsReturned;
            DateTime datStartDate = DateTime.Now;

            try
            {
                strLastName  = txtLastName.Text;
                intLength    = strLastName.Length;
                datStartDate = TheDateSearchClass.SubtractingDays(datStartDate, 365);

                if (intLength > 2)
                {
                    //getting the project id
                    strAssignedProjectID = txtAssignedProjectID.Text;

                    TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strAssignedProjectID);

                    intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strAssignedProjectID);

                        intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            MainWindow.gintProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID;
                        }
                        else if (intRecordsReturned < 1)
                        {
                            TheMessagesClass.ErrorMessage("The Assigned Project ID Does Not Exist");
                            return;
                        }
                    }
                    else
                    {
                        MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;
                    }

                    cboSelectEmployee.Items.Clear();
                    cboSelectEmployee.Items.Add("Select Employee");

                    TheFindEmployeesForDataEntryForLastYearDataSet = TheEmployeeClass.FindEmployeesForDataEntryForLastYear(datStartDate, strLastName);

                    intNumberOfRecords = TheFindEmployeesForDataEntryForLastYearDataSet.FindEmployeesForDataEntryForLastYear.Rows.Count - 1;

                    if (intNumberOfRecords < 0)
                    {
                        TheMessagesClass.ErrorMessage("The Employee Was Not Found");
                        cboSelectEmployee.SelectedIndex = 0;
                        return;
                    }

                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        cboSelectEmployee.Items.Add(TheFindEmployeesForDataEntryForLastYearDataSet.FindEmployeesForDataEntryForLastYear[intCounter].FullName);
                    }

                    cboSelectEmployee.SelectedIndex = 0;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create JSI Entry // Last Name Text Change " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemple #12
0
        private void expProecess_Expanded(object sender, RoutedEventArgs e)
        {
            //setting local variables
            bool     blnFatalError      = false;
            bool     blnThereIsAProblem = false;
            string   strErrorMesssage   = "";
            string   strAddress;
            string   strCity;
            string   strState;
            string   strValueForValidation;
            DateTime datDateReceived = DateTime.Now;
            DateTime datECDDate      = DateTime.Now;
            string   strProjectNotes;
            string   strAssignedProjectID = "";
            string   strProjectName       = "";
            string   strCustomerProjectID = "";
            DateTime datTransactionDate   = DateTime.Now;
            int      intEmployeeID;

            try
            {
                strCustomerProjectID = txtCustomerProjectID.Text;
                strAssignedProjectID = txtAssignedProjectID.Text;
                intEmployeeID        = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;

                if (gblnProjectExists == false)
                {
                    if ((strAssignedProjectID.Length < 7) && (strAssignedProjectID.Length > 10))
                    {
                        blnFatalError     = true;
                        strErrorMesssage += "The Assigned Project ID is not the Correct Format\n";
                    }
                }
                if (gblnProjectMatrixExists == false)
                {
                    if (strCustomerProjectID.Length < 5)
                    {
                        blnFatalError     = true;
                        strErrorMesssage += "The Customer Project ID is not the Correct Format\n";
                    }
                    else if (gintDepartmentID == 1009)
                    {
                        if ((strCustomerProjectID.Length < 6) && (strCustomerProjectID.Length > 7))
                        {
                            blnFatalError     = true;
                            strErrorMesssage += "The Spectrum Project Length is not the Corret Length\n";
                        }
                    }
                    strProjectName = txtProjectName.Text;
                    if (strProjectName.Length < 10)
                    {
                        blnFatalError     = true;
                        strErrorMesssage += "The Project Name is to Short\n";
                    }
                }
                expProecess.IsExpanded = false;
                if (cboSelectDepartment.SelectedIndex < 1)
                {
                    blnFatalError     = true;
                    strErrorMesssage += "The Department was not Selected\n";
                }

                strAddress = txtAddress.Text;
                if (strAddress.Length < 3)
                {
                    blnFatalError     = true;
                    strErrorMesssage += "The Address Was Not Entered\n";
                }
                strCity = txtCity.Text;
                if (strCity.Length < 3)
                {
                    blnFatalError     = true;
                    strErrorMesssage += "The City is to Short\n";
                }
                strState = txtState.Text;
                if (strState.Length != 2)
                {
                    blnFatalError     = true;
                    strErrorMesssage += "The State is not the Correct Length\n";
                }
                if (cboSelectManager.SelectedIndex < 1)
                {
                    blnFatalError     = true;
                    strErrorMesssage += "The Manager Was Not Selected\n";
                }
                if (cboSelectOffice.SelectedIndex < 1)
                {
                    blnFatalError     = true;
                    strErrorMesssage += "The Office Was Not Selected\n";
                }
                strValueForValidation = txtDateReceived.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError     = true;
                    strErrorMesssage += "The Date Received is not a Date\n";
                }
                else
                {
                    datDateReceived    = Convert.ToDateTime(strValueForValidation);
                    blnThereIsAProblem = TheDataValidationClass.verifyDateRange(datDateReceived, DateTime.Now);
                    if (blnThereIsAProblem == true)
                    {
                        blnFatalError     = true;
                        strErrorMesssage += "The Date Received is after Today\n";
                    }
                }
                strValueForValidation = txtECDDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError     = true;
                    strErrorMesssage += "The ECD Date is not a Date\n";
                }
                else
                {
                    datECDDate = Convert.ToDateTime(strValueForValidation);

                    blnThereIsAProblem = TheDataValidationClass.verifyDateRange(DateTime.Now, datECDDate);

                    if (blnThereIsAProblem == true)
                    {
                        blnFatalError     = true;
                        strErrorMesssage += "The ECD Date is before today\n";
                    }
                }
                strProjectNotes = txtPRojectNotes.Text;
                if (strProjectNotes.Length < 1)
                {
                    strProjectNotes = "PROJECT CREATED";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMesssage);
                    return;
                }

                if (gblnProjectExists == false)
                {
                    blnFatalError = TheProjectClass.InsertProject(strCustomerProjectID, strProjectName);

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

                    TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strCustomerProjectID);

                    gintProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;

                    blnFatalError = TheProductionProjectClass.InsertProdutionProject(gintProjectID, gintDepartmentID, strAddress, strCity, strState, gintManagerID, gintOfficeID, datDateReceived, datECDDate, gintStatusID, strProjectNotes);

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

                    blnFatalError = TheProductionProjectClass.InsertProductionProjectUpdate(gintProjectID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, DateTime.Now, strProjectNotes);

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

                    blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Add Project Number " + strAssignedProjectID + " Has Been Added");

                    if (blnFatalError == true)
                    {
                        throw new Exception();
                    }
                }
                if (gblnProjectMatrixExists == false)
                {
                    blnFatalError = TheProjectMatrixClass.InsertProjectMatrix(gintProjectID, strAssignedProjectID, strCustomerProjectID, datTransactionDate, intEmployeeID, gintOfficeID, gintDepartmentID);

                    if (blnFatalError == true)
                    {
                        throw new Exception();
                    }
                }
                if (gblnProjectExists == true)
                {
                    TheFindProductionProjectByAssignedProjectIDDataSet = TheProductionProjectClass.FindProductionProjectsByAssignedProjectID(strCustomerProjectID);

                    if (TheFindProductionProjectByAssignedProjectIDDataSet.FindProductionProjectByAssignedProjectID.Rows.Count < 1)
                    {
                        blnFatalError = TheProductionProjectClass.InsertProdutionProject(gintProjectID, gintDepartmentID, strAddress, strCity, strState, gintManagerID, gintOfficeID, datDateReceived, datECDDate, gintStatusID, strProjectNotes);

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

                        blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Add Project Number " + strAssignedProjectID + " Has Been Added");

                        if (blnFatalError == true)
                        {
                            throw new Exception();
                        }
                    }
                    else
                    {
                        TheFindProductionProjectByAssignedProjectIDDataSet = TheProductionProjectClass.FindProductionProjectsByAssignedProjectID(strAssignedProjectID);

                        if (TheFindProductionProjectByAssignedProjectIDDataSet.FindProductionProjectByAssignedProjectID.Rows.Count < 1)
                        {
                            blnFatalError = TheProductionProjectClass.InsertProdutionProject(gintProjectID, gintDepartmentID, strAddress, strCity, strState, gintManagerID, gintOfficeID, datDateReceived, datECDDate, gintStatusID, strProjectNotes);

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

                TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strCustomerProjectID);

                MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;

                if (TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].BusinessLineID == 1009)
                {
                    AddProductionProjectInfo AddProductionProjectInfo = new AddProductionProjectInfo();
                    AddProductionProjectInfo.ShowDialog();
                }

                blnFatalError = TheEmployeeDataEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Add Project Number " + strAssignedProjectID + " Has Been Added");

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

                AddProjectDocumentation();

                TheMessagesClass.InformationMessage("Project Has Been Entered");

                TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(gintProjectID);

                MainWindow.gintTransactionID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].TransactionID;

                blnFatalError = TheProductionProjectClass.UpdateProductionProjectStatusDate(MainWindow.gintTransactionID, DateTime.Now);

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

                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Add Project // Process Expander " + Ex.ToString());

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemple #13
0
        private void expAddEmployee_Expanded(object sender, RoutedEventArgs e)
        {
            string   strValueForValidation;
            string   strErrorMessage    = "";
            bool     blnFatalError      = false;
            bool     blnThereIsAProblem = false;
            DateTime datWorkDate        = DateTime.Now;
            string   strOutTime;
            string   strProjectID;
            string   strWorkLocation;
            string   strInETA;
            int      intRecordsReturned;
            int      intCounter;
            int      intNumberOfRecords;
            int      intEmployeeID;
            int      intManagerID;
            string   strLastName;
            string   strFirstName;

            try
            {
                expAddEmployee.IsExpanded = false;

                //beginning data validation
                if (cboSelectOffice.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Office was not Selected\n";
                }
                if (cboSelectDepartment.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Department was not Selected\n";
                }
                if (TheAfterWorkEmployeesDataSet.afterhoursemployees.Rows.Count < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Employees were not Added\n";
                }
                if (gblnVehicleFound == false)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Vehicle was not Added\n";
                }
                strValueForValidation = txtWorkDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Date is not a Date\n";
                }
                else
                {
                    datWorkDate = Convert.ToDateTime(strValueForValidation);
                }
                strOutTime         = txtOutTime.Text;
                blnThereIsAProblem = TheDataValidationClass.VerifyTime(strOutTime);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Out Time is not a Time\n";
                }
                strProjectID = txtProjectID.Text;
                if (strProjectID == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Project ID was not Entered\n";
                }
                else
                {
                    TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID);

                    intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID);

                        intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            blnFatalError    = true;
                            strErrorMessage += "The Project Was Not Entered\n";
                        }
                        else
                        {
                            MainWindow.gintProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID;
                        }
                    }
                    else
                    {
                        MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;
                    }
                }
                strWorkLocation = txtWorkLocation.Text;
                if (strWorkLocation == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Work Location Was Not Entered\n";
                }
                strInETA           = txtInETA.Text;
                blnThereIsAProblem = TheDataValidationClass.VerifyTime(strInETA);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The ETA Time In is not a Time\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                intNumberOfRecords = TheAfterWorkEmployeesDataSet.afterhoursemployees.Rows.Count - 1;
                intManagerID       = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    intEmployeeID = TheAfterWorkEmployeesDataSet.afterhoursemployees[intCounter].EmployeeID;
                    strFirstName  = TheAfterWorkEmployeesDataSet.afterhoursemployees[intCounter].FirstName;
                    strLastName   = TheAfterWorkEmployeesDataSet.afterhoursemployees[intCounter].LastName;

                    SubmitAfterHoursWorkDataSet.submitafterhoursworkRow NewWorkRow = TheSubmitAfterHoursWorkDataSet.submitafterhourswork.NewsubmitafterhoursworkRow();

                    NewWorkRow.DataEntryDate = DateTime.Now;
                    NewWorkRow.DepartmentID  = MainWindow.gintDepartmentID;
                    NewWorkRow.EmployeeID    = intEmployeeID;
                    NewWorkRow.InETA         = strInETA;
                    NewWorkRow.ManagerID     = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;
                    NewWorkRow.OutTime       = strOutTime;
                    NewWorkRow.ProjectID     = MainWindow.gintProjectID;
                    NewWorkRow.VehicleID     = MainWindow.gintVehicleID;
                    NewWorkRow.WarehouseID   = MainWindow.gintWarehouseID;
                    NewWorkRow.WorkDate      = datWorkDate;
                    NewWorkRow.WorkLocation  = strWorkLocation;

                    TheSubmitAfterHoursWorkDataSet.submitafterhourswork.Rows.Add(NewWorkRow);

                    EmployeesAssignedDataSet.employeesassignedRow NewEmployeeRow = TheEmployeeAssignedDataSet.employeesassigned.NewemployeesassignedRow();

                    NewEmployeeRow.FirstName     = strFirstName;
                    NewEmployeeRow.LastName      = strLastName;
                    NewEmployeeRow.ProjectID     = strProjectID;
                    NewEmployeeRow.VehicleNumber = MainWindow.gstrVehicleNumber;
                    NewEmployeeRow.WorkDate      = datWorkDate;
                    NewEmployeeRow.WorkLocation  = strWorkLocation;

                    TheEmployeeAssignedDataSet.employeesassigned.Rows.Add(NewEmployeeRow);
                }

                ResetControls();

                dgrAssignedEmployees.ItemsSource = TheEmployeeAssignedDataSet.employeesassigned;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Submit After Hours Work // Submit Form Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            string  strAssignedProjectID;
            int     intRecordsReturned;
            decimal decTotalCost  = 0;
            decimal decTotalHours = 0;
            int     intCounter;
            int     intNumberOfRecords;
            double  douTotalCost;

            try
            {
                strAssignedProjectID = txtAssignedProjectID.Text;
                if (strAssignedProjectID == "")
                {
                    TheMessagesClass.ErrorMessage("The Assigned Project ID Was Not Entered");
                    return;
                }

                TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strAssignedProjectID);

                intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                if (intRecordsReturned < 1)
                {
                    TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strAssignedProjectID);

                    intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        TheMessagesClass.ErrorMessage("The Project Was Not Found");
                        return;
                    }
                    else
                    {
                        strAssignedProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].CustomerAssignedID;
                    }
                }

                TheFindProjectTaskCostsDataSet = TheProjectCostingClass.FindProjectTasksCosts(strAssignedProjectID);

                intNumberOfRecords = TheFindProjectTaskCostsDataSet.FindProjectTaskCosts.Rows.Count - 1;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        decTotalCost  += TheFindProjectTaskCostsDataSet.FindProjectTaskCosts[intCounter].LaborCost;
                        decTotalHours += TheFindProjectTaskCostsDataSet.FindProjectTaskCosts[intCounter].TotalHours;
                    }
                }

                dgrResults.ItemsSource = TheFindProjectTaskCostsDataSet.FindProjectTaskCosts;

                douTotalCost = Convert.ToDouble(decTotalCost);

                decTotalCost = Convert.ToDecimal(Math.Round(douTotalCost, 2));

                txtTotalCost.Text  = Convert.ToString(decTotalCost);
                txtTotalHours.Text = Convert.ToString(decTotalHours);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Employee Project Labor Report // Find Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            //setting up data
            string strAssignedProjectID = "";
            string strCustomerProjectID = "";
            int    intRecordsReturned;
            int    intProjectID = 0;
            int    intNumberOfRecords;
            int    intCounter;

            try
            {
                strCustomerProjectID = txtProjectNumber.Text;
                if (strCustomerProjectID.Length < 4)
                {
                    TheMessagesClass.ErrorMessage("The Project ID is not Long Enough");
                    return;
                }

                TheMaterialIssuedDataSet.materialissued.Rows.Clear();

                //getting the data
                TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strCustomerProjectID);

                intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                if (intRecordsReturned < 1)
                {
                    strAssignedProjectID = strCustomerProjectID;

                    TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strAssignedProjectID);

                    intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        TheMessagesClass.ErrorMessage("Project Was Not Found");
                        return;
                    }
                    else if (intRecordsReturned > 0)
                    {
                        intProjectID         = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID;
                        strCustomerProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].CustomerAssignedID;
                    }
                }
                else if (intRecordsReturned > 0)
                {
                    intProjectID         = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;
                    strAssignedProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].CustomerAssignedID;
                }

                TheFindIssuedPartsByProjectIDDataSet = TheIssuedPartsClass.FindIssuedPartsByProjectID(intProjectID);

                intNumberOfRecords = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        MaterialIssuedDataSet.materialissuedRow NewTransactionRow = TheMaterialIssuedDataSet.materialissued.NewmaterialissuedRow();

                        NewTransactionRow.AssignedProjectID = strAssignedProjectID;
                        NewTransactionRow.CustomerProjectID = strCustomerProjectID;
                        NewTransactionRow.PartID            = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID[intCounter].PartID;
                        NewTransactionRow.PartNumber        = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID[intCounter].PartNumber;
                        NewTransactionRow.Quantity          = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID[intCounter].Quantity;
                        NewTransactionRow.TransactionDate   = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID[intCounter].TransactionDate;
                        NewTransactionRow.TransactionID     = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID[intCounter].TransactionID;
                        NewTransactionRow.VoidTransaction   = false;
                        NewTransactionRow.WarehouseID       = TheFindIssuedPartsByProjectIDDataSet.FindIssuedPartsByProjectID[intCounter].WarehouseID;

                        TheMaterialIssuedDataSet.materialissued.Rows.Add(NewTransactionRow);
                    }

                    MainWindow.gintProjectID         = intProjectID;
                    MainWindow.gstrAssignedProjectID = strAssignedProjectID;
                }

                dgrTransactions.ItemsSource = TheMaterialIssuedDataSet.materialissued;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Void Inventory Transaction // Search Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            string strCustomerProjectID;
            string strAssignedProjectID = "";
            string strProjectName;
            string strProjectUpdates = "";
            int    intRecordsReturned;
            int    intCounter;
            int    intNumberOfRecords;
            int    intStatusID;
            string strProjectNotes;
            bool   blnFatalError = false;

            try
            {
                //getting project id
                strCustomerProjectID = txtEnterProjectID.Text;

                if (strCustomerProjectID.Length < 1)
                {
                    TheMessageClass.ErrorMessage("The Project Information Was Not Entered");
                    return;
                }

                TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strCustomerProjectID);

                intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                if (intRecordsReturned > 1)
                {
                    TheMessageClass.ErrorMessage("The Project Has Been Entered More Than Once, Contact Admin");
                    return;
                }
                else if (intRecordsReturned < 1)
                {
                    strAssignedProjectID = strCustomerProjectID;

                    TheFindProjectMatrxiByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strAssignedProjectID);

                    intRecordsReturned = TheFindProjectMatrxiByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheMessageClass.ErrorMessage("Project Not Found");
                        return;
                    }
                    else if (intRecordsReturned > 1)
                    {
                        TheMessageClass.InformationMessage("There are Multiple Projects with this Project ID, Please use the Customer Assigned ID");
                        return;
                    }
                    else if (intRecordsReturned == 1)
                    {
                        MainWindow.gintProjectID = TheFindProjectMatrxiByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID;
                        strCustomerProjectID     = TheFindProjectMatrxiByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].CustomerAssignedID;
                    }
                }
                else if (intRecordsReturned == 1)
                {
                    MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;
                    strAssignedProjectID     = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].AssignedProjectID;
                }

                TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(MainWindow.gintProjectID);
                TheFindProjectByProjectIDDataSet           = TheProjectClass.FindProjectByProjectID(MainWindow.gintProjectID);

                strProjectName  = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectName;
                strProjectNotes = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ProjectNotes;

                intStatusID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].CurrentStatusID;

                ClearRadioButtons();

                if (intStatusID == 1001)
                {
                    rdoOpen.IsChecked = true;
                }
                else if (intStatusID == 1002)
                {
                    rdoConComplete.IsChecked = true;
                }
                else if (intStatusID == 1003)
                {
                    rdoOnHold.IsChecked = true;
                }
                else if (intStatusID == 1004)
                {
                    rdoCancel.IsChecked = true;
                }
                else if (intStatusID == 1005)
                {
                    rdoInProcess.IsChecked = true;
                }
                else if (intStatusID == 1006)
                {
                    rdoClosed.IsChecked = true;
                }
                else if (intStatusID == 1007)
                {
                    rdoInvoiced.IsChecked = true;
                }
                else if (intStatusID == 1008)
                {
                    rdoSubmitted.IsChecked = true;
                }

                txtAssignedProjectID.Text = strAssignedProjectID;
                txtCustomerProjectID.Text = strCustomerProjectID;
                txtProjectName.Text       = strProjectName;
                txtProjectNotes.Text      = strProjectNotes;

                TheFindProductionProjectUpdateByProjectIDDataSet = TheProductionProjectUpdatesClass.FindProductionProjectUpdateByProjectID(MainWindow.gintProjectID);

                intNumberOfRecords = TheFindProductionProjectUpdateByProjectIDDataSet.FindProductionProjectUpdatesByProjectID.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        strProjectUpdates += Convert.ToString(TheFindProductionProjectUpdateByProjectIDDataSet.FindProductionProjectUpdatesByProjectID[intCounter].TransactionDate) + " - ";
                        strProjectUpdates += TheFindProductionProjectUpdateByProjectIDDataSet.FindProductionProjectUpdatesByProjectID[intCounter].ProjectUpdate + "\n\n";
                    }
                }

                txtProjectUpdates.Text = strProjectUpdates;

                TheFindProductionProjectInfoDataSet = TheProductionProjectClass.FindProductionProjectInfo(MainWindow.gintProjectID);

                intRecordsReturned = TheFindProductionProjectInfoDataSet.FindProductionProjectInfo.Rows.Count;

                if (intRecordsReturned < 1)
                {
                    blnFatalError = TheProductionProjectClass.InsertProductionProjectInfo(MainWindow.gintProjectID, 0, " ", " ", 0);

                    if (blnFatalError == true)
                    {
                        throw new Exception();
                    }
                }
                else if (intRecordsReturned > 0)
                {
                    if (TheFindProductionProjectInfoDataSet.FindProductionProjectInfo[0].HardRestoration == true)
                    {
                        chkHardRestoration.IsChecked = true;
                    }
                    else
                    {
                        chkHardRestoration.IsEnabled = false;
                    }
                    if (TheFindProductionProjectInfoDataSet.FindProductionProjectInfo[0].QCPerformed == true)
                    {
                        chkQCPerformed.IsChecked = true;
                    }
                    else
                    {
                        chkQCPerformed.IsChecked = false;
                    }
                    if (TheFindProductionProjectInfoDataSet.FindProductionProjectInfo[0].SplicingComple == true)
                    {
                        chkSplicingComplete.IsChecked = true;
                    }
                    else
                    {
                        chkSplicingComplete.IsChecked = false;
                    }
                }

                expViewDocuments.IsEnabled = true;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Update Project // Find Button " + Ex.Message);

                TheMessageClass.ErrorMessage(Ex.ToString());
            }
        }
Exemple #17
0
        private void txtCustomerProjectID_TextChanged(object sender, TextChangedEventArgs e)
        {
            string strCustomerProjectID;
            int    intLength;
            int    intCounter;
            int    intNumberOfRecords;
            int    intRecordsReturned;
            int    intManagerID;
            int    intDepartmentID;
            int    intOfficeID;
            int    intSelectedIndex = 0;
            int    intStatusID;
            string strCustomerIDProjectID;
            string strAssignedProjectID;

            try
            {
                strCustomerProjectID = txtCustomerProjectID.Text;
                intLength            = strCustomerProjectID.Length;
                //ClearDateEntryControls();

                if (intLength > 3)
                {
                    TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strCustomerProjectID);

                    intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strCustomerProjectID);

                        intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            gblnProjectExists = false;
                        }
                        else if (intRecordsReturned > 0)
                        {
                            txtAssignedProjectID.Text = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].AssignedProjectID;
                        }
                    }
                    else
                    {
                        gblnProjectExists = true;

                        gintProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;

                        TheFindDesignProjectsbyAssignedProjectIDDataSet = TheDesignProjectsClass.FindDesignProjectsByAssignedProjectID(strCustomerProjectID);

                        intRecordsReturned = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            txtAddress.Text      = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].ProjectAddress;
                            txtCity.Text         = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].City;
                            txtProjectName.Text  = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectName;
                            txtDateReceived.Text = Convert.ToString(TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].DateReceived);

                            intOfficeID = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].OfficeID;

                            intNumberOfRecords = TheFindWarehousesDataSet.FindWarehouses.Rows.Count - 1;

                            for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                            {
                                if (intOfficeID == TheFindWarehousesDataSet.FindWarehouses[intCounter].EmployeeID)
                                {
                                    intSelectedIndex = intCounter + 1;
                                    cboSelectOffice.SelectedIndex = intSelectedIndex;
                                }
                            }
                        }

                        TheFindProjectMatrixByProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByProjectID(gintProjectID);

                        intRecordsReturned = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID.Rows.Count;

                        if (intRecordsReturned < 1)
                        {
                            gblnProjectMatrixExists = false;

                            cboSelectStatus.IsEnabled = true;

                            intNumberOfRecords = TheFindWorkOrderStatusSortedDataSet.FindWorkOrderStatusSorted.Rows.Count - 1;

                            for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                            {
                                cboSelectStatus.Items.Add(TheFindWorkOrderStatusSortedDataSet.FindWorkOrderStatusSorted[intCounter].WorkOrderStatus);

                                if (TheFindWorkOrderStatusSortedDataSet.FindWorkOrderStatusSorted[intCounter].WorkOrderStatus == "OPEN")
                                {
                                    intSelectedIndex = intCounter + 1;
                                }
                            }

                            cboSelectStatus.SelectedIndex = intSelectedIndex;

                            cboSelectStatus.IsEnabled = false;
                        }
                        else
                        {
                            gblnProjectMatrixExists = true;

                            strCustomerIDProjectID    = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].CustomerAssignedID;
                            strAssignedProjectID      = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].AssignedProjectID;
                            txtAssignedProjectID.Text = strAssignedProjectID;

                            TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(gintProjectID);

                            intRecordsReturned = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID.Rows.Count;

                            if (intRecordsReturned < 1)
                            {
                                TheFindDesignProjectsbyAssignedProjectIDDataSet = TheDesignProjectsClass.FindDesignProjectsByAssignedProjectID(strCustomerIDProjectID);

                                intRecordsReturned = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID.Rows.Count;

                                if (intRecordsReturned > 0)
                                {
                                    txtAddress.Text = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].ProjectAddress;
                                    txtCity.Text    = TheFindDesignProjectsbyAssignedProjectIDDataSet.FindDesignProjectsByAssignedProjectID[0].City;
                                }

                                TheMessagesClass.InformationMessage("The Project Has Been Entered, but is Missing Some Information");

                                SetControlsReadOnly(false);
                            }
                            else if (intRecordsReturned > 0)
                            {
                                SetControlsReadOnly(true);
                                txtAddress.Text                  = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].BusinessAddress;
                                txtCity.Text                     = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].City;
                                txtDateReceived.Text             = Convert.ToString(TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].DateReceived);
                                txtECDDate.Text                  = Convert.ToString(TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ECDDate);
                                TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(gintProjectID);
                                txtProjectName.Text              = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectName;
                                txtPRojectNotes.Text             = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ProjectNotes;
                                txtState.Text                    = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].BusinessState;

                                //setting the combo boxes;
                                intNumberOfRecords = TheFindWorkOrderStatusSortedDataSet.FindWorkOrderStatusSorted.Rows.Count - 1;
                                intStatusID        = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].CurrentStatusID;

                                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                                {
                                    if (intStatusID == TheFindWorkOrderStatusSortedDataSet.FindWorkOrderStatusSorted[intCounter].StatusID)
                                    {
                                        intSelectedIndex = intCounter + 1;
                                    }
                                }

                                cboSelectStatus.SelectedIndex = intSelectedIndex;

                                intManagerID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ProjectManagerID;

                                intNumberOfRecords = TheFindProductionManagersDataSet.FindProductionManagers.Rows.Count - 1;

                                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                                {
                                    if (intManagerID == TheFindProductionManagersDataSet.FindProductionManagers[intCounter].EmployeeID)
                                    {
                                        intSelectedIndex = intCounter + 1;
                                    }
                                }

                                cboSelectManager.SelectedIndex = intSelectedIndex;

                                intDepartmentID = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].DepartmentID;

                                intNumberOfRecords = TheFindSortedCustomerLinesDataSet.FindSortedCustomerLines.Rows.Count - 1;

                                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                                {
                                    if (intDepartmentID == TheFindSortedCustomerLinesDataSet.FindSortedCustomerLines[intCounter].DepartmentID)
                                    {
                                        intSelectedIndex = intCounter + 1;
                                    }
                                }

                                cboSelectDepartment.SelectedIndex = intSelectedIndex;

                                intOfficeID = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].WarehouseID;

                                intNumberOfRecords = TheFindWarehousesDataSet.FindWarehouses.Rows.Count - 1;

                                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                                {
                                    if (intOfficeID == TheFindWarehousesDataSet.FindWarehouses[intCounter].EmployeeID)
                                    {
                                        intSelectedIndex = intCounter + 1;
                                    }
                                }

                                cboSelectOffice.SelectedIndex = intSelectedIndex;

                                TheMessagesClass.InformationMessage("The Project Has Been Entered");
                            }
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Project // Customer Project ID Text Box " + Ex.Message);

                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Add Project // Customer Project ID Text Box " + Ex.ToString());

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void txtEnterLastLame_TextChanged(object sender, TextChangedEventArgs e)
        {
            //setting local variables
            string   strProjectID;
            int      intRecordsReturned;
            string   strLastName;
            int      intLength;
            int      intCounter;
            int      intNumberOfRecords;
            DateTime datTransactionDate = DateTime.Now;
            DateTime datTodaysDate      = DateTime.Now;
            bool     blnFatalError      = false;
            int      intEmployeeID;
            decimal  decHours;
            DateTime datEndDate;


            try
            {
                datEndDate = TheDateSearchClass.SubtractingDays(datTodaysDate, 21);

                blnFatalError = TheDataValidationClass.VerifyDateData(txtTransactionDate.Text);
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("The Date Entered is not a Date");
                    return;
                }
                else
                {
                    datTransactionDate = Convert.ToDateTime(txtTransactionDate.Text);
                }
                if (datTransactionDate > datTodaysDate)
                {
                    TheMessagesClass.ErrorMessage("The Date Entered is in the Future");
                    return;
                }

                if (gblnProjectFound == false)
                {
                    strProjectID = txtEnterProjectID.Text;

                    TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID);

                    intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID);

                        intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count;

                        if (intRecordsReturned == 0)
                        {
                            TheMessagesClass.ErrorMessage("Project Not Found, A Valid Project Must Be Entered");
                            return;
                        }
                        else
                        {
                            MainWindow.gintProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID;
                        }
                    }
                    else
                    {
                        MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;
                    }

                    TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(MainWindow.gintProjectID);

                    MainWindow.gstrAssignedProjectID = strProjectID;

                    txtProjectName.Text = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectName;

                    gblnProjectFound = true;
                    intEmployeeID    = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;
                    decHours         = Convert.ToDecimal(txtEnterHours.Text);

                    blnFatalError = TheProductivityDataEntryClass.InsertProductivityDataEntry(intEmployeeID, MainWindow.gintProjectID, datTodaysDate, decHours, 0, 0);

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

                    TheFindProductivityDataEntryByDateDataSet = TheProductivityDataEntryClass.FindProductivityDataEntryByDate(datTodaysDate);

                    gintDataEntryTransactionID = TheFindProductivityDataEntryByDateDataSet.FindProductivtyDataEntryByDate[0].TransactionID;

                    gintEmployeeCounter = 0;
                    gintTaskCounter     = 0;
                }

                strLastName = txtEnterLastLame.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, "Blue Jay ERP // Add Project Labor // Enter Last Name Text Change Event " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemple #19
0
        private void expProcess_Expanded(object sender, RoutedEventArgs e)
        {
            string   strCustomerProjectID;
            string   strAssignedProjectID;
            string   strProjectName;
            string   strAddress;
            string   strCity;
            string   strState;
            DateTime datECDDate = DateTime.Now;
            string   strProjectNotes;
            bool     blnThereIsAProblem = false;
            bool     blnFatalError      = false;
            string   strErrorMessage    = "";
            int      intRecordsReturned;
            string   strValueForValidation;
            int      intTransactionID       = 0;
            string   strCurrentProjectNotes = "";

            try
            {
                expProcess.IsExpanded = false;

                strCustomerProjectID = txtCustomerProjectID.Text;
                if (strCustomerProjectID.Length < 3)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Customer Project ID was not Found\n";
                }
                else
                {
                    TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strCustomerProjectID);

                    intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Customer Project ID Was not Found\n";
                    }
                    else if (intRecordsReturned > 0)
                    {
                        gintProjectID    = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;
                        intTransactionID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].TransactionID;
                    }
                }
                strAssignedProjectID = txtAssignedProjectID.Text;
                if (strAssignedProjectID.Length < 7)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Assigned Project ID Was not Entered\n";
                }
                strProjectName = txtProjectName.Text;
                if (strProjectName.Length < 10)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Project Name was not Long Enough\n";
                }
                if (cboSelectDepartment.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Department Was Not Selected\n";
                }
                strAddress = txtAddress.Text;
                if (strAddress.Length < 5)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Address is not Long Enough\n";
                }
                strCity = txtCity.Text;
                if (strCity.Length < 3)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The City was not Entered\n";
                }
                strState = txtState.Text;
                if (strState.Length < 2)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The State was not Entered\n";
                }
                if (cboSelectManager.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Manager Was Not Selected\n";
                }
                if (cboSelectOffice.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Office Was Not Selected\n";
                }
                strValueForValidation = txtECDDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The ECD Date is not a Date\n";
                }
                else
                {
                    datECDDate = Convert.ToDateTime(strValueForValidation);
                }
                strProjectNotes = txtPRojectNotes.Text;
                if (strProjectNotes.Length < 10)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Project Notes are not Long Enough\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                strCurrentProjectNotes = txtPRojectNotes.Text;

                blnFatalError = TheProjectMatrixClass.UpdateProjectMatrixAssignedProjectID(intTransactionID, strAssignedProjectID);

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

                blnFatalError = TheProjectMatrixClass.UpdateProjectMatrixItems(intTransactionID, gintOfficeID, gintDepartmentID);

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

                blnFatalError = TheProjectClass.UpdateProjectProject(gintProjectID, strCustomerProjectID, strProjectName);

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

                blnFatalError = TheProductionProjectClass.UpdateProductionProjectStatus(gintTransactionID, gintStatusID);

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

                blnFatalError = TheProductionProjectClass.UpdateProductionProjectStatusDate(gintTransactionID, DateTime.Now);

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

                TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(gintProjectID);

                intRecordsReturned = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID.Rows.Count;

                if (intRecordsReturned < 1)
                {
                    throw new Exception();
                }

                intTransactionID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].TransactionID;

                blnFatalError = TheProductionProjectClass.UpdateProductionProject(intTransactionID, gintDepartmentID, strAddress, strCity, strState, gintManagerID, gintOfficeID, datECDDate, strCurrentProjectNotes);

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

                blnFatalError = TheProductionProjectsUpdatesClass.InsertProductionProjectUpdate(gintProjectID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, strProjectNotes);

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

                TheMessagesClass.InformationMessage("The Project Has Been Updated");

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Edit Project // Process Expander " + Ex.ToString());

                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Edit Projects // Proces Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemple #20
0
        private void CheckProject()
        {
            //setting local variables
            string   strProjectID;
            int      intRecordsReturned;
            DateTime datTransactionDate = DateTime.Now;
            DateTime datTodaysDate      = DateTime.Now;
            bool     blnFatalError      = false;
            int      intEmployeeID;
            decimal  decHours;
            DateTime datEndDate;
            int      intHours;
            int      intRemainder;

            try
            {
                datEndDate = TheDateSearchClass.SubtractingDays(datTodaysDate, 21);

                blnFatalError = TheDataValidationClass.VerifyDateData(txtEnterDate.Text);
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("The Date Entered is not a Date");
                    return;
                }
                else
                {
                    datTransactionDate = Convert.ToDateTime(txtEnterDate.Text);
                }
                if (datTransactionDate > datTodaysDate)
                {
                    TheMessagesClass.ErrorMessage("The Date Entered is in the Future");
                    return;
                }

                blnFatalError = TheDataValidationClass.VerifyDoubleData(txtEnterHours.Text);
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("Total Hours is not Numeric");
                    return;
                }

                if (gblnProjectFound == false)
                {
                    strProjectID = txtEnterProjectID.Text;

                    TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID);

                    intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheFindProjectMatrixByAssignedProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByAssignedProjectID(strProjectID);

                        intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count;

                        if (intRecordsReturned == 0)
                        {
                            TheMessagesClass.ErrorMessage("Project Not Found, A Valid Project Must Be Entered");
                            return;
                        }
                        else
                        {
                            MainWindow.gintProjectID = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID[0].ProjectID;
                        }
                    }
                    else
                    {
                        MainWindow.gintProjectID = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID[0].ProjectID;
                    }

                    if (MainWindow.gintProjectID == 104330)
                    {
                        TheMessagesClass.ErrorMessage("You do not have to Enter the Project Shop.  Place the hours for Non-Productive Time in the Non-Prod Time Box");
                        gblnProjectFound = false;
                        return;
                    }

                    TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(MainWindow.gintProjectID);

                    MainWindow.gstrAssignedProjectID = strProjectID;

                    txtProjectName.Text = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectName;

                    gblnProjectFound = true;
                    intEmployeeID    = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;
                    decHours         = Convert.ToDecimal(txtEnterHours.Text);

                    intHours = Convert.ToInt32(decHours * 100);

                    intRemainder = intHours % 25;

                    if (intRemainder > 0)
                    {
                        TheMessagesClass.ErrorMessage("The Hours Inputted are not a .25, .5, .75. .00. The Transaction is Rejected");
                        return;
                    }

                    blnFatalError = TheProductivityDataEntryClass.InsertProductivityDataEntry(intEmployeeID, MainWindow.gintProjectID, datTodaysDate, decHours, 0, 0);

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

                    TheFindProductivityDataEntryByDateDataSet = TheProductivityDataEntryClass.FindProductivityDataEntryByDate(datTodaysDate);

                    gintDataEntryTransactionID = TheFindProductivityDataEntryByDateDataSet.FindProductivtyDataEntryByDate[0].TransactionID;

                    gintEmployeeCounter = 0;
                    gintTaskCounter     = 0;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Project Labor // Check Project " + Ex.Message);

                TheSendEmailClass.SendEventLog("New Blue Jay ERP // Add Project Labor // Check Project " + Ex.ToString());

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