Пример #1
0
        private void txtCustomerProjectID_TextChanged(object sender, TextChangedEventArgs e)
        {
            string strCustomerProjectID;
            int    intLength;
            int    intRecordsReturned;
            int    intBusinessLineID;

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

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

                    intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

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

                        TheFindProductionProjectInfoDataSet = TheProductionProjectClass.FindProductionProjectInfo(gintProjectID);

                        intRecordsReturned = TheFindProductionProjectInfoDataSet.FindProductionProjectInfo.Rows.Count;

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

                            MainWindow.gintProjectID = gintProjectID;

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

                        gblnProjectExists = true;

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

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

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Пример #2
0
        private void expAddEditProjectInfo_Expanded(object sender, RoutedEventArgs e)
        {
            int intRecordsReturned;

            expAddEditProjectInfo.IsExpanded = false;
            MainWindow.gintProjectID         = gintProjectID;

            TheFindProductionProjectInfoDataSet = TheProductionProjectClass.FindProductionProjectInfo(MainWindow.gintProjectID);

            intRecordsReturned = TheFindProductionProjectInfoDataSet.FindProductionProjectInfo.Rows.Count;

            if (intRecordsReturned < 1)
            {
                AddProductionProjectInfo AddProductionProjectInfo = new AddProductionProjectInfo();
                AddProductionProjectInfo.ShowDialog();
            }
            else if (intRecordsReturned > 0)
            {
                EditProductionProjectInfo EditProductionProjectInfo = new EditProductionProjectInfo();
                EditProductionProjectInfo.ShowDialog();
            }
        }
Пример #3
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());
            }
        }