Ejemplo n.º 1
0
        public FindVehicleInspectionProblemByProblemIDDataSet FindVehicleInspectionProblemByProblemID(int intProblemID)
        {
            try
            {
                aFindVehicleInspectionProblemByProblemIDDataSet      = new FindVehicleInspectionProblemByProblemIDDataSet();
                aFindVehicleInspectionProblemByProblemIDTableAdapter = new FindVehicleInspectionProblemByProblemIDDataSetTableAdapters.FindVehicleInspectionProblemByProblemIDTableAdapter();
                aFindVehicleInspectionProblemByProblemIDTableAdapter.Fill(aFindVehicleInspectionProblemByProblemIDDataSet.FindVehicleInspectionProblemByProblemID, intProblemID);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Inspections Class // Find Vehicle Inspection Problem By Problem ID " + Ex.Message);
            }

            return(aFindVehicleInspectionProblemByProblemIDDataSet);
        }
        /* private void HideTextBoxes()
         * {
         *   txtInspectionNotes.Visibility = Visibility.Hidden;
         *   txtVehicleProblem.Visibility = Visibility.Hidden;
         * } */

        private void dgrWorkOrders_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int          intSelectedIndex;
            DataGrid     OpenOrderGrid;
            DataGridRow  OpenOrderRow;
            DataGridCell ProblemID;
            string       strProblemID;
            int          intRecordsReturned;

            try
            {
                intSelectedIndex = dgrWorkOrders.SelectedIndex;
                //HideTextBoxes();

                if (intSelectedIndex > -1)
                {
                    SetReadOnlyControls(true);
                    OpenOrderGrid = dgrWorkOrders;
                    OpenOrderRow  = (DataGridRow)OpenOrderGrid.ItemContainerGenerator.ContainerFromIndex(OpenOrderGrid.SelectedIndex);
                    ProblemID     = (DataGridCell)OpenOrderGrid.Columns[0].GetCellContent(OpenOrderRow).Parent;
                    strProblemID  = ((TextBlock)ProblemID.Content).Text;

                    gintProblemID = Convert.ToInt32(strProblemID);

                    if (intSelectedIndex > 0)
                    {
                        TheFindVehicleMainProblemByProblemIDDataSet = TheVehicleProblemClass.FindVehicleMainProblemByProblemID(gintProblemID);

                        MainWindow.gstrVehicleProblem = TheFindVehicleMainProblemByProblemIDDataSet.FindVehicleMainProblemByProblemID[0].Problem;

                        txtInspectionNotes.Text = MainWindow.gstrVehicleProblem;

                        txtInspectionNotes.IsReadOnly = true;
                    }

                    if (gintProblemID == -1)
                    {
                        cboSelectEmployee.IsEnabled   = true;
                        cboSelectManager.IsEnabled    = true;
                        txtFleetNotes.Text            = "";
                        txtManagerNotes.Text          = "";
                        txtInspectionNotes.Text       = "";
                        txtInspectionNotes.IsReadOnly = false;
                        gblnNewWorkOrder           = true;
                        txtFleetNotes.IsReadOnly   = false;
                        txtManagerNotes.IsReadOnly = false;
                    }
                    else if (gintProblemID > -1)
                    {
                        gblnNewWorkOrder = false;

                        TheFindVehicleInspectionProblemByProblemIDDataSet = TheInspectionClass.FindVehicleInspectionProblemByProblemID(gintProblemID);

                        intRecordsReturned = TheFindVehicleInspectionProblemByProblemIDDataSet.FindVehicleInspectionProblemByProblemID.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            gintManagerID        = TheFindVehicleInspectionProblemByProblemIDDataSet.FindVehicleInspectionProblemByProblemID[0].ManagerID;
                            gintFleetEmployeeID  = TheFindVehicleInspectionProblemByProblemIDDataSet.FindVehicleInspectionProblemByProblemID[0].FleetEmployeeID;
                            txtFleetNotes.Text   = TheFindVehicleInspectionProblemByProblemIDDataSet.FindVehicleInspectionProblemByProblemID[0].FleetEmployeeNotes;
                            txtManagerNotes.Text = TheFindVehicleInspectionProblemByProblemIDDataSet.FindVehicleInspectionProblemByProblemID[0].ManagerNotes;

                            LoadComboBoxBoxes(gintManagerID, gintFleetEmployeeID);

                            //txtInspectionNotes.IsReadOnly = true;
                            //txtManagerNotes.IsReadOnly = true;
                            //txtFleetNotes.IsReadOnly = true;
                            //cboSelectEmployee.IsEnabled = false;
                            //cboSelectManager.IsEnabled = false;
                        }
                    }


                    txtInspectionNotes.Visibility = Visibility.Visible;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Vehicle Inspection Problem // Open Problems Grid " + Ex.Message);

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