public void Ativar(BusinessArgs args) { if (this.Ativo.Value) { throw new BusinessException("Este carro já está ativo!"); } this.Ativo = true; this.Observacoes += $"Carro ativado em: { DateTime.Now.ToString("dd/MM/yyyy hh:mm") }.\n"; this.Save(); args.Message = "Carro ativado com sucesso!"; }
public static void AjustaValorReferencia(BusinessArgs args) { var planos = Planos.GetAll(); foreach (var plano in planos) { var valorAtual = plano.ValorReferencia; plano.ValorReferencia = valorAtual + (valorAtual * Convert.ToDecimal(args.DataEntity.Fields["PERCENTUAL"]) / 100); plano.Save(); } args.Message = "Atualização bem sucedida!!!"; }
public void AlterarAtivo(BusinessArgs args) { if (this.Ativo == true) { this.Ativo = false; args.Message = "Cartão desativado!"; } else { this.Ativo = true; args.Message = "Cartão ativado!"; } Save(); }
public void Desativar(BusinessArgs args) { if (PossuiReservasAgora()) { throw new BusinessException("Este carro não pode ser desativado, pois possui reservas ativas no momento!"); } if (!this.Ativo.Value) { throw new BusinessException("Este carro já está inativo"); } this.Ativo = false; this.Observacoes += $"Carro desativado em: { DateTime.Now.ToString("dd/MM/yyyy hh:mm") }.\n"; this.Save(); }
public void PagaPedido(BusinessArgs args) { var itemPedidoDao = ItemPedidoDao.CreateInstance(); var itens = itemPedidoDao.PegarPedidosDaComanda(this.Handle); foreach (var item in itens) { var atual = itemPedidoDao.Get(item.Handle); atual.Entregue = true; atual.ComandaHandle = null; itemPedidoDao.Save(atual); } args.Message = "Comanda finalizada , Troco a pagar:" + (this.ValorDigitado - this.Valortotal); this.Delete(); }
public void FinalizarPedido(BusinessArgs args) { var produtoDao = ProdutoDao.CreateInstance(); var mesaComandadao = MesacomandasDao.CreateInstance(); var comandaDao = ComandasDao.CreateInstance(); var mesaDao = MesasDao.CreateInstance(); var produto = produtoDao.Get(this.ProdutoHandle); var mesacomanda = mesaComandadao.Get(this.ComandaHandle); var mesa = mesaDao.Get(mesacomanda.MesaHandle).Numero; var comanda = comandaDao.Get(mesacomanda.ComandaHandle).Numero; this.Entregue = true; mesacomanda.Valortotal += produto.Preco; mesaComandadao.Save(mesacomanda); Save(); args.Message = "Entregar pedido na Comanda " + comanda + " Localizada na Mesa " + mesa; }
//private bool PossuiReservasAgora() //{ // bool result = false; // Query query = new Query($@"SELECT COUNT(*) QTDE FROM RESERVAS R // WHERE R.CARRO = { this.Handle } // AND // @HOJE BETWEEN R.DATAINICIO AND R.DATAFIM"); // var dados = query.Execute(); // if (dados != null && dados.Count() > 0) // { // result = dados[0]["QTDE"].GetInt32() > 0; // } // return result; //} //public void Desativar(BusinessArgs args) //{ // if (PossuiReservasAgora()) // { // throw new BusinessException("Este carro não pode ser desativado, pois possui reservas ativas no momento!"); // } // if (!this.Ativo.Value) // { // throw new BusinessException("Este carro já está inativo!"); // } // this.Ativo = false; // this.Observacoes += $"Carro desativado em: { DateTime.Now.ToString("dd/MM/yyyy hh:mm") }.\n"; // this.Save(); // args.Message = "Carro desativado com sucesso!"; //} public void Desativar(BusinessArgs args) { var reservasDao = ReservasDao.CreateInstance(); if (reservasDao.ExisteReservaAgora(this.Handle)) { throw new BusinessException("Este carro não pode ser desativado, pois possui reservas ativas no momento!"); } if (!this.Ativo.Value) { throw new BusinessException("Este carro já está inativo!"); } this.Ativo = false; this.Observacoes += $"Carro desativado em: { DateTime.Now.ToString("dd/MM/yyyy hh:mm") }.\n"; this.Save(); args.Message = "Carro desativado com sucesso!"; }
public void Devolver(BusinessArgs args) { var livro = _livroDao.Get(LivroHandle); if (DataDevolucao == null) { if (DataFinal.Value < DateTime.Today) { PagarMulta(); } DataDevolucao = DateTime.Today; livro.Emprestado = false; _livroDao.Save(livro); Save(); } else { throw new BusinessException("Este livro já foi devolvido."); } }
public void Aprovar(BusinessArgs args) { //var gerenciador = Benner.Tecnologia.Common.IoC.DependencyContainer.Get<IGerenciadorReservas>(); try { args.Message = gerenciador.AprovarReserva(this); if (!string.IsNullOrEmpty(PessoaInstance.EMail)) { string mensagem = $"Reserva de { ModeloCarroInstance.Nome } no período de { DataInicio } até { DataFim } aprovada em { DateTime.Now }."; NotificacaoReservaAprovadaRequest request = new NotificacaoReservaAprovadaRequest(PessoaInstance.EMail, "Notificação de reserva aprovada", mensagem); BusinessTask.Factory.NewComponentTask <INotificadorReservasAprovadas>() .WithDescription("Notificação de aprovação") .WithNotification() .WithRequestValue(request) .Start(); } } catch (Exception e) { throw e; } }
public void Devolver(BusinessArgs args) { args.Message = this.gerenciador.DevolverReserva(this); }
public void Recusar(BusinessArgs args) { args.Message = this.gerenciador.RecusarReserva(this); }
//[Inject] //public IGerenciadorReservas Gerenciador { get; set; } public void Aprovar(BusinessArgs args) { var gerenciador = Benner.Tecnologia.Common.IoC.DependencyContainer.Get <IGerenciadorReservas>(); args.Message = gerenciador.AprovarReserva(this); }
public void MudarFalta(BusinessArgs args) { this.EstaEmFalta = !this.EstaEmFalta; Save(); args.Message = "Falta alterada!"; }