//private void btnGeocode_Click(object sender, RoutedEventArgs e) //{ // SaveScreenToDealer(); // YahooGeoCoder.GeocodeDealer(_selectedDealer); // txtLatitude.Text = _selectedDealer.Latitude.ToString(); // txtLongitude.Text = _selectedDealer.Longitude.ToString(); //} // center markers on load //void MainMap_MouseEnter(object sender, MouseEventArgs e) //{ // MainMap.Focus(); //} //void MainMap_Loaded(object sender, RoutedEventArgs e) //{ // MainMap.ZoomAndCenterMarkers(null); //} //void MainMap_OnMapTypeChanged(MapType type) //{ // sliderZoom.Minimum = MainMap.MinZoom; // sliderZoom.Maximum = MainMap.MaxZoom; //} //void MainMap_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) //{ // System.Windows.Point p = e.GetPosition(MainMap); // currentMarker.Position = MainMap.FromLocalToLatLng((int)p.X, (int)p.Y); //} //// move current marker with left holding //void MainMap_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) //{ // if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed) // { // System.Windows.Point p = e.GetPosition(MainMap); // currentMarker.Position = MainMap.FromLocalToLatLng((int)p.X, (int)p.Y); // } //} //// zoo max & center markers //private void button13_Click(object sender, RoutedEventArgs e) //{ // MainMap.ZoomAndCenterMarkers(null); //} //// tile louading starts //void MainMap_OnTileLoadStart() //{ // System.Windows.Forms.MethodInvoker m = delegate() // { // //progressBar1.Visibility = Visibility.Visible; // }; // try // { // this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, m); // } // catch // { // } //} //// tile loading stops //void MainMap_OnTileLoadComplete(long ElapsedMilliseconds) //{ // MainMap.ElapsedMilliseconds = ElapsedMilliseconds; // System.Windows.Forms.MethodInvoker m = delegate() // { // //progressBar1.Visibility = Visibility.Hidden; // //groupBox3.Header = "loading, last in " + MainMap.ElapsedMilliseconds + "ms"; // }; // try // { // this.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, m); // } // catch // { // } //} //// current location changed //void MainMap_OnCurrentPositionChanged(PointLatLng point) //{ // //mapgroup.Header = "gmap: " + point; //} private void SaveDealer() { if (txtLatitude.Text.Length == 0 || txtLatitude.Text == "0") { //MapQuestGeoCoder.GeocodeDealer(_selectedDealer); GoogleGeocoder.GeocodeDealer(_selectedDealer); } //TODO put in transation DealerService.Save(_selectedDealer); //delete all DealerService.DeleteDealerZipCodes(_selectedDealer.ID); //then add back if (_dealerZipCodes != null) { foreach (ZipGeoCode _zipGeoCode in _dealerZipCodes) { DealerService.AddDealerZipCode(new DealerZipCode() { DealerID = _selectedDealer.ID, ZipGeoCodeID = _zipGeoCode.ID }); } } }
public CompaniesController(TechnicalAdvisorContext context, DealerService dealerService, CompanyService companyService, ProductService productService) { _context = context; _dealerService = dealerService; _companyService = companyService; _productService = productService; }
public bool UpdateDues(DealerProductDetailUpdateModel model) { using (var scope = new TransactionScope()) { var db = Repository.Db as BusinessDbContext; AccountHead head = db.AccountHeads.First(x => x.ShopId == model.ShopId && x.Name == "Sale"); model.Transaction.AccountHeadId = head.Id; model.Transaction.AccountHeadName = head.Name; model.Transaction.TransactionFlowType = TransactionFlowType.Income; model.Transaction.ParentId = model.DealerId; model.Transaction.TransactionFor = TransactionFor.Sale; model.Transaction.TransactionWith = TransactionWith.Dealer; db.DealerProductTransactions.AddRange(model.DealerProductTransactions); db.Transactions.Add(model.Transaction); int changes = db.SaveChanges(); foreach (var transaction in model.DealerProductTransactions) { var dealerProduct = db.DealerProducts.First(x => x.Id == transaction.DealerProductId); dealerProduct.Paid = db.DealerProductTransactions.Where(x => x.DealerProductId == dealerProduct.Id) .Sum(x => x.Amount); dealerProduct.Due = dealerProduct.TotalPrice - dealerProduct.Paid; db.SaveChanges(); } DealerService dealerService = new DealerService(new BaseRepository <Dealer>(Repository.Db)); bool updatePoint = dealerService.UpdateAmount(model.DealerId); scope.Complete(); return(changes > 0); } }
private void CpwContext_OnTradeExecuted(CoverPositionWindowViewModel context) { context.View.Close(); if (context.IsCancel) { return; } var position = context.CoverPosition; if (null == position) { position = new CoverPosition(); } position.Amount = context.LotSize; position.Coveraccount_id = context.SelectedCoveringAccount; position.OrderType = context.SelectedOrderType; position.OpenPrice = context.OpenPrice; //position.Opentime = DateTime.Now; //do not set position.OpenedBy = username; position.Commodity = context.SelectedCommodity; //position.Internalid = Guid.NewGuid(); //will be regenerated at server end.. position.Remoteid = context.Orderid; DealerService.GetInstance().saveUpdateCloseCoverPosition(position, "createUpdateCoverPosition"); }
public virtual Task <IAppDealer> Create() { var crmService = StartupHelper.CreateCrmService(); IDealerRepository dealerrepository = new DealerRepository(); IDealerService dealerservice = new DealerService(crmService, dealerrepository); IAppDealer app = new AppDealer(dealerservice); return(Task.FromResult(app));; }
private void btnGeoCodeDealers_Click(object sender, RoutedEventArgs e) { List <Dealer> _dealers = DealerService.GetAll(); foreach (Dealer _dealer in _dealers) { BingGeoCoder.GeocodeDealer(_dealer); DealerService.Save(_dealer); } }
// public GameSession(ConsoleStream IOStream, PackType packType, params Player [] player) { consoleStream = IOStream; // init io stream this.dealer = new Dealer(packType); this.players.Add(dealer); this.players.AddRange(player); // add services dealerService = new DealerService(dealer, player); // }
private void ExecuteCloseSelectedCoverPositionCommand() { if (null == OpenCoverTradesCollectionView.CurrentItem) { return; } CoverPosition position = OpenCoverTradesCollectionView.CurrentItem as CoverPosition; position.ClosedBy = username; DealerService.GetInstance().saveUpdateCloseCoverPosition(position, "closeCoverPosition"); }
private void ExecuteRejectSelectedTradeCommand() { lock (lockTrades) { TradePosition position = PendingTradesCollectionView.CurrentItem as TradePosition; if (position == null) { //todo show error return; } DealerService.GetInstance().approveRejectOrder(position.ClientName, position.OrderId, DealerService.COMMAND_VERB_REJECT); } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { RadButton _button = (RadButton)sender; int ID = ((Dealer)_button.DataContext).ID; Dealer _selectedDealer = DealerService.GetByID(ID); if (MessageBox.Show("Delete the dealer: " + _selectedDealer.CompanyName, "Confirm delete dealer", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { DealerService.Delete(_selectedDealer); } LoadDealers(); }
private void ExecuteBulkRejectSelectedTradeCommand() { lock (lockTrades) { foreach (var row in PendingTradesCollectionView) { TradePosition position = row as TradePosition; if (position.IsSelected) { DealerService.GetInstance().approveRejectOrder(position.ClientName, position.OrderId, DealerService.COMMAND_VERB_REJECT); } } } }
private void btnPrint_Click(object sender, RoutedEventArgs e) { RadButton _button = (RadButton)sender; int ID = ((Dealer)_button.DataContext).ID; Dealer _selectedDealer = DealerService.GetByID(ID); //MessageBox.Show("The double-clicked row is " + ((PacerImportTransaction)row.DataContext).ID); DealerMailingWindow _dealerMailingWindow = new DealerMailingWindow(_selectedDealer); _dealerMailingWindow.ShowInTaskbar = false; _dealerMailingWindow.Owner = Window.GetWindow(this); _dealerMailingWindow.ShowDialog(); }
public MainWindow() { List <State> _states; List <Court> _courts; InitializeComponent(); if (ConfigurationManager.AppSettings.Get("Debug") == "true") { MessageBox.Show("I'm here"); } //set the Pacer Management Window rtPacerDataMgmt.Content = new PacerDataMgmt(); _courts = CourtService.GetAll(); cboCourt.ItemsSource = _courts; // export filter criteria //_courts.Insert(0, new Court(){CourtName="[Select...]"}); cboCourtExportCriteria.ItemsSource = _courts; _states = StateService.GetActive(); //_states.Insert(0, new State() { StateCode = "[Select...]" }); cboState.ItemsSource = _states; //LoadAndProcessRemoveEmails(); //if (DateTime.Now > DateTime.Parse("02/01/12")) //{ // MessageBox.Show("Your system has outstanding invoices due. Please contact Metamorpho-Sys for scheduling payment at (503) 901-5395"); // if (DateTime.Now > DateTime.Parse("04/01/12")) // { // MessageBox.Show("Your system has outstanding invoices due. Please contact Metamorpho-Sys for scheduling payment at (503) 901-5395. Applciation will now close"); // this.Close(); // } //} List <Dealer> _dealers = DealerService.GetFiltered(string.Empty, true); GridViewDealers.ItemsSource = _dealers; //_dealers.Insert(0, new Dealer() { CompanyName = "[Select...]" }); cboDealerExportCriteria.ItemsSource = _dealers; }
private void ExecuteRequoteSelectedOrders() { lock (lockTrades) { foreach (var row in PendingTradesCollectionView) { TradePosition position = row as TradePosition; if (position.IsSelected) { DealerService.GetInstance().requoteOrder( position.ClientName, position.OrderId, position.RequotePrice ); } } } }
public async Task CreateAsync_DoctorValidationSucceed_CreatesStreet() { // Arrange var doctor = new DealerUpdateModel(); var expected = new Dealer(); var doctorDAL = new Mock <IDealerDAL>(); doctorDAL.Setup(x => x.InsertAsync(doctor)).ReturnsAsync(expected); var doctorService = new DealerService(doctorDAL.Object); // Act var result = await doctorService.CreateAsync(doctor); // Assert result.Should().Be(expected); }
private async void ExecuteWindowLoaded() { ClientService.GetInstance().OnUpdateReceived += OnUpdateReceived; ClientService.GetInstance().OnCandleStickDataEventHandler += MainWindowViewModel_OnCandleStickDataEventHandler; ClientService.GetInstance().OnConnectionClosedByServerEventHandler += MainWindowViewModel_OnConnectionClosedByServerEventHandler; DealerService.GetInstance().OnOfficePositionsUpdateReceived += OnOfficePositionsUpdateReceived; DealerService.GetInstance().OnConnectionsInformationReceived += MainWindowViewModel_OnConnectionsInformationReceived; DealerService.GetInstance().OnNotificationReceived += MainWindowViewModel_OnNotificationReceived; AuthService.GetInstance().OnGenericResponseReceived += MainWindow_OnGenericResponseReceived; LoginDialogData creds = await _dialogCoord.ShowLoginAsync(this, "Backoffice Login", "Login to continue using your account"); if (creds != null && !string.IsNullOrEmpty(creds.Username) && !string.IsNullOrEmpty(creds.Password)) { progressController = await _dialogCoord.ShowProgressAsync(this, "Please wait...", "Authenticating with server."); progressController.SetIndeterminate(); if (!AuthService.GetInstance().init(creds.Username, creds.Password) || !AuthService.GetInstance().ResolveUserEndpoints() ) { await progressController.CloseAsync(); await _dialogCoord.ShowMessageAsync(this, "Authentication", "Incorrect username/password."); App.Current.Shutdown(); } else { username = creds.Username; password = creds.Password; } } else { await _dialogCoord.ShowMessageAsync(this, "Authentication", "Credentials are needed to continue."); App.Current.Shutdown(); } }
private void btnOpenDealer_Click(object sender, RoutedEventArgs e) { RadButton _button = (RadButton)sender; int ID = ((Dealer)_button.DataContext).ID; Dealer _selectedDealer = DealerService.GetByID(ID); //MessageBox.Show("The double-clicked row is " + ((PacerImportTransaction)row.DataContext).ID); RadTabItem tabToAdd = new RadTabItem(); tabToAdd.Header = "Dealer: " + _selectedDealer.CompanyName; tabToAdd.Margin = new System.Windows.Thickness(0, 0, 5, 0); tabToAdd.Content = new DealerDetailUC(_selectedDealer, tabCtrlMain, tabToAdd); tabToAdd.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch; //should only be one addTabItemMenu(tabToAdd); this.tabCtrlMain.Items.Add(tabToAdd); this.tabCtrlMain.SelectedItem = tabToAdd; }
private void LoadDealers() { Mouse.OverrideCursor = Cursors.Wait; List <Dealer> _dealers = DealerService.GetFiltered(txtDealerName.Text, (bool)rdoActiveOnly.IsChecked); GridViewDealers.ItemsSource = _dealers; foreach (Dealer _dealer in _dealers) { if (_dealer.Latitude == null) { BingGeoCoder.GeocodeDealer(_dealer); DealerService.Save(_dealer); } } Mouse.OverrideCursor = Cursors.Arrow; }
public async Task ValidateAsync_DoctorExists_DoesNothing() { // Arrange var doctorContainer = new Mock <IDealerContainer>(); var doctor = new Dealer(); var doctorDAL = new Mock <IDealerDAL>(); var doctorIdentity = new Mock <IDealerIdentity>(); doctorDAL.Setup(x => x.GetAsync(doctorIdentity.Object)).ReturnsAsync(doctor); var doctorGetService = new DealerService(doctorDAL.Object); // Act var action = new Func <Task>(() => doctorGetService.ValidateAsync(doctorContainer.Object)); // Assert await action.Should().NotThrowAsync <Exception>(); }
public OrderGraphType() { Field(x => x.Id); Field(x => x.DealerId); Field(x => x.Number); Field <DebugType>("debug", resolve: c => new DebugType()); Field <DealerGraphType>("dealer", resolve: context => { //return dealerService.GetDealer(context.Source.DealerId); var loader = new DataLoaderContextAccessor().Context.GetOrAddBatchLoader <string, Dealer>("getDealerByDealerId", dealerIds => { IDictionary <string, Dealer> dictionary = new DealerService() .GetDealers(dealerIds.ToList()) .ToDictionary(dealer => dealer.DealerId); return(Task.FromResult(dictionary)); }); return(loader.LoadAsync(context.Source.DealerId)); }); }
public async Task ValidateAsync_DoctorNotExists_ThrowsError() { // Arrange var fixture = new Fixture(); var id = fixture.Create <int>(); var doctorContainer = new Mock <IDealerContainer>(); doctorContainer.Setup(x => x.DealerId).Returns(id); var doctorIdentity = new Mock <IDealerIdentity>(); var doctor = new Dealer(); var doctorDAL = new Mock <IDealerDAL>(); doctorDAL.Setup(x => x.GetAsync(doctorIdentity.Object)).ReturnsAsync((Dealer)null); var doctorGetService = new DealerService(doctorDAL.Object); // Act var action = new Func <Task>(() => doctorGetService.ValidateAsync(doctorContainer.Object)); // Assert await action.Should().ThrowAsync <InvalidOperationException>($"Dealer not found by id {id}"); }
private void MainWindow_OnGenericResponseReceived(object sender, SharedData.events.GenericResponseEventArgs e) { officeExchangeName = e.GenericResponse["officeExchangeName"]; clientExchangeName = e.GenericResponse["clientExchangeName"]; responseQueueName = e.GenericResponse["responseQueueName"]; officeDealerInQName = e.GenericResponse["officeDealerInQName"]; officeDealerOutQName = e.GenericResponse["officeDealerOutQName"]; ClientService.GetInstance().init(username, password, clientExchangeName, responseQueueName); DealerService.GetInstance().init(username, password, officeExchangeName, officeDealerOutQName, officeDealerInQName); System.Windows.Threading. Dispatcher.CurrentDispatcher.Invoke(async() => { await progressController.CloseAsync(); MetroDialogSettings set = new MetroDialogSettings(); await _dialogCoord.ShowMessageAsync(this, "Authentication", "Login successful."); //we are done here AuthService.Cleanup(); }); }
private void ExecuteDisconnectSelectedUsersCommand() { ActiveConnections session = null; lock (lockActiveSessions) { int selIndex = ConnectionInfoCollectionView.CurrentPosition; if (selIndex >= 0 && selIndex < _connectionInfoCollection.Count) { session = _connectionInfoCollection[selIndex]; } } if (session != null) { DealerService.GetInstance().disconnectAndLockSession( session.Username, session.Connections.Select(x => x.MqName).ToArray() ); } }
private static void Main(string[] args) { var objCar = new CarService(); var lst = objCar.ListarCarrosPorAno(2015); var lstMarca = objCar.ListarCarrosPorMarca("Lamborghini"); Console.WriteLine("------ Listando carro por ano ------"); foreach (var item in lst) { Console.WriteLine($"Id: {item.Id}, Modelo: {item.Model}, Marca: {item.Brand}, Ano: {item.Year} \n"); } Console.WriteLine("------ Listando carro por Marca ------"); foreach (var item in lstMarca) { Console.WriteLine($"Id: {item.Id}, Modelo: {item.Model}, Marca: {item.Brand}, Ano: {item.Year} \n"); } var objOwner = new OwnerService(); var lstOwner = objOwner.ListarPessoasPorNome("Victor"); Console.WriteLine("------ Listando Dono por Nome ------"); foreach (var item in lstOwner) { Console.WriteLine($"Id: {item.Id}, Nome: {item.Name}, Telefone: {item.Phone} \n"); } var objDealer = new DealerService(); var lstDealer = objDealer.ListarConcessionariaPorMontadora("Ferrari"); Console.WriteLine("------ Listando Concessionaria por Montadora ------"); foreach (var item in lstDealer) { Console.WriteLine($"Id: {item.Id}, Nome: {item.Name}, Montadora: {item.Brand} \n"); } Console.ReadLine(); }
private void ShowOtherDealers(bool show) { if (_otherDealerMarkers.Count > 0) { //we already have other dealers shown on the map - remove them first foreach (GMapMarker _marker in _otherDealerMarkers) { MainMap.Markers.Remove(_marker); //RemoveCircleZone(_marker.Position); } _otherDealerMarkers = new List <GMapMarker>(); } if (show == true) { List <Dealer> _dealers = DealerService.GetInRadius((double)_selectedDealer.Latitude, (double)_selectedDealer.Longitude, (double)_selectedDealer.MaxDistance); foreach (Dealer _dealer in _dealers) { if (_dealer.Latitude != null && _dealer.ID != _selectedDealer.ID) { GMapMarker currentMarker = new GMapMarker(new PointLatLng() { Lat = (double)_dealer.Latitude, Lng = (double)_dealer.Longitude }); { currentMarker.Shape = new CustomMarkerOrange(currentMarker, _dealer); currentMarker.Offset = new System.Windows.Point(-2, -2); currentMarker.ZIndex = int.MaxValue; MainMap.Markers.Add(currentMarker); //AddCircleZone((double)_dealer.MaxDistance, new PointLatLng() { Lat = (double)_dealer.Latitude, Lng = (double)_dealer.Longitude }); _otherDealerMarkers.Add(currentMarker); } } } } }
public void SetUp() { _fixture = new Fixture().Customize(new AutoMoqCustomization()); _restfulClientMock = _fixture.Freeze <Mock <IRestfulClient> >(); _underTest = _fixture.Create <DealerService>(); }
public DealersController(TechnicalAdvisorContext context, DealerService dealerService, UserService userService) { _context = context; _dealerService = dealerService; _userService = userService; }
public void Initialise() { _concreteDealerService = new DealerService(); }
public UserService(TechnicalAdvisorContext context, CompanyService companyService, DealerService dealerService) { _context = context; _companyService = companyService; _dealerService = dealerService; }
private void btn2StepProcessCreateCSV_Click(object sender, RoutedEventArgs e) { try { if (txtNumberMailings.Text.Length > 0) { try { _dealer.DefaultNumberMailings = Int32.Parse(txtNumberMailings.Text); } catch { MessageBox.Show("A numeric number or mailings is required!"); return; } } else { return; } //save the dealer... DealerService.Save(_dealer); if (Int32.Parse(txtTotalUnsoldCases.Text) >= Int32.Parse(txtNumberMailings.Text)) { _dealerMailingList = new DealerMailingList() { DealerID = _dealer.ID, FiledCasesOnly = (bool)rdoFiledOnly.IsChecked, CreationDate = DateTime.Now, MarkedAsSold = (bool)chkMarkAsSold.IsChecked, StartFilterDate = (DateTime)rdpStartSelectDate.SelectedDate, EndFilterDate = (DateTime)rdpEndSelectDate.SelectedDate, TemplateFilePath = txtFilePath.Text, NumberCases = Int32.Parse(txtNumberMailings.Text) }; } else { MessageBox.Show("The number of available unsold cases is less that the Selected Number of Mailings"); return; } Mouse.OverrideCursor = Cursors.Wait; MailMergeHelper _helper = new MailMergeHelper(_dealer, _dealerMailingList); //process but don't merge try { _helper.ProcessMailingList(false); MessageBox.Show("Mail Merge Created!"); } catch (Exception ex) { MessageBox.Show("Error Processing Mail merge: " + ex.ToString(), "Error"); } Mouse.OverrideCursor = Cursors.Arrow; LoadPreviousMailings(); LoadMailingTotals(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); Mouse.OverrideCursor = Cursors.Arrow; } }