public FindRentalTrackingTransactionByRequestingDateMatchDataSet FindRentalTrackingTransactionByRequestingDateMatch(DateTime datRequestingDate)
        {
            try
            {
                aFindRentalTrackingTransactionByRequestingDateMatchDataSet      = new FindRentalTrackingTransactionByRequestingDateMatchDataSet();
                aFindRentalTrackingTransactionByRequestingDateMatchTableAdapter = new FindRentalTrackingTransactionByRequestingDateMatchDataSetTableAdapters.FindRentalTrackingTransactionByRequestingDateMatchTableAdapter();
                aFindRentalTrackingTransactionByRequestingDateMatchTableAdapter.Fill(aFindRentalTrackingTransactionByRequestingDateMatchDataSet.FindRentalTrackingTransactionByRequestingDateMatch, datRequestingDate);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Rental Tracking Class // Find Rental Tracking Transaction By Requesting Date " + Ex.Message);
            }

            return(aFindRentalTrackingTransactionByRequestingDateMatchDataSet);
        }
Пример #2
0
        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());
            }
        }