Example #1
0
        public NFCeViewModel(DestinatarioViewModel destinatarioViewModel, IDialogService dialogService, IEnviarNota enviarNotaController, INaturezaOperacaoService naturezaOperacaoService, IConfiguracaoService configuracaoService, IProdutoService produtoService, IDestinatarioService destinatarioService)
        {
            Pagamento = new PagamentoVO();
            Produto   = new ProdutoVO();
            DestinatarioParaSalvar   = new DestinatarioModel();
            TransportadoraParaSalvar = new TransportadoraModel();
            Destinatarios            = new ObservableCollection <DestinatarioModel>();
            Transportadoras          = new ObservableCollection <TransportadoraModel>();
            ProdutosCombo            = new ObservableCollection <ProdutoEntity>();

            AdicionarProdutoCmd   = new RelayCommand <object>(AdicionarProdutoCmd_Execute, null);
            GerarPagtoCmd         = new RelayCommand <object>(GerarPagtoCmd_Execute, null);
            EnviarNotaCmd         = new RelayCommand <IClosable>(EnviarNotaCmd_Execute);
            LoadedCmd             = new RelayCommand <string>(LoadedCmd_Execute, null);
            ClosedCmd             = new RelayCommand(ClosedCmd_Execute, null);
            ExcluirProdutoNotaCmd = new RelayCommand <ProdutoVO>(ExcluirProdutoNotaCmd_Execute, null);
            ExcluirPagamentoCmd   = new RelayCommand <PagamentoVO>(ExcluirPagamentoCmd_Execute, null);

            _dialogService           = dialogService;
            _enviarNotaController    = enviarNotaController;
            _naturezaOperacaoService = naturezaOperacaoService;
            _configuracaoService     = configuracaoService;
            _produtoService          = produtoService;
            _destinatarioService     = destinatarioService;

            destinatarioViewModel.DestinatarioSalvoEvent += DestinatarioVM_DestinatarioSalvoEvent;

            Finalidades = new List <string>()
            {
                "Normal",
                "Complementar",
                "Ajuste",
                "Devolução"
            };

            FormasPagamento = new Dictionary <string, string>()
            {
                { "Dinheiro", "Dinheiro" },
                { "Cheque", "Cheque" },
                { "CartaoCredito", "Cartão de Crédito" },
                { "CartaoDebito", "Cartão de Débito" }
                //{ "CreditoLoja", "Crédito Loja" },
                //{ "ValeAlimentacao",  "Vale Alimentação" },
                //{ "ValeRefeicao", "Vale Refeição" },
                //{ "ValePresente", "Vale Presente"},
                //{ "ValeCombustivel", "Vale Combustível"},
                //{ "Outros", "Outros" }
            };

            Parcelas = new List <int>()
            {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
            };
        }
Example #2
0
 private void ExcluirTransportadoraCmd_Execute(TransportadoraModel transportadora)
 {
     try
     {
         var transportadoraRepository = new TransportadoraRepository();
         transportadoraRepository.Excluir(transportadora.Id);
         Transportadoras.Remove(transportadora);
         _dialogService.ShowMessageBox("Transportadora removida com sucesso!", "Sucesso!");
     }
     catch (Exception e)
     {
         log.Error(e);
         _dialogService.ShowError("Não foi possível remover a transportadora.", "Erro!", null, null);
     }
 }
Example #3
0
        private void SalvarTransportadoraCmd_Execute(IClosable closable)
        {
            TransportadoraParaSalvar.ValidateModel();

            if (!TransportadoraParaSalvar.HasErrors)
            {
                var transportadoraEntity = (TransportadoraEntity)TransportadoraParaSalvar;

                var transportadoraDAL = new TransportadoraRepository();
                var id = transportadoraDAL.Salvar(transportadoraEntity);
                TransportadoraParaSalvar.Id = id;

                Transportadoras.Add(TransportadoraParaSalvar);
                NotaFiscal.TransportadoraSelecionada = TransportadoraParaSalvar;
                TransportadoraParaSalvar             = new TransportadoraModel();
                closable.Close();
            }
        }
