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);
            }
        }
Esempio n. 2
0
        private void CheckProject()
        {
            //setting local variables
            string   strProjectID;
            int      intRecordsReturned;
            DateTime datTransactionDate = DateTime.Now;
            DateTime datTodaysDate      = DateTime.Now;
            bool     blnFatalError      = false;
            int      intEmployeeID;
            decimal  decHours;
            DateTime datEndDate;
            int      intHours;
            int      intRemainder;

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

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

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

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

                    TheFindProjectMatrixByCustomerProjectIDDataSet = TheProjectMatrixClass.FindProjectMatrixByCustomerProjectID(strProjectID);

                    intRecordsReturned = TheFindProjectMatrixByCustomerProjectIDDataSet.FindProjectMatrixByCustomerProjectID.Rows.Count;

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

                        intRecordsReturned = TheFindProjectMatrixByAssignedProjectIDDataSet.FindProjectMatrixByAssignedProjectID.Rows.Count;

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

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

                    TheFindProjectByProjectIDDataSet = TheProjectClass.FindProjectByProjectID(MainWindow.gintProjectID);

                    MainWindow.gstrAssignedProjectID = strProjectID;

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

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

                    intHours = Convert.ToInt32(decHours * 100);

                    intRemainder = intHours % 25;

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

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

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

                    TheFindProductivityDataEntryByDateDataSet = TheProductivityDataEntryClass.FindProductivityDataEntryByDate(datTodaysDate);

                    gintDataEntryTransactionID = TheFindProductivityDataEntryByDateDataSet.FindProductivtyDataEntryByDate[0].TransactionID;

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

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

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