Exemple #1
0
        private void mitSave_Click(object sender, RoutedEventArgs e)
        {
            //this will set the controls
            //setting local variables
            string strAssignedProjectID;
            string strProjectName;
            bool   blnFatalError   = false;
            string strErrorMessage = "";
            int    intProjectID;

            try
            {
                strAssignedProjectID = txtAssignedProjectID.Text;
                strProjectName       = txtProjectName.Text;
                if (strAssignedProjectID == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "Assigned Project Not Entered\n";
                }
                if (strProjectName == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "Project Name Not Entered\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                intProjectID = Convert.ToInt32(txtProjectID.Text);

                blnFatalError = TheProjectClass.UpdateProjectProject(intProjectID, strAssignedProjectID, strProjectName);

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

                if (blnFatalError == false)
                {
                    txtAssignedProjectID.Text = "";
                    txtEnterProject.Text      = "";
                    txtProjectID.Text         = "";
                    txtProjectName.Text       = "";
                    txtTransactionDate.Text   = "";
                    TheMessagesClass.InformationMessage("The Project Has Been Updated");
                    mitSave.IsEnabled = false;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Project // Save Menu Item " + Ex.Message);

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

            try
            {
                expProcess.IsExpanded = false;

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

                    intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

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

                strCurrentProjectNotes = txtPRojectNotes.Text;

                blnFatalError = TheProjectMatrixClass.UpdateProjectMatrixAssignedProjectID(intTransactionID, strAssignedProjectID);

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

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

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

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

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

                blnFatalError = TheProductionProjectClass.UpdateProductionProjectStatus(gintTransactionID, gintStatusID);

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

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

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

                TheFindProductionProjectByProjectIDDataSet = TheProductionProjectClass.FindProductionProjectByProjectID(gintProjectID);

                intRecordsReturned = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID.Rows.Count;

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

                intTransactionID = TheFindProductionProjectByProjectIDDataSet.FindProductionProjectByProjectID[0].TransactionID;

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

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

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

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

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

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

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

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