private void mitCheckProject_Click(object sender, RoutedEventArgs e)
        {
            string strProjectID;
            int    intRecordsReturned;

            strProjectID = txtEnterProjectID.Text;

            TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProjectID);

            intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

            if (intRecordsReturned == 0)
            {
                TheMessagesClass.ErrorMessage("Project Not Found, A Valid Project Must Be Entered");
                txtEnterLastLame.Text = "";
                return;
            }
            else
            {
                txtProjectName.Text              = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectName;
                MainWindow.gintProjectID         = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;
                MainWindow.gstrAssignedProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].AssignedProjectID;
                gblnProjectFound = true;
            }
        }
        private void txtJobNumber_GotFocus(object sender, RoutedEventArgs e)
        {
            int intRecordsReturned;

            try
            {
                gstrAssignedProjectID = txtAssignedProjectID.Text;

                TheFindProjectByAssignedProjectIDDataSet = TheProjectsClass.FindProjectByAssignedProjectID(gstrAssignedProjectID);

                intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                if (intRecordsReturned < 1)
                {
                    TheMessagesClass.ErrorMessage("Project Does Not Exist");
                    txtAssignedProjectID.Focus();
                    return;
                }

                gintProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;

                TheFindProductionProjectsByAssignedProjectIDDataSet = TheProductionProjectClass.FindProductionProjectsByAssignedProjectID(gstrAssignedProjectID);

                intRecordsReturned = TheFindProductionProjectsByAssignedProjectIDDataSet.FindProductionProjectByAssignedProjectID.Rows.Count;

                if (intRecordsReturned < 1)
                {
                    TheMessagesClass.ErrorMessage("Project Needs to be Updated");
                    txtAssignedProjectID.Focus();
                    return;
                }

                TheFindPurchseRequestPRojectByProjectIDDataSet = ThePurchaseRequestProjectsClass.FindPurchaseRequestByProjectID(gintProjectID);

                intRecordsReturned = TheFindPurchseRequestPRojectByProjectIDDataSet.FindPurchaseRequestProjectByProjectID.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    TheMessagesClass.ErrorMessage("There are Currently " + Convert.ToString(intRecordsReturned) + "Purchase Requests for this Project\nThe Last Job Number Has Been Entered in the Job Number Field");

                    txtJobNumber.Text = TheFindPurchseRequestPRojectByProjectIDDataSet.FindPurchaseRequestProjectByProjectID[intRecordsReturned - 1].JobNumber;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Create Purchase Request // Job Number Text Box Got Focus " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Esempio n. 3
0
        public FindProjectByAssignedProjectIDDataSet FindProjectByAssignedProjectID(string strAssignedProjectID)
        {
            try
            {
                aFindProjectByAssignedProjectIDDataSet      = new FindProjectByAssignedProjectIDDataSet();
                aFindProjectByAssignedProjectIDTableAdapter = new FindProjectByAssignedProjectIDDataSetTableAdapters.FindProjectByAssignedProjectIDTableAdapter();
                aFindProjectByAssignedProjectIDTableAdapter.Fill(aFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID, strAssignedProjectID);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Projects Class // Find Project By Assigned Project ID " + Ex.Message);
            }

            return(aFindProjectByAssignedProjectIDDataSet);
        }
Esempio n. 4
0
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            //setting up locak variables
            string strProject;
            int    intRecordsReturned;

            strProject = txtEnterProject.Text;

            TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProject);

            intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

            if (intRecordsReturned > 0)
            {
                dgrResults.ItemsSource = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID;
            }
            else
            {
                TheFindProjectByProjectNameDataSet = TheProjectClass.FindProjectByProjectName(strProject);

                dgrResults.ItemsSource = TheFindProjectByProjectNameDataSet.FindProjectByProjectName;
            }
        }
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string   strProjectID;
            int      intRecordsReturned;
            int      intCounter;
            int      intNumberOfRecords;
            DateTime datTransactionDate;
            string   strWorkTask;
            int      intSecondCounter;
            int      intSecondNumberOfRecords;
            bool     blnItemFound;
            int      intFootage;
            decimal  decHours;
            decimal  decLaborCosts;

            try
            {
                strProjectID = txtEnterProjectID.Text;
                TheCompleteProjectInfoDataSet.projectinfo.Rows.Clear();
                MainWindow.ProjectMaterialWindow.Visibility = Visibility.Hidden;

                gdecTotalHours      = 0;
                gdecTotalLaborCosts = 0;

                TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProjectID);

                intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    TheMessagesClass.ErrorMessage("Project Not Found");
                    return;
                }

                MainWindow.gintProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;

                TheFindProjectHoursTotalDataSet = TheEmployeeProjectAssignmentClass.FindProjectHoursTotal(MainWindow.gintProjectID);

                intNumberOfRecords       = TheFindProjectHoursTotalDataSet.FindProjectHourTotals.Rows.Count - 1;
                intSecondNumberOfRecords = 0;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        blnItemFound         = false;
                        decHours             = TheFindProjectHoursTotalDataSet.FindProjectHourTotals[intCounter].TotalHours;
                        decLaborCosts        = TheFindProjectHoursTotalDataSet.FindProjectHourTotals[intCounter].TotalEmployeeCost;
                        gdecTotalHours      += decHours;
                        gdecTotalLaborCosts += decLaborCosts;
                        datTransactionDate   = TheFindProjectHoursTotalDataSet.FindProjectHourTotals[intCounter].TransactionDate;
                        strWorkTask          = TheFindProjectHoursTotalDataSet.FindProjectHourTotals[intCounter].WorkTask;

                        if (intSecondNumberOfRecords > 0)
                        {
                            for (intSecondCounter = 0; intSecondCounter < intSecondNumberOfRecords; intSecondCounter++)
                            {
                                if (strWorkTask == TheCompleteProjectInfoDataSet.projectinfo[intSecondCounter].WorkTask)
                                {
                                    if (datTransactionDate == TheCompleteProjectInfoDataSet.projectinfo[intSecondCounter].TransactionDate)
                                    {
                                        blnItemFound = true;
                                    }
                                }
                            }
                        }

                        if (blnItemFound == false)
                        {
                            CompleteProjectInfoDataSet.projectinfoRow NewTaskRow = TheCompleteProjectInfoDataSet.projectinfo.NewprojectinfoRow();

                            NewTaskRow.FootagePieces   = 0;
                            NewTaskRow.TransactionDate = datTransactionDate;
                            NewTaskRow.WorkTask        = strWorkTask;
                            NewTaskRow.Hours           = decHours;
                            NewTaskRow.LaborCosts      = decLaborCosts;

                            TheCompleteProjectInfoDataSet.projectinfo.Rows.Add(NewTaskRow);
                            intSecondNumberOfRecords++;
                        }
                    }
                }

                intNumberOfRecords = TheCompleteProjectInfoDataSet.projectinfo.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    intFootage         = 0;
                    strWorkTask        = TheCompleteProjectInfoDataSet.projectinfo[intCounter].WorkTask;
                    datTransactionDate = TheCompleteProjectInfoDataSet.projectinfo[intCounter].TransactionDate;

                    TheFindWorkTaskByWorkTaskDataSet = TheWorkTaskClass.FindWorkTaskByWorkTask(strWorkTask);

                    MainWindow.gintWorkTaskID = TheFindWorkTaskByWorkTaskDataSet.FindWorkTaskByWorkTask[0].WorkTaskID;

                    TheFindSpecificProjectWorkTaskDataSet = TheProjectTaskClass.FindSpecificProjectWorkTask(MainWindow.gintProjectID, MainWindow.gintWorkTaskID);

                    intSecondNumberOfRecords = TheFindSpecificProjectWorkTaskDataSet.FindSpecificProjectWorkTask.Rows.Count - 1;

                    for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                    {
                        if (datTransactionDate == TheFindSpecificProjectWorkTaskDataSet.FindSpecificProjectWorkTask[intSecondCounter].TransactionDate)
                        {
                            intFootage += Convert.ToInt32(TheFindSpecificProjectWorkTaskDataSet.FindSpecificProjectWorkTask[intSecondCounter].FootagePieces);
                        }
                    }

                    TheCompleteProjectInfoDataSet.projectinfo[intCounter].FootagePieces = intFootage;
                }

                dgrResults.ItemsSource = TheCompleteProjectInfoDataSet.projectinfo;
                txtTotalHours.Text     = Convert.ToString(gdecTotalHours);
                txtLaborCost.Text      = Convert.ToString(gdecTotalLaborCosts);

                MainWindow.ProjectMaterialWindow.Visibility = Visibility.Visible;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Total Project Information // Generate Report Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Esempio n. 6