Example #4
0
        public NFeViewModel(IEnviarNota enviarNotaController, IDialogService dialogService, IProdutoService produtoService, IEnviaNotaFiscalService enviaNotaFiscalService, IEstadoService estadoService, IEmissorService emissorService, IMunicipioService municipioService, TransportadoraService transportadoraService, IDestinatarioService destinatarioService, INaturezaOperacaoService naturezaOperacaoService, IConfiguracaoService configuracaoService, DestinatarioViewModel destinatarioViewModel, INotaFiscalRepository notaFiscalRepository)
        {
            Pagamento = new PagamentoVO();
            Produto   = new ProdutoVO();
            var produtosDB = produtoService.GetAll();

            DestinatarioParaSalvar   = new DestinatarioModel();
            TransportadoraParaSalvar = new TransportadoraModel();
            Destinatarios            = new ObservableCollection <DestinatarioModel>();
            Transportadoras          = new ObservableCollection <TransportadoraModel>();
            NaturezasOperacoes       = new ObservableCollection <NaturezaOperacaoModel>();
            ProdutosCombo            = new ObservableCollection <ProdutoEntity>();

            _enviaNotaFiscalService  = enviaNotaFiscalService;
            _estadoService           = estadoService;
            _produtoService          = produtoService;
            _emissorService          = emissorService;
            _municipioService        = municipioService;
            _transportadoraService   = transportadoraService;
            _destinatarioService     = destinatarioService;
            _naturezaOperacaoService = naturezaOperacaoService;
            _configuracaoService     = configuracaoService;
            _destinatarioViewModel   = destinatarioViewModel;
            _notaFiscalRepository    = notaFiscalRepository;

            AdicionarProdutoCmd      = new RelayCommand <object>(AdicionarProdutoCmd_Execute, null);
            GerarPagtoCmd            = new RelayCommand <object>(GerarPagtoCmd_Execute, null);
            SalvarTransportadoraCmd  = new RelayCommand <IClosable>(SalvarTransportadoraCmd_Execute, null);
            ExcluirTransportadoraCmd = new RelayCommand <TransportadoraModel>(ExcluirTransportadoraCmd_Execute, null);
            EnviarNotaCmd            = new RelayCommand <IClosable>(EnviarNotaCmd_Execute);
            LoadedCmd                     = new RelayCommand <string>(LoadedCmd_Execute, null);
            ClosedCmd                     = new RelayCommand(ClosedCmd_Execute, null);
            ExcluirProdutoNotaCmd         = new RelayCommand <ProdutoVO>(ExcluirProdutoNotaCmd_Execute, null);
            UfSelecionadoCmd              = new RelayCommand(UfSelecionadoCmd_Execute, null);
            TransportadoraWindowLoadedCmd = new RelayCommand(TransportadoraWindowLoadedCmd_Execute, null);
            DestinatarioChangedCmd        = new RelayCommand <DestinatarioModel>(DestinatarioChangedCmd_Execute, null);

            _enviarNotaController = enviarNotaController;
            _dialogService        = dialogService;

            Estados    = new ObservableCollection <EstadoEntity>();
            Municipios = new ObservableCollection <MunicipioEntity>();

            destinatarioViewModel.DestinatarioSalvoEvent += DestinatarioVM_DestinatarioSalvoEvent;

            foreach (var produtoDB in produtosDB)
            {
                ProdutosCombo.Add((ProdutoEntity)produtoDB);
            }

            IndicadoresPresenca = new List <string>()
            {
                "Não se Aplica",
                "Presencial",
                "Não Presencial, Internet",
                "Não Presencial, Teleatendimento",
                "Entrega a Domicílio",
                "Não Presencial, Outros"
            };

            Finalidades = new List <string>()
            {
                "Normal",
                "Complementar",
                "Ajuste",
                "Devolução"
            };

            FormasPagamento = new Dictionary <string, string>()
            {
                { "Dinheiro", "Dinheiro" },
                { "Cheque", "Cheque" },
                { "CartaoCredito", "Cartão de Crédito" },
                { "CartaoDebito", "Cartão de Débito" }
                //{ "CreditoLoja", "Crédito Loja" },
                //{ "ValeAlimentacao",  "Vale Alimentação" },
                //{ "ValeRefeicao", "Vale Refeição" },
                //{ "ValePresente", "Vale Presente"},
                //{ "ValeCombustivel", "Vale Combustível"},
                //{ "Outros", "Outros" }
            };

            EstadosUF = _estadoService.GetEstados().Select(e => e.Uf).ToList();

            Parcelas = new List <int>()
            {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
            };
        }