public PacerDataMgmt()
        {
            InitializeComponent();
            _courts = CourtService.GetAll();
            cboCourt.ItemsSource  = _courts;
            grdCourts.ItemsSource = _courts;
            List <PacerFileFormat> _formats = PacerFileFormatService.GetAll();

            cboECFVersion.ItemsSource = _formats;

            rdpEndDate.SelectedDate   = DateTime.Now.AddDays(-1);
            rdpStartDate.SelectedDate = DateTime.Now.AddMonths(-1);

            _asyncWorker = new BackgroundWorker();
            _asyncWorker.WorkerReportsProgress      = true;
            _asyncWorker.WorkerSupportsCancellation = true;
            _asyncWorker.ProgressChanged           += new ProgressChangedEventHandler(bwAsync_ProgressChanged);
            _asyncWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(bwAsync_RunWorkerCompleted);
            _asyncWorker.DoWork += new DoWorkEventHandler(bwAsync_DoWork);

            _asyncZipStatusWorker = new BackgroundWorker();
            _asyncZipStatusWorker.WorkerReportsProgress      = true;
            _asyncZipStatusWorker.WorkerSupportsCancellation = true;
            _asyncZipStatusWorker.ProgressChanged           += new ProgressChangedEventHandler(bwAsyncZip_ProgressChanged);
            _asyncZipStatusWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(bwAsyncZip_RunWorkerCompleted);
            _asyncZipStatusWorker.DoWork += new DoWorkEventHandler(bwAsyncZip_DoWork);
        }
        private void btnCheckCourtVersion_Click(object sender, RoutedEventArgs e)
        {
            //ECFVersionByCourt _ecf = new ECFVersionByCourt();
            //List<ECFVersion> _versions = _ecf.GetBankruptcyCourtVersions();

            if (cboCourt.SelectedIndex == -1)
            {
                MessageBox.Show("Please Select a Court!");
                return;
            }
            else
            {
                try
                {
                    Mouse.OverrideCursor = Cursors.Wait;
                    Court             _court      = (Court)cboCourt.SelectedValue;
                    ECFVersionByCourt _version    = new ECFVersionByCourt();
                    ECFVersion        _ecfVersion = _version.GetBankruptcyCourtVersion(_court.CourtName);

                    if (_court.PacerFileVersion == _ecfVersion.versionString)
                    {
                        MessageBox.Show("Versions match!: " + _ecfVersion.versionString);
                    }
                    else
                    {
                        //get the corresponding ID;
                        PacerFileFormat _format = PacerFileFormatService.GetByVersionString(_ecfVersion.versionString);
                        if (_format == null)
                        {
                            MessageBox.Show("Unknown Version: " + _ecfVersion.versionString);
                        }
                        else
                        {
                            _court.PacerFileFormatID = _format.ID;
                            _court.PacerFileVersion  = _format.PacerFileVersion;
                            CourtService.Save(_court);
                            cboECFVersion.SelectedIndex = 0;
                            MessageBox.Show("Court Version updated to: " + _ecfVersion.versionString);


                            //LoadCourts();
                        }
                    }
                    Mouse.OverrideCursor = Cursors.Arrow;

                    //MessageBox.Show(_ecfVersion.versionString);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: " + ex.ToString());
                    Mouse.OverrideCursor = Cursors.Arrow;
                }
            }
        }
        public void LoadDealer()
        {
            GridMain.DataContext = _selectedDealer;

            txtMaxDistance2.Text = _selectedDealer.MaxDistance.ToString();

            List <PacerFileFormat> _formats = PacerFileFormatService.GetAll();

            if (_selectedDealer.ID > 0)
            {
                _dealerZipCodes = ZipGeoCodeService.GetForDealer(_selectedDealer.ID);

                BindTreeToZipCodes(null);

                try
                {
                    trvZipCodes.BringPathIntoView(_selectedPath);
                }
                catch
                {
                }

                LoadTotals();
            }

            // config map
            if (_selectedDealer.Latitude != null && _selectedDealer.Latitude > 0)
            {
                MainMap.Position = new PointLatLng((double)_selectedDealer.Latitude, (double)_selectedDealer.Longitude);
                //set current marker
                currentMarker = new GMapMarker(MainMap.Position);
                {
                    currentMarker.Shape  = new CustomMarkerRed(currentMarker, _selectedDealer);
                    currentMarker.Offset = new System.Windows.Point(-5, -5);
                    currentMarker.ZIndex = int.MaxValue;
                    MainMap.Markers.Add(currentMarker);
                }
            }
        }