0
        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 expProcess_Expanded(object sender, RoutedEventArgs e)
        {
            string   strValueForValidation;
            bool     blnFatalError      = false;
            bool     blnThereIsAProblem = false;
            string   strErrorMessage    = "";
            string   strAssignedProjectID;
            DateTime datPickupDate    = DateTime.Now;
            DateTime datExpDate       = DateTime.Now;
            DateTime datRequestDate   = DateTime.Now;
            decimal  decProjectedCost = 0;
            string   strRentalNotes;
            string   strPONumber;
            int      intRecordsReturned;
            DateTime datRequestingDate = DateTime.Now;
            int      intNoOfDays       = 0;

            try
            {
                expProcess.IsExpanded = false;

                blnFatalError = TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "New Blue Jay ERP // Create Rental");

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

                //beginning data validation
                strPONumber = txtPONumber.Text;
                if (strPONumber == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "PO Number Not Entered\n";
                }
                if (cboSelectEmployee.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Employee Was Not Selected\n";
                }
                if (cboSelectVendor.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Vendor Was Not Selected\n";
                }
                strAssignedProjectID = txtProjectID.Text;
                if (strAssignedProjectID == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Project ID Was Not Entered\n";
                }
                else
                {
                    TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strAssignedProjectID);

                    intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Project Was Not Found\n";
                    }
                    else
                    {
                        MainWindow.gintProjectID         = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;
                        MainWindow.gstrAssignedProjectID = strAssignedProjectID;
                    }
                }
                MainWindow.gstrAgreementNo = txtAgreementNo.Text;
                if (MainWindow.gstrAgreementNo == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "Rental Agreement Number Not Entered\n";
                }
                strValueForValidation = txtPickUpDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Pickup Date is not a Date\n";
                }
                else
                {
                    datPickupDate      = Convert.ToDateTime(strValueForValidation);
                    blnThereIsAProblem = TheDataValidationClass.verifyDateRange(DateTime.Now, datPickupDate);

                    if (blnThereIsAProblem == true)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Pickup Date is Before Today\n";
                    }
                }
                strValueForValidation = txtExpirationDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Expiration Date is not a Date\n";
                }
                else
                {
                    datExpDate = Convert.ToDateTime(strValueForValidation);

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

                    if (blnThereIsAProblem == true)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Expiration Date is Before Today\n";
                    }
                }
                strValueForValidation = txtProjectedCost.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDoubleData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Projected Cost is not Numeric\n";
                }
                else
                {
                    decProjectedCost = Convert.ToDecimal(strValueForValidation);
                }
                strRentalNotes = txtRentalNotes.Text;
                if (strRentalNotes == "")
                {
                    strRentalNotes = "Created Rental Object";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                intNoOfDays = TheDateSearchClass.DateDifference(datPickupDate, datExpDate);

                blnFatalError = TheRentalTrackingClass.InsertRentalTrackingTransaction(datRequestDate, strPONumber, MainWindow.gintEmployeeID, MainWindow.gintVendorID, datPickupDate, datExpDate, intNoOfDays, 0, MainWindow.gintProjectID, decProjectedCost);

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

                TheFindRentalTrackingTransactionByRequestingDateMatchDataSet = TheRentalTrackingClass.FindRentalTrackingTransactionByRequestingDateMatch(datRequestDate);

                MainWindow.gintRentalTrackingID = TheFindRentalTrackingTransactionByRequestingDateMatchDataSet.FindRentalTrackingTransactionByRequestingDateMatch[0].TransactionID;

                blnFatalError = TheRentalTrackingClass.InsertRentalTrackingUpdate(MainWindow.gintRentalTrackingID, datRequestDate, MainWindow.gintEmployeeID, "CREATED RENTAL");

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

                RentalItems RentalItems = new RentalItems();
                RentalItems.ShowDialog();

                TheMessagesClass.InformationMessage("The Rental Has Been Added");

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

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Esempio n. 8
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;
            bool     blnFatalError      = false;
            int      intEmployeeID;
            decimal  decHours;


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

                    TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProjectID);

                    intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheMessagesClass.ErrorMessage("Project Not Found, A Valid Project Must Be Entered");
                        return;
                    }
                    else
                    {
                        txtProjectName.Text              = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectName;
                        MainWindow.gintProjectID         = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;
                        MainWindow.gstrAssignedProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].AssignedProjectID;
                        gblnProjectFound = true;
                        intEmployeeID    = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;
                        decHours         = Convert.ToDecimal(txtEnterHours.Text);

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

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

                        TheFindProductivityDataEntryByDateDataSet = TheProductivityDataEntryClass.FindProductivityDataEntryByDate(datTransactionDate);

                        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");

                    TheFindEmployeeByLastNameDataSet = TheEmployeeClass.FindEmployeesByLastNameKeyWord(strLastName);

                    intNumberOfRecords = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName.Rows.Count - 1;

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

                    cboSelectEmployee.SelectedIndex = 0;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Enter Approved Transaction // Enter Last Name Text Change Event " + Ex.Message);
            }
        }
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string   strProjectID;
            int      intRecordsReturned;
            int      intCounter;
            int      intNumberOfRecords;
            DateTime datTransactionDate;
            string   strWorkTask;
            int      intSecondCounter;
            int      intSecondNumberOfRecords;
            bool     blnItemFound;
            int      intFootage;
            int      intSummaryCounter;
            decimal  decHours;
            decimal  decLaborCosts;
            DateTime datStartDate = DateTime.Now;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                strProjectID = txtEnterProjectID.Text;
                TheCompleteProjectInfoDataSet.projectinfo.Rows.Clear();
                TheProjectWorkSummaryDataSet.worksummary.Rows.Clear();
                gintSummaryCounter    = 0;
                gintSummaryUpperLimit = 0;

                gdecTotalHours = 0;
                gdecLaborCosts = 0;

                TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProjectID);

                intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    TheMessagesClass.ErrorMessage("Project Not Found");
                    return;
                }

                MainWindow.gintProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;

                datStartDate = TheDateSearchClass.SubtractingDays(datStartDate, 1500);

                TheFindProjectHoursDataSet = TheEmployeeProjectAssignmentClass.FindProjectHours(MainWindow.gintProjectID, datStartDate);

                intNumberOfRecords       = TheFindProjectHoursDataSet.FindProjectHours.Rows.Count - 1;
                intSecondNumberOfRecords = 0;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        blnItemFound       = false;
                        gdecTotalHours    += TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalHours;
                        gdecLaborCosts    += TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalEmployeeCost;
                        datTransactionDate = TheFindProjectHoursDataSet.FindProjectHours[intCounter].TransactionDate;
                        strWorkTask        = TheFindProjectHoursDataSet.FindProjectHours[intCounter].WorkTask;
                        decHours           = TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalHours;
                        decLaborCosts      = TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalEmployeeCost;

                        if (intSecondNumberOfRecords > 0)
                        {
                            for (intSecondCounter = 0; intSecondCounter < intSecondNumberOfRecords; intSecondCounter++)
                            {
                                if (strWorkTask == TheCompleteProjectInfoDataSet.projectinfo[intSecondCounter].WorkTask)
                                {
                                    if (datTransactionDate == TheCompleteProjectInfoDataSet.projectinfo[intSecondCounter].TransactionDate)
                                    {
                                        TheCompleteProjectInfoDataSet.projectinfo[intSecondCounter].Hours      += decHours;
                                        TheCompleteProjectInfoDataSet.projectinfo[intSecondCounter].LaborCosts += decLaborCosts;
                                        blnItemFound = true;
                                    }
                                }
                            }
                        }

                        if (blnItemFound == false)
                        {
                            CompleteProjectInfoDataSet.projectinfoRow NewTaskRow = TheCompleteProjectInfoDataSet.projectinfo.NewprojectinfoRow();

                            NewTaskRow.FootagePieces   = 0;
                            NewTaskRow.TransactionDate = datTransactionDate;
                            NewTaskRow.WorkTask        = strWorkTask;
                            NewTaskRow.Hours           = decHours;
                            NewTaskRow.LaborCosts      = decLaborCosts;

                            TheCompleteProjectInfoDataSet.projectinfo.Rows.Add(NewTaskRow);
                            intSecondNumberOfRecords++;
                        }
                    }
                }

                intNumberOfRecords = TheCompleteProjectInfoDataSet.projectinfo.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    intFootage         = 0;
                    strWorkTask        = TheCompleteProjectInfoDataSet.projectinfo[intCounter].WorkTask;
                    datTransactionDate = TheCompleteProjectInfoDataSet.projectinfo[intCounter].TransactionDate;

                    TheFindWorkTaskByWorkTaskDataSet = TheWorkTaskClass.FindWorkTaskByWorkTask(strWorkTask);

                    MainWindow.gintWorkTaskID = TheFindWorkTaskByWorkTaskDataSet.FindWorkTaskByWorkTask[0].WorkTaskID;

                    TheFindSpecificProjectWorkTaskDataSet = TheProjectTaskClass.FindSpecificProjectWorkTask(MainWindow.gintProjectID, MainWindow.gintWorkTaskID);

                    intSecondNumberOfRecords = TheFindSpecificProjectWorkTaskDataSet.FindSpecificProjectWorkTask.Rows.Count - 1;

                    for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                    {
                        if (TheCompleteProjectInfoDataSet.projectinfo[intCounter].FootagePieces == 0)
                        {
                            if (datTransactionDate == TheFindSpecificProjectWorkTaskDataSet.FindSpecificProjectWorkTask[intSecondCounter].TransactionDate)
                            {
                                intFootage = Convert.ToInt32(TheFindSpecificProjectWorkTaskDataSet.FindSpecificProjectWorkTask[intSecondCounter].FootagePieces);

                                TheCompleteProjectInfoDataSet.projectinfo[intCounter].FootagePieces = intFootage;
                            }
                        }
                    }
                }

                intNumberOfRecords = TheCompleteProjectInfoDataSet.projectinfo.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    blnItemFound = false;

                    strWorkTask = TheCompleteProjectInfoDataSet.projectinfo[intCounter].WorkTask;

                    if (gintSummaryCounter > 0)
                    {
                        for (intSummaryCounter = 0; intSummaryCounter <= gintSummaryUpperLimit; intSummaryCounter++)
                        {
                            if (strWorkTask == TheProjectWorkSummaryDataSet.worksummary[intSummaryCounter].WorkTask)
                            {
                                TheProjectWorkSummaryDataSet.worksummary[intSummaryCounter].FootagePieces += TheCompleteProjectInfoDataSet.projectinfo[intCounter].FootagePieces;
                                TheProjectWorkSummaryDataSet.worksummary[intSummaryCounter].Hours         += TheCompleteProjectInfoDataSet.projectinfo[intCounter].Hours;
                                blnItemFound = true;
                            }
                        }
                    }

                    if (blnItemFound == false)
                    {
                        ProjectWorkSummaryDataSet.worksummaryRow NewTaskRow = TheProjectWorkSummaryDataSet.worksummary.NewworksummaryRow();

                        NewTaskRow.FootagePieces = TheCompleteProjectInfoDataSet.projectinfo[intCounter].FootagePieces;
                        NewTaskRow.WorkTask      = strWorkTask;
                        NewTaskRow.Hours         = TheCompleteProjectInfoDataSet.projectinfo[intCounter].Hours;
                        NewTaskRow.LaborCosts    = TheCompleteProjectInfoDataSet.projectinfo[intCounter].LaborCosts;

                        TheProjectWorkSummaryDataSet.worksummary.Rows.Add(NewTaskRow);

                        gintSummaryUpperLimit = gintSummaryCounter;
                        gintSummaryCounter++;
                    }
                }

                dgrResults.ItemsSource = TheProjectWorkSummaryDataSet.worksummary;
                txtTotalHours.Text     = Convert.ToString(gdecTotalHours);
                txtLaborCosts.Text     = Convert.ToString(gdecLaborCosts);

                PleaseWait.Close();
            }
            catch (Exception Ex)
            {
                PleaseWait.Close();

                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Find Project Hours // Generate Report Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Esempio n. 11
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            string strAssignedpProjectID;
            int    intRecordsReturned;
            int    intCounter;
            int    intNumberOfRecords;
            double douPrice;
            double douTotalPrice;

            try
            {
                TheProjectMaterialCostingDataSet.projectmateriacosting.Rows.Clear();
                gdecTotalCost         = 0;
                gdecTotalHours        = 0;
                strAssignedpProjectID = txtEnterAssignedProjectID.Text;
                if (strAssignedpProjectID == "")
                {
                    TheMessagesClass.ErrorMessage("The Assigned Project ID Was Not Entered");
                    return;
                }

                TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strAssignedpProjectID);

                intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

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

                TheFindProjectHoursCostingDataSet = TheProjectCostingClass.FindProjectHoursCosting(strAssignedpProjectID);

                intNumberOfRecords = TheFindProjectHoursCostingDataSet.FindProjectHoursCosting.Rows.Count - 1;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        gdecTotalHours += TheFindProjectHoursCostingDataSet.FindProjectHoursCosting[intCounter].TotalHours;
                    }
                }

                txtTotalHOurs.Text = Convert.ToString(gdecTotalHours);

                dgrHours.ItemsSource = TheFindProjectHoursCostingDataSet.FindProjectHoursCosting;

                TheFindProjectMaterialCostingDataSet = TheProjectCostingClass.FindProjectMaterialCosting(strAssignedpProjectID);

                intNumberOfRecords = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting.Rows.Count - 1;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        douPrice = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting[intCounter].Price;
                        douPrice = Math.Round(douPrice, 2);

                        douTotalPrice = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting[intCounter].PartPrice;
                        douTotalPrice = Math.Round(douTotalPrice, 2);

                        gdecTotalCost += Convert.ToDecimal(douTotalPrice);

                        ProjectMaterialCostingDataSet.projectmateriacostingRow NewPartCost = TheProjectMaterialCostingDataSet.projectmateriacosting.NewprojectmateriacostingRow();

                        NewPartCost.PartID          = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting[intCounter].PartID;
                        NewPartCost.PartNumber      = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting[intCounter].PartNumber;
                        NewPartCost.PartDescription = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting[intCounter].PartDescription;
                        NewPartCost.TotalQuantity   = TheFindProjectMaterialCostingDataSet.FindProjectMaterialCosting[intCounter].TotalQuantity;
                        NewPartCost.TotalCost       = Convert.ToDecimal(douTotalPrice);
                        NewPartCost.Cost            = Convert.ToDecimal(douPrice);

                        //adding the row
                        TheProjectMaterialCostingDataSet.projectmateriacosting.Rows.Add(NewPartCost);
                    }
                }

                txtTotalMaterialCost.Text = Convert.ToString(gdecTotalCost);

                dgrMaterials.ItemsSource = TheProjectMaterialCostingDataSet.projectmateriacosting;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Project Costing // Search Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Esempio n. 12
