Beispiel #1
0
        private void expVoidItems_Expanded(object sender, RoutedEventArgs e)
        {
            int  intCounter;
            int  intNumberOfRecords;
            int  intAssignedTransactionID;
            int  intTaskTransactionID;
            bool blnFatalError;

            try
            {
                expVoidItems.IsExpanded = false;
                intNumberOfRecords      = TheProjectsForVoidingDataSet.projectsforvoiding.Rows.Count;

                if (intNumberOfRecords > 0)
                {
                    for (intCounter = 0; intCounter < intNumberOfRecords; intCounter++)
                    {
                        intAssignedTransactionID = TheProjectsForVoidingDataSet.projectsforvoiding[intCounter].AssignmentTransactionID;
                        intTaskTransactionID     = TheProjectsForVoidingDataSet.projectsforvoiding[intCounter].TaskTransactionID;

                        blnFatalError = TheEmployeeProjectAssignmentClass.UpdateEmployeeLaborHours(intAssignedTransactionID, 0);

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

                        if (intTaskTransactionID > -1)
                        {
                            blnFatalError = TheProjectTaskClass.UpdateProjectTaskFootage(intTaskTransactionID, 0);

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

                TheMessagesClass.InformationMessage("The Transactions Have Been Voided");

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Void Production Sheets // Void Items Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void mitSave_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            int     intFootage         = 0;
            decimal decHours           = 0;
            bool    blnFatalError      = false;
            bool    blnThereIsAProblem = false;
            string  strErrorMessage    = "";
            string  strValueForValidation;
            string  strEmployeeFullName;
            string  strFullName;
            string  strHours;
            string  strHeader;
            string  strMessage;

            try
            {
                strFullName  = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].FirstName + " ";
                strFullName += MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].LastName;

                strEmployeeFullName  = txtFirstName.Text + " ";
                strEmployeeFullName += txtLastName.Text;

                strValueForValidation = txtHours.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDoubleData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Hours is not Numeric\n";
                }
                else
                {
                    decHours = Convert.ToDecimal(strValueForValidation);
                }
                strValueForValidation = txtFootage.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyIntegerData(strValueForValidation);
                if (blnFatalError == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Footage/Pieces is not an Integer\n";
                }
                else
                {
                    intFootage = Convert.ToInt32(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                strHours = txtHours.Text;

                blnFatalError = TheEmployeeProjectAssignmentClass.UpdateEmployeeLaborHours(MainWindow.gintTransactionID, decHours);

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

                blnFatalError = TheProjectTaskClass.UpdateProjectTaskFootage(gintWorkTaskTransactionID, intFootage);

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

                strHeader = "There Has Been An Edit To Hours";

                strMessage  = "<h1>" + strHeader + "</h1>";
                strMessage += "<h3>" + strFullName + " Has Changed " + strEmployeeFullName + " To " + strHours + "</h3>";

                TheSendEmailClass.SendEmail("*****@*****.**", strHeader, strMessage);

                TheSendEmailClass.SendEmail("*****@*****.**", strHeader, strMessage);

                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Selected Labor Transactions " + strMessage);

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

                Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Selected Labor Transactions // Save Menu Item " + Ex.Message);

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