Example #1
0
        public CustomerCardViewModel(IUnityContainer container,
                            IRegionManager regionManager,
                            IEventAggregator eventAggregator)
        {
            _container = container;
            _eventAggregator = eventAggregator;
            _regionManager = regionManager;

            this.NotificationRequest = new InteractionRequest<INotification>();

            _clientLayer = new ClientLayer();
            CurrentCustomer = new Customer();
            _customerTypes = new ObservableCollection<CustomerType>(_clientLayer.GetAllCustomerTypes());
            //CurrentCustomerType = _currentCustomer.CustomerType;
        }
Example #2
0
 private void EditCustomerDetails()
 {
     _currentCustomer = _collectionView.CurrentItem as Customer;
     if (_currentCustomer != null)
     {
         ShowCustomersDetails(false);
     }
 }
Example #3
0
 private void CreateCustomer(Customer customer)
 {
     ShowCustomersDetails(true);
 }
Example #4
0
 private void SelectedCustomerChanged(object sender, EventArgs e)
 {
     //для динамического просмотра
     _currentCustomer = _collectionView.CurrentItem as Customer;
     if (_currentCustomer != null)
     {
         _eventAggregator.GetEvent<CustomerSelectedEvent>().Publish(_currentCustomer.Id);
     }
 }
Example #5
0
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     _currentCustomer = (Customer)navigationContext.Parameters["CurrentCustomer"];
     string status = (string)navigationContext.Parameters["StatusCustomer"];
     if (_currentCustomer != null && status != "CancelCustomer")
     {
         if (status == "NewCustomer") _customers.Add(_currentCustomer);
         Customers.MoveCurrentTo(_currentCustomer);
         Customers.Refresh();
     }
 }
Example #6
0
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     string status = (string)navigationContext.Parameters["StatusCustomer"];
     if (status == "NewCustomer")
     {
         CurrentCustomer = new Customer();
         CurrentCustomerType = null;
     }
     else if (status == "EditCustomer")
     {
         CurrentCustomer = (Customer)navigationContext.Parameters["CurrentCustomer"];
         CurrentCustomerType = CurrentCustomer.CustomerType;
     }
     RemoveDetailsView();
 }
Example #7
0
 private void CancelCustomerDetails()
 {
     
     NavigationParameters navigationParameters = new NavigationParameters();
     navigationParameters.Add("CurrentCustomer", _currentCustomer);
     _regionManager.RequestNavigate(RegionNames.DetailRegion, ViewNames.CustomerDetailsView, navigationParameters);
     _currentCustomer = null;
     navigationParameters.Add("StatusCustomer", "CancelCustomer");
     _regionManager.RequestNavigate(RegionNames.MainRegion, ViewNames.CustomerListView, navigationParameters);
     
     //_regionManager.RequestNavigate(RegionNames.MainRegion, new Uri(ViewNames.CustomerListView, UriKind.Relative), navigationParameters);
 }
Example #8
0
 public void OnNavigatedTo(NavigationContext navigationContext)
 {
     CurrentCustomer = (Customer)navigationContext.Parameters["CurrentCustomer"];
 }
Example #9
0
 private void CustomerSelected(int id)
 {
     CurrentCustomer = _clientLayer.GetCustomerById(id);
 }