0
        private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            //setting up local variables
            string strValueEntered;
            int    intRecordsReturned;
            int    intProjectID;

            try
            {
                strValueEntered = txtEnterPOProject.Text;

                MainWindow.TheFindRentalTrackingTransactionsByPONumberDataSet = TheRentalTrackingClass.FindRentalTrackingTransactionByPONumber(strValueEntered);

                //getting the record count
                intRecordsReturned = MainWindow.TheFindRentalTrackingTransactionsByPONumberDataSet.FindRentalTrackingTransactionByPONumber.Rows.Count;

                if (intRecordsReturned == 1)
                {
                    MainWindow.gblnRentalPO         = true;
                    MainWindow.gintRentalTrackingID = MainWindow.TheFindRentalTrackingTransactionsByPONumberDataSet.FindRentalTrackingTransactionByPONumber[0].TransactionID;
                }
                else if (intRecordsReturned > 1)
                {
                    MainWindow.gblnRentalPO = true;
                    SelectRental SelectRental = new SelectRental();
                    SelectRental.ShowDialog();
                }
                else if (intRecordsReturned < 1)
                {
                    MainWindow.gblnRentalPO = false;

                    TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strValueEntered);

                    intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheMessagesClass.ErrorMessage("Project Was Not Found");
                        return;
                    }

                    intProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;

                    MainWindow.TheFindRentalTransactionByProjectIDDataSet = TheRentalTrackingClass.FindRentalTransactionByProjectID(intProjectID);

                    //getting the record count
                    intRecordsReturned = MainWindow.TheFindRentalTransactionByProjectIDDataSet.FindRentalTransasctionByProjectID.Rows.Count;

                    if (intRecordsReturned == 1)
                    {
                        MainWindow.gintRentalTrackingID = MainWindow.TheFindRentalTransactionByProjectIDDataSet.FindRentalTransasctionByProjectID[0].TransactionID;
                    }
                    else if (intRecordsReturned > 1)
                    {
                        SelectRental SelectRental = new SelectRental();
                        SelectRental.ShowDialog();
                    }
                    else if (intRecordsReturned < 1)
                    {
                        TheMessagesClass.ErrorMessage("No Rentals Were Found");
                        return;
                    }
                }

                LoadControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Update Rental // Find Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Esempio n. 13
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());
            }
        }
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            int      intCounter;
            int      intNumberOfRecords;
            string   strValueForValidation;
            bool     blnFatalError      = false;
            bool     blnThereIsaProblem = false;
            DateTime datStartDate       = DateTime.Now;
            DateTime datEndDate         = DateTime.Now;
            string   strProjectID;
            string   strErrorMessage = "";
            string   strProjectName;
            int      intProjectID;

            try
            {
                TheProductivityDataEntryDataSet.dataentry.Rows.Clear();

                if ((gstrReportType == "DATE RANGE") || (gstrReportType == "EMPLOYEE"))
                {
                    strValueForValidation = txtStartDate.Text;
                    blnThereIsaProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                    if (blnThereIsaProblem == true)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Start Date is not a Date\n";
                    }
                    else
                    {
                        datStartDate = Convert.ToDateTime(strValueForValidation);
                        datStartDate = TheDateSearchClass.RemoveTime(datStartDate);
                    }
                    strValueForValidation = txtEndDate.Text;
                    blnThereIsaProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                    if (blnThereIsaProblem == true)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The End Date is not a Date\n";
                    }
                    else
                    {
                        datEndDate = Convert.ToDateTime(strValueForValidation);
                        datEndDate = TheDateSearchClass.RemoveTime(datEndDate);
                        datEndDate = TheDateSearchClass.AddingDays(datEndDate, 1);
                    }
                    if (gstrReportType == "EMPLOYEE")
                    {
                        if (cboSelectEmployee.SelectedIndex < 1)
                        {
                            blnFatalError    = true;
                            strErrorMessage += "Employee Was Not Selected\n";
                        }
                    }
                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage(strErrorMessage);
                        return;
                    }
                    else
                    {
                        blnFatalError = TheDataValidationClass.verifyDateRange(datStartDate, datEndDate);
                        if (blnFatalError == true)
                        {
                            TheMessagesClass.ErrorMessage("The Start Date is After the End Date");
                            return;
                        }
                    }

                    if (gstrReportType == "DATE RANGE")
                    {
                        TheFindProductivityDataEntryByDateRangeDataSet = TheProductivityDataEntryClass.FindProductivityDataEntbyDateRange(datStartDate, datEndDate);

                        intNumberOfRecords = TheFindProductivityDataEntryByDateRangeDataSet.FindProductivityDataEntryByDateRange.Rows.Count - 1;

                        if (intNumberOfRecords < 0)
                        {
                            TheMessagesClass.InformationMessage("No Records Found");
                            return;
                        }
                        else
                        {
                            for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                            {
                                ProductivityDataEntryDataSet.dataentryRow NewTransactionRow = TheProductivityDataEntryDataSet.dataentry.NewdataentryRow();

                                NewTransactionRow.EntryDate     = TheFindProductivityDataEntryByDateRangeDataSet.FindProductivityDataEntryByDateRange[intCounter].EntryDate;
                                NewTransactionRow.FirstName     = TheFindProductivityDataEntryByDateRangeDataSet.FindProductivityDataEntryByDateRange[intCounter].FirstName;
                                NewTransactionRow.LastName      = TheFindProductivityDataEntryByDateRangeDataSet.FindProductivityDataEntryByDateRange[intCounter].LastName;
                                NewTransactionRow.ProjectID     = TheFindProductivityDataEntryByDateRangeDataSet.FindProductivityDataEntryByDateRange[intCounter].AssignedProjectID;
                                NewTransactionRow.ProjectName   = TheFindProductivityDataEntryByDateRangeDataSet.FindProductivityDataEntryByDateRange[intCounter].ProjectName;
                                NewTransactionRow.TransactionID = TheFindProductivityDataEntryByDateRangeDataSet.FindProductivityDataEntryByDateRange[intCounter].TransactionID;

                                TheProductivityDataEntryDataSet.dataentry.Rows.Add(NewTransactionRow);
                            }
                        }
                    }
                    else if (gstrReportType == "EMPLOYEE")
                    {
                        TheFindProductivityDataEntryByEmployeeIDDataSet = TheProductivityDataEntryClass.FindProductivityDataEntryByEmployeeID(gintEmployeeID, datStartDate, datEndDate);

                        intNumberOfRecords = TheFindProductivityDataEntryByEmployeeIDDataSet.FindProductivityDataEntryByEmployeeID.Rows.Count - 1;

                        if (intNumberOfRecords < 0)
                        {
                            TheMessagesClass.InformationMessage("No Records Found");
                            return;
                        }
                        else
                        {
                            for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                            {
                                ProductivityDataEntryDataSet.dataentryRow NewTransactionRow = TheProductivityDataEntryDataSet.dataentry.NewdataentryRow();

                                NewTransactionRow.EntryDate     = TheFindProductivityDataEntryByEmployeeIDDataSet.FindProductivityDataEntryByEmployeeID[intCounter].EntryDate;
                                NewTransactionRow.FirstName     = TheComboBoxEmployeeDataSet.employees[cboSelectEmployee.SelectedIndex - 1].FirstName;
                                NewTransactionRow.LastName      = TheComboBoxEmployeeDataSet.employees[cboSelectEmployee.SelectedIndex - 1].LastName;
                                NewTransactionRow.ProjectID     = TheFindProductivityDataEntryByEmployeeIDDataSet.FindProductivityDataEntryByEmployeeID[intCounter].AssignedProjectID;
                                NewTransactionRow.ProjectName   = TheFindProductivityDataEntryByEmployeeIDDataSet.FindProductivityDataEntryByEmployeeID[intCounter].ProjectName;
                                NewTransactionRow.TransactionID = TheFindProductivityDataEntryByEmployeeIDDataSet.FindProductivityDataEntryByEmployeeID[intCounter].TransactionID;

                                TheProductivityDataEntryDataSet.dataentry.Rows.Add(NewTransactionRow);
                            }
                        }
                    }
                }
                else if (gstrReportType == "PROJECT")
                {
                    strProjectID = txtEnteredData.Text;
                    if (strProjectID == "")
                    {
                        TheMessagesClass.ErrorMessage("The Project Was Not Entered");
                        return;
                    }

                    TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProjectID);

                    intNumberOfRecords = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count - 1;

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

                    strProjectName = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectName;
                    intProjectID   = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;

                    TheFindProductivtyDataEntryByProjectIDdataSet = TheProductivityDataEntryClass.FindProductivityDataEntryByProjectID(intProjectID);

                    intNumberOfRecords = TheFindProductivtyDataEntryByProjectIDdataSet.FindProductivityDataEntryByProjectID.Rows.Count - 1;

                    if (intNumberOfRecords < 0)
                    {
                        TheMessagesClass.InformationMessage("No Records Found");
                        return;
                    }
                    else
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            ProductivityDataEntryDataSet.dataentryRow NewTransactionRow = TheProductivityDataEntryDataSet.dataentry.NewdataentryRow();

                            NewTransactionRow.EntryDate     = TheFindProductivtyDataEntryByProjectIDdataSet.FindProductivityDataEntryByProjectID[intCounter].EntryDate;
                            NewTransactionRow.FirstName     = TheFindProductivtyDataEntryByProjectIDdataSet.FindProductivityDataEntryByProjectID[intCounter].FirstName;
                            NewTransactionRow.LastName      = TheFindProductivtyDataEntryByProjectIDdataSet.FindProductivityDataEntryByProjectID[intCounter].LastName;
                            NewTransactionRow.ProjectID     = strProjectID;
                            NewTransactionRow.ProjectName   = strProjectName;
                            NewTransactionRow.TransactionID = TheFindProductivtyDataEntryByProjectIDdataSet.FindProductivityDataEntryByProjectID[intCounter].TransactionID;

                            TheProductivityDataEntryDataSet.dataentry.Rows.Add(NewTransactionRow);
                        }
                    }
                }

                dgrResults.ItemsSource = TheProductivityDataEntryDataSet.dataentry;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Productivity Date Entry Report // Generate Report Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Esempio n. 15
