private Venda PopularVendaComDinheiro(Venda venda)
 {
     try
     {
         InstanciaCaixaRepositorio();
         decimal valorTroco = Convert.ToDecimal(txtTroco.Text.Substring(2, txtTroco.Text.Length - 2));
         if (_caixaRepositorio.GetValor().Valor < valorTroco)
         {
             MyErro.MyCustomException("Valor do troco acima do valor no caixa, é necessário abrir o caixa para a venda ocorrer corretamente.");
         }
         return(new Venda
         {
             Data = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day),
             LucroTotal = GetLucroDivididoPelaParcela(),
             IDTIPOPAGAMENTO = _tipoPagamentoRepositorio.GetIDPeloNome(cbbTipoDePagamento.Text),
             VendaTotal = GetTotalDividoPelaParcela(),
             IdUsuario = Usuarios.IDStatic
         });
     }
     catch (CustomException erro)
     {
         throw new CustomException(erro.Message);
     }
     catch (Exception erro)
     {
         throw new Exception(erro.Message);
     }
 }
Example #2
0
 private Venda PopularVendaSemDinheiro(Venda venda)
 {
     try
     {
         venda                 = new Venda();
         venda.Data            = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
         venda.LucroTotal      = GetValorLucroTotal();
         venda.IDTIPOPAGAMENTO = _tipoPagamentoRepositorio.GetIDPeloNome(cbbTipoDePagamento.Text);
         venda.VendaTotal      = GetValorNaComanda();
         venda.IdUsuario       = Usuarios.IDStatic;
         return(venda);
     }
     catch (CustomException erro)
     {
         throw new CustomException(erro.Message);
     }
     catch (Exception erro)
     {
         throw new Exception(erro.Message);
     }
 }