Beispiel #1
0
        async void SelectRecord()
        {
            var mainviewmodel = MainViewModel.GetInstance();

            try
            {
                var searchinvoice = SearchInvoicesViewModel.GetInstance();
                //searchinvoice.Calendar = this;
                await navigationService.Back();
            }

            catch (System.Exception ex)
            {
                await dialogService.ShowMessage("Error", ex.Message);
            }
        }
Beispiel #2
0
        public MainWindowViewModel(IUnityContainer container, IBrowsingService browsingService,
                                   SearchCustomersViewModel searchCustomersViewModel, SearchInvoicesViewModel searchInvoicesViewModel)
        {
            this.browsingService = browsingService;

            this.searchCustomersViewModel = searchCustomersViewModel;
            this.searchInvoicesViewModel  = searchInvoicesViewModel;

            this.customerCommandsViewModel =
                container.Resolve <CustomerCommandsViewModel>(new ParameterOverride("searchCustomersViewModel",
                                                                                    this.searchCustomersViewModel));
            this.invoiceCommandsViewModel =
                container.Resolve <InvoiceCommandsViewModel>(new ParameterOverride("searchInvoicesViewModel",
                                                                                   this.searchInvoicesViewModel));

            this.RepositoryCommand = new RelayCommand(onRepositoryExecuted);
        }
        public InvoiceCommandsViewModel(INavigationService navigationService, INotificationService notificationService, IInvoiceService invoiceService, SearchInvoicesViewModel searchInvoicesViewModel)
        {
            this.navigationService   = navigationService;
            this.notificationService = notificationService;
            this.invoiceService      = invoiceService;

            this.CreateInvoiceCommand = new RelayCommand(onCreateInvoiceExecuted);
            this.ExportInvoiceCommand = new RelayCommand(onExportInvoiceExecuted, onExportInvoiceCanExecute);

            this.searchInvoicesViewModel = searchInvoicesViewModel;
            this.searchInvoicesViewModel.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "SelectedInvoice")
                {
                    this.ExportInvoiceCommand.RaiseCanExecuteChanged();
                }
            };
        }
Beispiel #4
0
        async void SelectRecord()
        {
            var mainviewmodel = MainViewModel.GetInstance();

            switch (mainviewmodel.EjecutadoDesde)
            {
            case "SearchInvoicesViewModel":
                try
                {
                    var searchinvoice = SearchInvoicesViewModel.GetInstance();
                    searchinvoice.Calendar = null;
                    searchinvoice.Customer = this;
                    searchinvoice.InvoiceHeaders.Clear();
                    searchinvoice.TotalLineas           = 0;
                    searchinvoice.IsEnabled             = true;
                    searchinvoice.FiltroFechasIsEnabled = true;
                    await navigationService.Back();
                }
                catch (System.Exception ex)
                {
                    await dialogService.ShowMessage("Error", ex.Message);
                }

                break;

            case "NewOrderViewModel":
                try
                {
                    if (CreditHold == true)
                    {
                        var answer = await dialogService.ShowConfirm("Informacion",
                                                                     "El cliente tiene credito retenido. ¿Desea continuar?");

                        if (!answer)
                        {
                            return;
                        }
                    }
                    var newOrderViewModel = NewOrderViewModel.GetInstance();
                    newOrderViewModel.Customer = this;
                    newOrderViewModel.LoadPriceLists();
                    await navigationService.Back();
                }
                catch (System.Exception ex)
                {
                    await dialogService.ShowMessage("Error", ex.Message);
                }

                break;

            case "SearchCashHeaderPage":
                try
                {
                    var searchvashheaderviewmodel = SearchCashHeaderViewModel.GetInstance();
                    searchvashheaderviewmodel.Calendar    = null;
                    searchvashheaderviewmodel.Customer    = this;
                    searchvashheaderviewmodel.TotalLineas = 0;
                    searchvashheaderviewmodel.CashHeaders.Clear();
                    searchvashheaderviewmodel.IsEnabled = true;
                    await navigationService.Back();
                }

                catch (System.Exception ex)
                {
                    await dialogService.ShowMessage("Error", ex.Message);
                }

                break;
            }
        }