0
        private void txtAssignedProjectID_TextChanged(object sender, TextChangedEventArgs e)
        {
            string strAssignedProjectID;
            int    intLength;
            int    intRecordsReturned;
            string strCustomerID;
            int    intCounter;
            int    intNumberOfRecords;
            int    intDepartmentID;
            int    intOfficeID;
            int    intStatusID;
            int    intManagerID;
            int    intSelectedIndex = 0;

            try
            {
                strAssignedProjectID    = txtAssignedProjectID.Text;
                intLength               = strAssignedProjectID.Length;
                gblnProjectExists       = false;
                gblnProjectMatrixExists = false;

                if (intLength > 7)
                {
                    TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strAssignedProjectID);

                    intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;


                    if (intRecordsReturned > 0)
                    {
                        if (strAssignedProjectID.Contains("003") == false)
                        {
                            if (strAssignedProjectID.Contains("004") == false)
                            {
                                if (strAssignedProjectID.Contains("086") == false)
                                {
                                    if (strAssignedProjectID.Contains("920") == false)
                                    {
                                        if (strAssignedProjectID.Contains("921") == false)
                                        {
                                            gblnProjectExists = true;

                                            txtProjectName.Text = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectName;
                                            gintProjectID       = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;

                                            TheFindProjectMatrixByProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByProjectID(gintProjectID);

                                            intRecordsReturned = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID.Rows.Count;

                                            if (intRecordsReturned > 0)
                                            {
                                                strCustomerID = txtCustomerProjectID.Text;

                                                if (strCustomerID != "")
                                                {
                                                    if (strCustomerID != TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].CustomerAssignedID)
                                                    {
                                                        TheMessagesClass.ErrorMessage("The Assigned Project ID is Assigned to Another CustomerID\nContact IT");
                                                        return;
                                                    }

                                                    gblnProjectMatrixExists = true;
                                                    intDepartmentID         = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].DepartmentID;
                                                    intOfficeID             = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].WarehouseID;

                                                    //setting up combo boxes
                                                    intNumberOfRecords = TheFindSortedCustomerLinesDataSet.FindSortedCustomerLines.Rows.Count - 1;

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

                                                    cboSelectDepartment.SelectedIndex = intSelectedIndex;

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

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

                                                    cboSelectOffice.SelectedIndex = intSelectedIndex;

                                                    TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(gintProjectID);

                                                    intRecordsReturned = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID.Rows.Count;

                                                    if (intRecordsReturned < 1)
                                                    {
                                                        TheMessagesClass.InformationMessage("The Project Has Been Entered, but Missing Some Information");
                                                        return;
                                                    }

                                                    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);
                                                    txtPRojectNotes.Text = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].ProjectNotes;

                                                    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;

                                                    intStatusID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].CurrentStatusID;

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

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

                                                    cboSelectStatus.SelectedIndex = intSelectedIndex;

                                                    TheMessagesClass.InformationMessage("The Project Is Already Entered");
                                                }
                                                else if (txtCustomerProjectID.Text == "")
                                                {
                                                    txtCustomerProjectID.Text = TheFindProjectMatrixByProjectIDDataSet.FindProjectMatrixByProjectID[0].CustomerAssignedID;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Add Project // Assigned Project ID Text Box " + Ex.Message);

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

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            string strValueForValidation;
            string strErrorMessage    = "";
            bool   blnThereIsAProblem = false;
            bool   blnFatalError      = false;
            int    intCounter;
            int    intNumberOfRecords;
            string strProjectID;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();
            gdecTotalHours = 0;
            TheEmployeeProjectTaskDataSet.projecttask.Rows.Clear();

            try
            {
                if (cboSelectEmployee.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "An Employee Has Not Been Selected\n";
                }
                strValueForValidation = txtEnterStartDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Start Date is not a Date\n";
                }
                else
                {
                    gdatStartDate = Convert.ToDateTime(strValueForValidation);
                }
                strValueForValidation = txtEnterEndDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The End Date is not a Date\n";
                }
                else
                {
                    gdatEndDate = Convert.ToDateTime(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                blnFatalError = TheDataValidationClass.verifyDateRange(gdatStartDate, gdatEndDate);
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("The Start Date is after the End Date");
                    return;
                }

                TheFindEmployeeProjectTasksDataSet = TheEmployeeProductivityStatsClass.FindEmployeeProjectTaskStats(MainWindow.gintEmployeeID, gdatStartDate, gdatEndDate);
                TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(MainWindow.gintEmployeeID);

                intNumberOfRecords = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats.Rows.Count - 1;

                if (intNumberOfRecords > -1)
                {
                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        strProjectID = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].AssignedProjectID;
                        TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProjectID);

                        EmployeeProjectTaskDataSet.projecttaskRow NewProjectTaskRow = TheEmployeeProjectTaskDataSet.projecttask.NewprojecttaskRow();

                        NewProjectTaskRow.AssignedProjectID  = strProjectID;
                        NewProjectTaskRow.HomeOffice         = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].HomeOffice;
                        NewProjectTaskRow.ProjectName        = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectName;
                        NewProjectTaskRow.TotalFootagePieces = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].TotalFootage;
                        NewProjectTaskRow.TotalHours         = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].TaskTotalHours;
                        NewProjectTaskRow.WorkTask           = TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].WorkTask;
                        gdecTotalHours += TheFindEmployeeProjectTasksDataSet.FindEmployeeProjectTaskStats[intCounter].TaskTotalHours;

                        TheEmployeeProjectTaskDataSet.projecttask.Rows.Add(NewProjectTaskRow);
                    }
                }


                dgrResults.ItemsSource = TheEmployeeProjectTaskDataSet.projecttask;
                txtTotalHours.Text     = Convert.ToString(gdecTotalHours);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Find Employee Hours // Generate Report Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }
