Exemplo n.º 1
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
            };
        }
 public TransportadorasController(TransportadoraService transportadoraService, EmpresaService empresaService)
 {
     _transportadoraService = transportadoraService;
     _empresaService        = empresaService;
 }
 public TransportadoraController(UnitOfWork unitOfWork, TransportadoraService transportadoraService)
 {
     _unitOfWork            = unitOfWork;
     _transportadoraService = transportadoraService;
 }