예제 #1
0
 public VendaController(VendaRepository vendaRepository, ClienteRepository clienteRepository, VeiculoRepository veiculoRepository, FormaPagamentoRepository formaPagamentoRepository, EnderecoRepository enderecoRepository)
 {
     this.clienteRepository        = clienteRepository;
     this.vendaRepository          = vendaRepository;
     this.veiculoRepository        = veiculoRepository;
     this.formaPagamentoRepository = formaPagamentoRepository;
     this.enderecoRepository       = enderecoRepository;
 }
 protected override void Filtrar()
 {
     if (!string.IsNullOrEmpty(Filter) && Filter.Length >= Settings.Default.MinLenghtPesquisa)
     {
         Collection.Clear();
         Collection.AddRange(FormaPagamentoRepository.GetByRange(Filter, Settings.Default.TakePesquisa));
     }
     base.Filtrar();
 }
예제 #3
0
 public PedidoModel()
 {
     IdGuid          = Guid.NewGuid();
     QuantidadeAtual = 1;
     try
     {
         FormasPagamento    = new ObservableCollection <FormaPagamento>(FormaPagamentoRepository.GetList());
         CondicoesPagamento = new ObservableCollection <CondicaoPagamento>(CondicaoPagamentoRepository.GetList());
     }
     catch (Exception ex)
     {
         CustomMessageBox.MensagemErro(ex.Message);
     }
 }
 public VendaController(VendaRepository _vendaRepository, ClienteRepository _clienteRepository, VeiculoRepository _veiculoRepository,
                        FormaPagamentoRepository _formaPagamentoRepository, EnderecoRepository _enderecoRepository, PerfomanceRepository _perfomanceRepository,
                        RodaRepository _rodaRepository, BancoRepository _bancoRepository, CorVeiculoRepository _corRepository)
 {
     this._clienteRepository        = _clienteRepository;
     this._vendaRepository          = _vendaRepository;
     this._veiculoRepository        = _veiculoRepository;
     this._formaPagamentoRepository = _formaPagamentoRepository;
     this._enderecoRepository       = _enderecoRepository;
     this._perfomanceRepository     = _perfomanceRepository;
     this._rodaRepository           = _rodaRepository;
     this._bancoRepository          = _bancoRepository;
     this._corRepository            = _corRepository;
 }
        public new static PedidoRestaurante Save(PedidoRestaurante pedido)
        {
            ISession     session     = NHibernateHttpModule.Session;
            ITransaction transaction = session.BeginTransaction();

            try
            {
                if (pedido.Empresa == null)
                {
                    throw new Exception("Informe a empresa do pedido.");
                }
                foreach (PagamentoPedido pag in pedido.Pagamento)
                {
                    pag.FormaPagamento = FormaPagamentoRepository.GetById(
                        pag.FormaPagamento.Id);
                }
                foreach (ComposicaoProduto comp in pedido.Produtos)
                {
                    comp.Produto = ProdutoRepository.GetById(comp.Produto.Id);
                    foreach (ProdutoPedido prod in comp.Composicao)
                    {
                        prod.Produto = ProdutoRepository.GetById(prod.Produto.Id);
                    }
                }
                session.Save(pedido);

                foreach (PagamentoPedido pag in pedido.Pagamento)
                {
                    pag.Pedido = pedido;
                    // Cria o recebimento da venda para o caixa.
                    session.Save(RecebimentoVendaRepository
                                 .CreateRecebimentoVendaByPedido(pag, pedido));
                }
                // Efetua o lançamento no contávil.
                PagamentoPedidoRepository.LancarPagamentoRestaurante(pedido);
                // Baixa as quantidades no estoque.
                BaixaEstoque(session, pedido);
                transaction.Commit();
            }
            catch (Exception)
            {
                transaction.Rollback();
                throw;
            }

            return(pedido);
        }
예제 #6
0
 public override void Excluir()
 {
     try
     {
         if (ConfirmDelete())
         {
             Entity.Status = Status.Excluido;
             FormaPagamentoRepository.Save(Entity);
             base.Excluir();
         }
     }
     catch (Exception ex)
     {
         MensagemErroBancoDados(ex.Message);
         Utils.GerarLog(ex);
     }
 }
예제 #7
0
        private DbConfig()
        {
            Conectar();
            this.FluxoCaixaRepository     = new FluxoCaixaRepository(Session);
            this.ProdutoRepository        = new ProdutoRepository(Session);
            this.UserRepository           = new UserRepository(Session);
            this.CategoriaRepository      = new CategoriaRepository(Session);
            this.ImagemRepository         = new ImagemRepository(Session);
            this.ComentarioRepository     = new ComentarioRepository(Session);
            this.PesquisaRepository       = new PesquisaRepository(Session);
            this.EnderecoRepository       = new EnderecoRepository(Session);
            this.DescontoRepository       = new DescontoRepository(Session);
            this.EstoqueRepository        = new EstoqueRepository(Session);
            this.VendaRepository          = new VendaRepository(Session);
            this.ItemVendaRepository      = new ItemVendaRepository(Session);
            this.FormaPagamentoRepository = new FormaPagamentoRepository(Session);

            this.CarrinhoRepository        = new CarrinhoRepository(Session);
            this.CarrinhoProdutoRepository = new CarrinhoProdutoRepository(Session);
        }
예제 #8
0
        public override void Salvar()
        {
            try
            {
                if (IsValid(Entity))
                {
                    Entity.ExigeIdentificacaoCliente = false;
                    Entity.MovimentaLimiteCliente    = false;
                    Entity.PodeReceber = false;

                    FormaPagamentoRepository.Save(Entity);

                    Entity = new FormaPagamento();
                    base.Salvar();
                }
            }
            catch (Exception ex)
            {
                MensagemErroBancoDados(ex.Message);
                Utils.GerarLog(ex);
            }
        }
예제 #9
0
 public FormaPagamentoReport()
 {
     InitializeComponent();
     bindingSource.DataSource = FormaPagamentoRepository.GetListAtivos();
 }