Esempio n. 17
0
        private void mitSave_Click(object sender, RoutedEventArgs e)
        {
            string strAssignedProjectID;
            string strProjectName;
            bool   blnFatalError   = false;
            string strErrorMessage = "";
            int    intRecordsReturned;
            bool   blnDIDExists;
            bool   blnNameExists;

            try
            {
                //beginning data validation
                strAssignedProjectID = txtAssignedProjectID.Text;
                strProjectName       = txtProjectName.Text;
                blnDIDExists         = false;
                blnNameExists        = false;

                if (strAssignedProjectID == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Assigned Project ID Was Not Entered\n";
                }
                if (strProjectName == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Project Name Was Not Entered\n";
                }
                else
                {
                    TheFindProjectByProjectNameDataSet = TheProjectClass.FindProjectByProjectName(strProjectName);

                    intRecordsReturned = TheFindProjectByProjectNameDataSet.FindProjectByProjectName.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnNameExists = true;
                    }
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strAssignedProjectID);

                intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    blnDIDExists = true;
                }


                if ((blnDIDExists == true) && (blnNameExists == true))
                {
                    TheMessagesClass.ErrorMessage("This Project Currently Exists");
                    return;
                }

                blnFatalError = TheProjectClass.InsertProject(strAssignedProjectID, strProjectName);
                if (blnFatalError == true)
                {
                    throw new Exception();
                }

                TheMessagesClass.InformationMessage("The Project Has Been Saved");
                txtAssignedProjectID.Text = "";
                txtProjectName.Text       = "";
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Add Project // Save Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Esempio n. 18
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //setting up the local variables
            int      intCounter;
            int      intNumberOfRecords;
            int      intProjectID;
            DateTime datTransactionDate = DateTime.Now;

            try
            {
                datTransactionDate = TheDateSearchClass.RemoveTime(datTransactionDate);

                datTransactionDate = TheDateSearchClass.SubtractingDays(datTransactionDate, 31);

                TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID("SHOP");

                intProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;

                TheFindProjectHoursDataSet = TheEmployeeProjectAssignmentClass.FindProjectHours(intProjectID, datTransactionDate);

                TheFindProjectStatsDataSet = TheEmployeeProductivityStatsClass.FindProjectStats(intProjectID);

                intNumberOfRecords = TheFindProjectHoursDataSet.FindProjectHours.Rows.Count - 1;

                gdecMean           = TheFindProjectStatsDataSet.FindProjectStats[0].AveHours;
                gdecStandDeviation = Convert.ToDecimal(TheFindProjectStatsDataSet.FindProjectStats[0].HoursSTDev);
                gdecVariance       = Convert.ToDecimal(TheFindProjectStatsDataSet.FindProjectStats[0].HoursVariance);
                gdecTotalHours     = Convert.ToDecimal(TheFindProjectStatsDataSet.FindProjectStats[0].TotalHours);


                gdecMean = Math.Round(gdecMean, 4);

                txtAverageHours.Text = Convert.ToString(gdecMean);

                gdecVariance       = Math.Round(gdecVariance, 4);
                gdecStandDeviation = Math.Round(gdecStandDeviation, 4);

                gdecUpperBound = gdecMean + gdecStandDeviation;

                txtUpperBound.Text = Convert.ToString(gdecUpperBound);

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    if (TheFindProjectHoursDataSet.FindProjectHours[intCounter].TransactionDate > datTransactionDate)
                    {
                        if (TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalHours > gdecUpperBound)
                        {
                            ShopViolatorDataSet.violatorRow NewViolatorRow = TheShopViolatorDataSet.violator.NewviolatorRow();

                            NewViolatorRow.FirstName       = TheFindProjectHoursDataSet.FindProjectHours[intCounter].FirstName;
                            NewViolatorRow.LastName        = TheFindProjectHoursDataSet.FindProjectHours[intCounter].LastName;
                            NewViolatorRow.Hours           = TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalHours;
                            NewViolatorRow.TransactionDate = TheFindProjectHoursDataSet.FindProjectHours[intCounter].TransactionDate;
                            NewViolatorRow.HomeOffice      = TheFindProjectHoursDataSet.FindProjectHours[intCounter].HomeOffice;

                            TheShopViolatorDataSet.violator.Rows.Add(NewViolatorRow);
                        }
                    }
                }

                dgrResults.ItemsSource = TheShopViolatorDataSet.violator;

                gdecProjectHours      = gdecMean * 5 * 52;
                txtProjectHours.Text  = Convert.ToString(gdecProjectHours);
                gdecProjectCost       = gdecProjectHours * 12;
                txtProjectedCost.Text = Convert.ToString(gdecProjectCost);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Shop Hours Analysis // Window Loaded " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Esempio n. 19
