private void btnSynchZIpCodeTotals_Click(object sender, RoutedEventArgs e) { Mouse.OverrideCursor = Cursors.Wait; ZipGeoCodeService.UpdateStatsForDealer(_selectedDealer.ID); LoadDealer(); Mouse.OverrideCursor = Cursors.Arrow; }
private void btnSelectAllInRadius_Click(object sender, RoutedEventArgs e) { Mouse.OverrideCursor = Cursors.Wait; try { _dealerZipCodes = ZipGeoCodeService.GetInsideRadius(_selectedDealer); SaveDealer(); LoadDealer(); BindTreeToZipCodes(null); ShowZipCodeCenters((bool)chkShowZipCenters.IsChecked); AddCircleZone((double)_selectedDealer.MaxDistance, new PointLatLng() { Lat = (double)_selectedDealer.Latitude, Lng = (double)_selectedDealer.Longitude }); MessageBox.Show("Dealer Updated!"); } catch (Exception ex) { MessageBox.Show("Error:" + ex.ToString()); } Mouse.OverrideCursor = Cursors.Arrow; }
private void btnDeleteOutsideRadius_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("This will save any changes for this dealer into the database first. Continue", "Save Changes?", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { SaveDealer(); LoadDealer(); _dealerZipCodes = ZipGeoCodeService.GetForDealerInsideRadius(_selectedDealer); SelectZipCodes(); ShowZipCodeCenters((bool)chkShowZipCenters.IsChecked); AddCircleZone((double)_selectedDealer.MaxDistance, new PointLatLng() { Lat = (double)_selectedDealer.Latitude, Lng = (double)_selectedDealer.Longitude }); } }
private void bwAsyncZip_DoWork(object sender, DoWorkEventArgs e) { // The Sender is the BackgroundWorker object we need it to // report progress and check for cancellation. BackgroundWorker _asyncZipStatusWorker = sender as BackgroundWorker; int i = 0; string _status; Thread.Sleep(100); List <State> _states = StateService.GetActive(); foreach (State _state in _states) { i++; // Periodically report progress to the main thread so that it can // update the UI. _status = "Updating Statistics for State: " + _state.StateCode + "..."; _asyncZipStatusWorker.ReportProgress(Convert.ToInt32(i * (100.0 / _states.Count)), _status); ZipGeoCodeService.UpdateStatsForState(_state); // Periodically check if a Cancellation request is pending. If the user // clicks cancel the line _asyncWorker.CancelAsync(); if (_asyncZipStatusWorker.CancellationPending) { // Pause for bit to demonstrate that there is time between // "Cancelling..." and "Canceled". // Thread.Sleep(1200); // Set the e.Cancel flag so that the WorkerCompleted event // knows that the process was canceled. e.Cancel = true; return; } } _asyncZipStatusWorker.ReportProgress(100); }
private void btnUpdateCaseAvailCount_Click(object sender, RoutedEventArgs e) { if (trvZipCodes.SelectedItems != null && trvZipCodes.SelectedItems.Count > 0) { RadTreeViewItem item = trvZipCodes.SelectedItems[0] as RadTreeViewItem; if (((string)item.Tag) == "State") { ZipGeoCodeService.UpdateStatsForState(((string)item.Header).Substring(0, 2)); GridSelectedZipCodes.ItemsSource = ZipGeoCodeService.GetForState(((string)item.Header).Substring(0, 2), (float)_selectedDealer.Latitude, (float)_selectedDealer.Longitude, (float)_selectedDealer.MaxDistance); GridSelectedZipCodes.Rebind(); SelectZipCodes(); } else { ZipGeoCodeService.UpdateStatsForZipPart(((string)item.Header).Substring(0, 3)); GridSelectedZipCodes.ItemsSource = ZipGeoCodeService.GetForZipPart((string)item.Header, (float)_selectedDealer.Latitude, (float)_selectedDealer.Longitude, (float)_selectedDealer.MaxDistance); SelectZipCodes(); } } }
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); } } }
private void trvZipCodes_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Get a reference to the treeview Telerik.Windows.Controls.RadTreeView treeView = sender as Telerik.Windows.Controls.RadTreeView; // Get the currently selected items ObservableCollection <Object> selectedItems = treeView.SelectedItems; if (treeView.SelectedItems != null && treeView.SelectedItems.Count > 0) { RadTreeViewItem item = selectedItems[0] as RadTreeViewItem; if (((string)item.Tag) == "State") { GridSelectedZipCodes.ItemsSource = ZipGeoCodeService.GetForState(((string)item.Header).Substring(0, 2), (float)_selectedDealer.Latitude, (float)_selectedDealer.Longitude, (float)_selectedDealer.MaxDistance); SelectZipCodes(); } else { GridSelectedZipCodes.ItemsSource = ZipGeoCodeService.GetForZipPart((string)item.Header, (float)_selectedDealer.Latitude, (float)_selectedDealer.Longitude, (float)_selectedDealer.MaxDistance); SelectZipCodes(); } } }