public PCSInspectionView(string InspID)
        {
            if ("" == InspID)
            {
                pcsInspection = new PCSInspection();
            }
            else
            {
                pcsInspection = new PCSInspection(InspID);
            }

            pcsAction.PCSTree.ItemsSource = this.pcsInspection.PCSDetails;
            pcsAction.ActionSelected += ActionSelected;
            pcsAction.PCSDetailChange += DetailChanged;

            this.DataContext = pcsInspection;

            InitializeComponent();
            grdDetail.DataContext = this.ActiveDetail;
            this.InspHeader.CreateNewTab += TabRequested;
        }
        private ObservableCollection<InspectionBase> GetAllInspectionHeaders()
        {
            var inspList = new ObservableCollection<InspectionBase>();
            InspectionBase inspectionBase;

            DbDataReader dr = WWD.GetReader("select insp_id, insptype from insph order by insp_date");

            while (dr.Read())
            {
                switch (dr[1].ToString())
                {
                    case "P":
                        inspectionBase = new PCSInspection();
                        inspectionBase.Load(dr[0].ToString());
                        break;

                    case "D":
                        inspectionBase = new DEVInspection();
                        inspectionBase.Load(dr[0].ToString());
                        break;

                    case "U":
                        inspectionBase = new UPCInspection();
                        inspectionBase.Load(dr[0].ToString());
                        break;

                    case "Q":
                        inspectionBase = new QSTInspection();
                        inspectionBase.Load(dr[0].ToString());
                        break;

                    case "R":
                        inspectionBase = new QSTDInspection();
                        inspectionBase.Load(dr[0].ToString());
                        break;

                    default:
                        inspectionBase = new PCSInspection();
                        inspectionBase.Load(dr[0].ToString());
                        break;
                }

                inspList.Add(inspectionBase);

            }
            dr.Dispose();

            return inspList;
        }