0
        private void AddSaveRecord()
        {
            //setting local variables
            string strPartNumber;
            string strProject;
            int    intPartID    = 0;
            string strMSRNumber = "NOT REQUIRED";
            string strValueForValidation;
            int    intQuantity        = 0;
            bool   blnThereIsAProblem = false;
            bool   blnFatalError      = false;
            string strErrorMessage    = "";
            int    intRecordsFound;
            bool   blnProjectNotFound = false;
            bool   blnPartNotFound    = true;
            bool   blnKeyWordNotFound;
            int    intTotalQuantity;
            int    intProjectID       = 0;
            string strJDEPartNumber   = "";
            int    intEmployeeID      = 0;
            int    intEnterEmployeeID = 0;

            try
            {
                if (btnAdd.Content.ToString() == "Add")
                {
                    //loading controls
                    txtDateEntryComplete.Text = "NO";
                    txtDate.Text = Convert.ToString(DateTime.Now);

                    btnAdd.Content = "Save";
                }
                else
                {
                    if (MainWindow.gstrMenuSelection == "Issue")
                    {
                        if (cboSelectEmployee.SelectedIndex < 1)
                        {
                            blnFatalError    = true;
                            strErrorMessage += "Employee Was Not Selected\n";
                        }
                    }

                    //data validation
                    strProject = txtProjectID.Text;
                    if (strProject == "")
                    {
                        blnFatalError    = true;
                        strErrorMessage += "Project ID Was Not Entered\n";
                    }
                    else
                    {
                        TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProject);

                        intRecordsFound = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                        if (intRecordsFound == 0)
                        {
                            TheFindProjectByProjectNameDataSet = TheProjectClass.FindProjectByProjectName(strProject);

                            intRecordsFound = TheFindProjectByProjectNameDataSet.FindProjectByProjectName.Rows.Count;

                            if (intRecordsFound == 0)
                            {
                                blnThereIsAProblem = TheDataValidationClass.VerifyIntegerData(strProject);

                                if (blnThereIsAProblem == true)
                                {
                                    blnProjectNotFound = true;
                                }
                                else
                                {
                                    TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(Convert.ToInt32(strProject));

                                    intRecordsFound = TheFindProjectByProjectIDDataSet.FindProjectByProjectID.Rows.Count;

                                    if (intRecordsFound == 0)
                                    {
                                        blnProjectNotFound = true;
                                    }
                                    else
                                    {
                                        intProjectID = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].ProjectID;
                                        strProject   = TheFindProjectByProjectIDDataSet.FindProjectByProjectID[0].AssignedProjectID;
                                    }
                                }
                            }
                            else
                            {
                                strProject   = TheFindProjectByProjectNameDataSet.FindProjectByProjectName[0].AssignedProjectID;
                                intProjectID = TheFindProjectByProjectNameDataSet.FindProjectByProjectName[0].ProjectID;
                            }
                        }
                        else
                        {
                            intProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;
                        }

                        if (blnProjectNotFound == true)
                        {
                            blnFatalError    = true;
                            strErrorMessage += "Project Was Not Found\n";
                        }
                    }
                    if (MainWindow.gstrMenuSelection == "Receive")
                    {
                        strMSRNumber = txtMSRPONumber.Text;
                        if (strMSRNumber == "")
                        {
                            blnFatalError    = true;
                            strErrorMessage += "MSR or PO Number Was Not Entered\n";
                        }
                        else if (strMSRNumber == "NO MSR NUMBER PROVIDED")
                        {
                            blnFatalError    = true;
                            strErrorMessage += "NO MSR NUMBER PROVIDED Cannot Be Entered\n";
                        }
                    }
                    strPartNumber = txtPartNumber.Text;
                    if (strPartNumber == "")
                    {
                        blnFatalError    = true;
                        strErrorMessage += "Part Number Was Not Entered\n";
                    }
                    else
                    {
                        blnPartNotFound = true;

                        blnThereIsAProblem = TheDataValidationClass.VerifyIntegerData(strPartNumber);
                        if (blnThereIsAProblem == false)
                        {
                            intPartID = Convert.ToInt32(strPartNumber);

                            TheFindPartByPartIDDataSet = ThePartNumberClass.FindPartByPartID(intPartID);

                            intRecordsFound = TheFindPartByPartIDDataSet.FindPartByPartID.Rows.Count;

                            if (intRecordsFound == 1)
                            {
                                blnPartNotFound  = false;
                                strPartNumber    = TheFindPartByPartIDDataSet.FindPartByPartID[0].PartNumber;
                                strJDEPartNumber = TheFindPartByPartIDDataSet.FindPartByPartID[0].JDEPartNumber;
                            }
                        }

                        if (blnPartNotFound == true)
                        {
                            TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                            intRecordsFound = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                            if (intRecordsFound == 1)
                            {
                                blnPartNotFound  = false;
                                intPartID        = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].PartID;
                                strJDEPartNumber = TheFindPartByPartNumberDataSet.FindPartByPartNumber[0].JDEPartNumber;
                            }

                            if (blnPartNotFound == true)
                            {
                                TheFindPartByJDEPartNumber = ThePartNumberClass.FindPartByJDEPartNumber(strPartNumber);

                                intRecordsFound = TheFindPartByJDEPartNumber.FindPartByJDEPartNumber.Rows.Count;

                                if (intRecordsFound == 1)
                                {
                                    blnPartNotFound  = false;
                                    intPartID        = TheFindPartByJDEPartNumber.FindPartByJDEPartNumber[0].PartID;
                                    strPartNumber    = TheFindPartByJDEPartNumber.FindPartByJDEPartNumber[0].PartNumber;
                                    strJDEPartNumber = TheFindPartByJDEPartNumber.FindPartByJDEPartNumber[0].JDEPartNumber;
                                }
                            }
                        }

                        if (MainWindow.gstrWarehouseName != "TRAINING")
                        {
                            //checking to see if non charter number
                            blnKeyWordNotFound = TheKeyWordClass.FindKeyWord("JH", MainWindow.gstrWarehouseName);

                            if (blnKeyWordNotFound == true)
                            {
                                if (strJDEPartNumber == "NOT REQUIRED")
                                {
                                    blnFatalError    = true;
                                    strErrorMessage += "Using Non Charter Part Number for Charter Warehouse\n";
                                }

                                if (strJDEPartNumber == "NOT PROVIDED")
                                {
                                    blnFatalError    = true;
                                    strErrorMessage += "Using Non Charter Part Number for Charter Warehouse\n";
                                }
                            }
                        }

                        if (blnPartNotFound == true)
                        {
                            blnFatalError    = true;
                            strErrorMessage += "Part Number Not Found\n";
                        }
                    }

                    //validating the Quantity
                    strValueForValidation = txtQuantity.Text;
                    blnThereIsAProblem    = TheDataValidationClass.VerifyIntegerData(strValueForValidation);
                    if (blnThereIsAProblem == true)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "The Quantity Entered is not an Integer\n";
                    }
                    else
                    {
                        intQuantity = Convert.ToInt32(strValueForValidation);
                    }

                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage(strErrorMessage);
                        return;
                    }

                    //checking quantity for issuing
                    if (MainWindow.gstrMenuSelection == "Issue")
                    {
                        TheFindWarehouseInventoryPartDataSet = TheInventoryClass.FindWarehouseInventoryPart(intPartID, MainWindow.gintWarehouseID);

                        intRecordsFound = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart.Rows.Count;

                        if (intRecordsFound == 0)
                        {
                            intTotalQuantity = 0;
                        }
                        else
                        {
                            intTotalQuantity = TheFindWarehouseInventoryPartDataSet.FindWarehouseInventoryPart[0].Quantity;
                        }

                        intTotalQuantity = CalculateWIPCount(intPartID, MainWindow.gintWarehouseID, intTotalQuantity);

                        if (intQuantity > intTotalQuantity)
                        {
                            TheMessagesClass.ErrorMessage("The Quantity Issued is greater than the Quantity On The Shelf");
                            return;
                        }
                    }

                    if (MainWindow.gstrMenuSelection == "Issue")
                    {
                        intEmployeeID      = gintSelectedEmployeeID;
                        intEnterEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;
                    }
                    else
                    {
                        intEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;
                    }

                    blnFatalError = TheInventoryWIPClass.InsertDataEntryWIP(MainWindow.gintSessionID, intPartID, strPartNumber, intProjectID, strProject, strMSRNumber, MainWindow.gintWarehouseID, intQuantity, intEmployeeID, MainWindow.gstrMenuSelection.ToUpper());

                    if (blnFatalError == true)
                    {
                        TheMessagesClass.ErrorMessage("There Has Been A Problem. Contact IT");
                        return;
                    }

                    ClearControls();
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Enter Inventory \\ Enter Material \\ Add Button During Save " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            string   strProjectID;
            int      intRecordsReturned;
            int      intCounter;
            int      intNumberOfRecords;
            string   strFirstName;
            string   strLastName;
            DateTime datTransactionDate;
            string   strWorkTask;
            int      intSecondCounter;
            int      intSecondNumberOfRecords;
            bool     blnItemFound;
            int      intTaskCounter;
            DateTime datStartDate = DateTime.Now;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                TheProjectDailyTaskDataSet.projecttask.Rows.Clear();
                TheProjectEmployeeHoursDataSet.employees.Rows.Clear();
                strProjectID = txtEnterProjectID.Text;
                if (strProjectID == "")
                {
                    TheMessagesClass.ErrorMessage("Project ID Was Not Entered");
                    PleaseWait.Close();
                    return;
                }

                gdecTotalHours = 0;
                TheEmployeeCrewDataSet.employeework.Rows.Clear();

                TheFindProjectByAssignedProjectIDDataSet = TheProjectClass.FindProjectByAssignedProjectID(strProjectID);

                intRecordsReturned = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID.Rows.Count;

                if (intRecordsReturned == 0)
                {
                    TheMessagesClass.InformationMessage("Project Was Not Found");
                    PleaseWait.Close();
                    return;
                }

                MainWindow.gintProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectID;

                TheFindProjectTaskHoursByAssignedProjectIDDataSet = TheProjectTaskClass.FindProjectTaskHoursByAssignedProjectID(strProjectID);

                datStartDate = TheDataSearchClass.SubtractingDays(datStartDate, 1200);

                TheFindProjectHoursDataSet = TheEmployeeProjectAssignmentClass.FindProjectHours(MainWindow.gintProjectID, datStartDate);

                intNumberOfRecords = TheFindProjectHoursDataSet.FindProjectHours.Rows.Count - 1;

                intSecondNumberOfRecords = 0;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strFirstName       = TheFindProjectHoursDataSet.FindProjectHours[intCounter].FirstName;
                    strLastName        = TheFindProjectHoursDataSet.FindProjectHours[intCounter].LastName;
                    strWorkTask        = TheFindProjectHoursDataSet.FindProjectHours[intCounter].WorkTask;
                    datTransactionDate = TheFindProjectHoursDataSet.FindProjectHours[intCounter].TransactionDate;
                    blnItemFound       = false;

                    gdecTotalHours += TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalHours;

                    if (intSecondNumberOfRecords > 0)
                    {
                        for (intSecondCounter = 0; intSecondCounter < intSecondNumberOfRecords; intSecondCounter++)
                        {
                            if (datTransactionDate == TheEmployeeCrewDataSet.employeework[intSecondCounter].TransactionDate)
                            {
                                if (strFirstName == TheEmployeeCrewDataSet.employeework[intSecondCounter].FirstName)
                                {
                                    if (strLastName == TheEmployeeCrewDataSet.employeework[intSecondCounter].LastName)
                                    {
                                        if (strWorkTask == TheEmployeeCrewDataSet.employeework[intSecondCounter].WorkTask)
                                        {
                                            blnItemFound = true;
                                            TheEmployeeCrewDataSet.employeework[intSecondCounter].Hours += TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalHours;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    if (blnItemFound == false)
                    {
                        EmployeeCrewDataSet.employeeworkRow NewEmployeeRow = TheEmployeeCrewDataSet.employeework.NewemployeeworkRow();

                        NewEmployeeRow.AssignedProjectID = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].AssignedProjectID;
                        NewEmployeeRow.Crew            = "";
                        NewEmployeeRow.FirstName       = strFirstName;
                        NewEmployeeRow.FootagePieces   = 0;
                        NewEmployeeRow.Hours           = TheFindProjectHoursDataSet.FindProjectHours[intCounter].TotalHours;
                        NewEmployeeRow.LastName        = strLastName;
                        NewEmployeeRow.ProjectName     = TheFindProjectByAssignedProjectIDDataSet.FindProjectByAssignedProjectID[0].ProjectName;
                        NewEmployeeRow.TransactionDate = datTransactionDate;
                        NewEmployeeRow.WorkTask        = strWorkTask;

                        TheEmployeeCrewDataSet.employeework.Rows.Add(NewEmployeeRow);
                        intSecondNumberOfRecords++;
                    }
                }

                intNumberOfRecords = intSecondNumberOfRecords - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strFirstName       = TheEmployeeCrewDataSet.employeework[intCounter].FirstName;
                    strLastName        = TheEmployeeCrewDataSet.employeework[intCounter].LastName;
                    strWorkTask        = TheEmployeeCrewDataSet.employeework[intCounter].WorkTask;
                    datTransactionDate = TheEmployeeCrewDataSet.employeework[intCounter].TransactionDate;

                    TheFindWorkTaskByWorkTaskDataSet = TheWorkTaskClass.FindWorkTaskByWorkTask(strWorkTask);

                    MainWindow.gintWorkTaskID = TheFindWorkTaskByWorkTaskDataSet.FindWorkTaskByWorkTask[0].WorkTaskID;

                    MainWindow.gintEmployeeID = FindEmployeeID(strFirstName, strLastName);

                    if (MainWindow.gintEmployeeID == -1)
                    {
                        throw new Exception();
                    }

                    TheFindProjectWorkTaskDataSet = TheProjectTaskClass.FindProjectWorkTask(MainWindow.gintProjectID, MainWindow.gintEmployeeID, MainWindow.gintWorkTaskID, datTransactionDate, datTransactionDate);

                    intSecondNumberOfRecords = TheFindProjectWorkTaskDataSet.FindProjectWorkTask.Rows.Count - 1;

                    for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                    {
                        TheEmployeeCrewDataSet.employeework[intCounter].FootagePieces += TheFindProjectWorkTaskDataSet.FindProjectWorkTask[intSecondCounter].FootagePieces;
                    }

                    TheFindEmployeeCrewAssignmentByDateRange = TheEmployeeCrewAssignmentClass.FindEmployeeCrewAssignmentByDateRange(MainWindow.gintEmployeeID, datTransactionDate, datTransactionDate);

                    intSecondNumberOfRecords = TheFindEmployeeCrewAssignmentByDateRange.FindEmployeeCrewAssignmentByDateRange.Rows.Count - 1;

                    for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                    {
                        if (strProjectID == TheFindEmployeeCrewAssignmentByDateRange.FindEmployeeCrewAssignmentByDateRange[intSecondCounter].AssignedProjectID)
                        {
                            TheEmployeeCrewDataSet.employeework[intCounter].Crew = TheFindEmployeeCrewAssignmentByDateRange.FindEmployeeCrewAssignmentByDateRange[intSecondCounter].CrewID;
                        }
                    }
                }


                intNumberOfRecords  = TheEmployeeCrewDataSet.employeework.Rows.Count - 1;
                gintTaskCounter     = 0;
                gintTaskUIpperLimit = 0;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    blnItemFound       = false;
                    strWorkTask        = TheEmployeeCrewDataSet.employeework[intCounter].WorkTask;
                    datTransactionDate = TheEmployeeCrewDataSet.employeework[intCounter].TransactionDate;

                    if (gintTaskCounter > 0)
                    {
                        for (intTaskCounter = 0; intTaskCounter <= gintTaskUIpperLimit; intTaskCounter++)
                        {
                            if (datTransactionDate == TheProjectDailyTaskDataSet.projecttask[intTaskCounter].TransactionDate)
                            {
                                if (strWorkTask == TheProjectDailyTaskDataSet.projecttask[intTaskCounter].WorkTask)
                                {
                                    TheProjectDailyTaskDataSet.projecttask[intTaskCounter].Hours += TheEmployeeCrewDataSet.employeework[intCounter].Hours;
                                    blnItemFound = true;

                                    if (TheProjectDailyTaskDataSet.projecttask[intTaskCounter].Footage == 0)
                                    {
                                        TheProjectDailyTaskDataSet.projecttask[intTaskCounter].Footage = TheEmployeeCrewDataSet.employeework[intCounter].FootagePieces;
                                    }
                                }
                            }
                        }
                    }

                    if (blnItemFound == false)
                    {
                        ProjectDailyTaskDataSet.projecttaskRow NewTaskRow = TheProjectDailyTaskDataSet.projecttask.NewprojecttaskRow();

                        NewTaskRow.Crew            = TheEmployeeCrewDataSet.employeework[intCounter].Crew;
                        NewTaskRow.Footage         = TheEmployeeCrewDataSet.employeework[intCounter].FootagePieces;
                        NewTaskRow.Hours           = TheEmployeeCrewDataSet.employeework[intCounter].Hours;
                        NewTaskRow.TransactionDate = TheEmployeeCrewDataSet.employeework[intCounter].TransactionDate;
                        NewTaskRow.WorkTask        = TheEmployeeCrewDataSet.employeework[intCounter].WorkTask;

                        TheProjectDailyTaskDataSet.projecttask.Rows.Add(NewTaskRow);
                        gintTaskUIpperLimit = gintTaskCounter;
                        gintTaskCounter++;
                    }
                }

                txtTotalHours.Text = Convert.ToString(gdecTotalHours);

                intNumberOfRecords = TheFindProjectTaskHoursByAssignedProjectIDDataSet.FindProjectTaskHoursByAssignedProjectID.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    MainWindow.gintWorkTaskID = TheFindProjectTaskHoursByAssignedProjectIDDataSet.FindProjectTaskHoursByAssignedProjectID[intCounter].TaskID;
                    MainWindow.gintEmployeeID = TheFindProjectTaskHoursByAssignedProjectIDDataSet.FindProjectTaskHoursByAssignedProjectID[intCounter].EmployeeID;

                    TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(MainWindow.gintEmployeeID);

                    TheFindWorkTaskByTaskIDDataSet = TheWorkTaskClass.FindWorkTaskByWorkTaskID(MainWindow.gintWorkTaskID);

                    ProjectEmployeeHoursDataSet.employeesRow NewEmployeeRow = TheProjectEmployeeHoursDataSet.employees.NewemployeesRow();

                    NewEmployeeRow.FirstName       = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName;
                    NewEmployeeRow.LastName        = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].LastName;
                    NewEmployeeRow.TotalHours      = TheFindProjectTaskHoursByAssignedProjectIDDataSet.FindProjectTaskHoursByAssignedProjectID[intCounter].EmployeeTotalHours;
                    NewEmployeeRow.TransactionDate = TheFindProjectTaskHoursByAssignedProjectIDDataSet.FindProjectTaskHoursByAssignedProjectID[intCounter].TransactionDate;
                    NewEmployeeRow.WorkTask        = TheFindWorkTaskByTaskIDDataSet.FindWorkTaskByWorkTaskID[0].WorkTask;

                    TheProjectEmployeeHoursDataSet.employees.Rows.Add(NewEmployeeRow);
                }

                dgrResults.ItemsSource   = TheProjectDailyTaskDataSet.projecttask;
                dgrEmployees.ItemsSource = TheProjectEmployeeHoursDataSet.employees;
                bool blnFatalError = TheEmployeeDateEntryClass.InsertIntoEmployeeDateEntry(MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "Blue Jay ERP // Find Project Employee Hours // Generate Report Menu Item ");
            }
            catch (Exception Ex)
            {
                PleaseWait.Close();

                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Find Project Employee Hours // Generate Report Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }