private void btnFind_Click(object sender, RoutedEventArgs e)
        {
            //setting up the variables
            string strVehicleNumber;
            int    intRecordsReturned;

            try
            {
                strVehicleNumber = txtEnterVehicleNumber.Text;

                TheFindActiveVehicleMainByVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainByVehicleNumber(strVehicleNumber);

                intRecordsReturned = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber.Rows.Count;

                if (intRecordsReturned < 1)
                {
                    TheMessagesClass.ErrorMessage("The Vehicle Not Found");
                    return;
                }

                MainWindow.gintVehicleID = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VehicleID;

                TheFindAllVehicleMainProblemsByVehicleIDDataSet = TheVehicleProblemClass.FindAllVehicleMainProblemsByVehicleID(MainWindow.gintVehicleID);

                dgrVehicleProblems.ItemsSource = TheFindAllVehicleMainProblemsByVehicleIDDataSet.FindAllVehicleMainProblemsByVehicleID;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Edit Vehicle Problems // Find Button " + Ex.Message);
            }
        }
        private void ResetControls()
        {
            txtEnterVehicleNumber.Text = "";

            TheFindAllVehicleMainProblemsByVehicleIDDataSet = TheVehicleProblemClass.FindAllVehicleMainProblemsByVehicleID(-200);

            dgrVehicleProblems.ItemsSource = TheFindAllVehicleMainProblemsByVehicleIDDataSet.FindAllVehicleMainProblemsByVehicleID;
        }
        public FindAllVehicleMainProblemsByVehicleIDDataSet FindAllVehicleMainProblemsByVehicleID(int intVehicleID)
        {
            try
            {
                aFindAllVehicleMainProblemsByVehicleIDDataSet      = new FindAllVehicleMainProblemsByVehicleIDDataSet();
                aFindAllVehicleMainProblemsByVehicleIDTableAdapter = new FindAllVehicleMainProblemsByVehicleIDDataSetTableAdapters.FindAllVehicleMainProblemsByVehicleIDTableAdapter();
                aFindAllVehicleMainProblemsByVehicleIDTableAdapter.Fill(aFindAllVehicleMainProblemsByVehicleIDDataSet.FindAllVehicleMainProblemsByVehicleID, intVehicleID);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Vehicle Problems Class // Find All Vehicle Main Problems By Vehicle ID " + Ex.Message);
            }

            return(aFindAllVehicleMainProblemsByVehicleIDDataSet);
        }
Example #4
0
        private void txtVehicleNumber_TextChanged(object sender, TextChangedEventArgs e)
        {
            //setting up the variables
            int  intLenght;
            int  intRecordsReturned;
            bool blnItemFound = false;
            int  intCounter;
            int  intNumberOfRecords;

            try
            {
                MainWindow.gstrVehicleNumber = txtVehicleNumber.Text;
                intLenght = MainWindow.gstrVehicleNumber.Length;

                TheVehicleProblemDataSet.vehicleproblems.Rows.Clear();
                TheProblemNotesDataSet.problemnotes.Rows.Clear();

                if (intLenght == 4)
                {
                    TheFindActiveVehicleMainByVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainByVehicleNumber(MainWindow.gstrVehicleNumber);

                    intRecordsReturned = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnItemFound             = true;
                        MainWindow.gintVehicleID = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VehicleID;
                    }
                }
                else if (intLenght == 6)
                {
                    TheFindActiveVehicleMainByVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainByVehicleNumber(MainWindow.gstrVehicleNumber);

                    intRecordsReturned = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnItemFound             = true;
                        MainWindow.gintVehicleID = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VehicleID;
                    }
                    else
                    {
                        TheMessagesClass.ErrorMessage("Vehicle Not Found");
                        return;
                    }
                }
                else if (intLenght > 6)
                {
                    TheMessagesClass.ErrorMessage("Too Many Characters for a Vehicle Number");
                    return;
                }

                if (blnItemFound == true)
                {
                    TheFindAllVehicleMainProblemsByVehicleIDDataSet = TheVehicleProblemClass.FindAllVehicleMainProblemsByVehicleID(MainWindow.gintVehicleID);

                    intNumberOfRecords = TheFindAllVehicleMainProblemsByVehicleIDDataSet.FindAllVehicleMainProblemsByVehicleID.Rows.Count - 1;

                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        VehicleProblemDataSet.vehicleproblemsRow NewProblemRow = TheVehicleProblemDataSet.vehicleproblems.NewvehicleproblemsRow();

                        NewProblemRow.Problem         = TheFindAllVehicleMainProblemsByVehicleIDDataSet.FindAllVehicleMainProblemsByVehicleID[intCounter].Problem;
                        NewProblemRow.ProblemID       = TheFindAllVehicleMainProblemsByVehicleIDDataSet.FindAllVehicleMainProblemsByVehicleID[intCounter].ProblemID;
                        NewProblemRow.Solved          = TheFindAllVehicleMainProblemsByVehicleIDDataSet.FindAllVehicleMainProblemsByVehicleID[intCounter].ProblemSolved;
                        NewProblemRow.TransactionDate = TheFindAllVehicleMainProblemsByVehicleIDDataSet.FindAllVehicleMainProblemsByVehicleID[intCounter].TransactionDate;

                        if (TheFindAllVehicleMainProblemsByVehicleIDDataSet.FindAllVehicleMainProblemsByVehicleID[intCounter].IsProblemResolutionNull() == true)
                        {
                            NewProblemRow.ProblemResolution = "";
                        }
                        else
                        {
                            NewProblemRow.ProblemResolution = TheFindAllVehicleMainProblemsByVehicleIDDataSet.FindAllVehicleMainProblemsByVehicleID[intCounter].ProblemResolution;
                        }

                        TheVehicleProblemDataSet.vehicleproblems.Rows.Add(NewProblemRow);
                    }

                    dgrProblems.ItemsSource = TheVehicleProblemDataSet.vehicleproblems;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Vehicle Problem History // Text Box Event " + Ex.Message);

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