public IResult Add(Debit debit) { _debitDal.Add(debit); return(new SuccessResult(Messages.Added)); }
public ActionResult AddDebitType(Debit debit) { var result = _debitService.Add(debit); return(Json(result)); }
/// <inheritdoc /> public void Withdraw(Debit debit) => this.DebitsCollection.Add(debit);
//delete one Debit document by id in body public void Remove(Debit debitIn) => _debits.DeleteOne(debit => debit.Id == debitIn.Id);
private void AddDebit() { if (Validate()) { try { // Recuperando dados Debit debit = new Debit(); debit.TotalAmount = double.Parse(valorTotal_txt.Text); debit.StartAmount = double.Parse(valorIncial_txt.Text); debit.PaymentDate = dataPagamento_txt.Text; debit.DueDate = dataVencimento_txt.Text; debit.Description = descricao_txt.Text; int id_pessoa = dao.GetIdPessoaSuppliier(fornecedor_txt.Text); debit.IdSupplier = dao.GetIdSupplier(id_pessoa); if (debit.IdSupplier == 0) { MessageBox.Show("Fornecedor invalido!!!", "Aviso", MessageBoxButton.OK, MessageBoxImage.Warning); return; } // Inserindo serviço no banco dao.AddDebit(debit); // Registro de log - Inserção Model.Log added = new Model.Log(); added.employe = _employe; added.action = $"Conta a pagar: {debit.Description} foi cadastrado no sistema!"; logs.Register(added); // Atualizando grid e limpando campos de texto RefreshGrid(); ClearFields(); BlockFields(); actionIndex = -1; aux = null; } catch (DatabaseInsertException err) { MessageBox.Show( err.Message, "Erro", MessageBoxButton.OK, MessageBoxImage.Error ); } catch (Exception err) { MessageBox.Show( err.Message, "Erro", MessageBoxButton.OK, MessageBoxImage.Error ); } } else { MessageBox.Show( "Há Campos Vazios", "Erro de Prenchimento de Formulário", MessageBoxButton.OK, MessageBoxImage.Warning ); } }
/// <inheritdoc /> public void Withdraw(Debit debit) { // Null Pattern }
// Create one Debit document public Debit Create(Debit debit) { _debits.InsertOne(debit); return(debit); }
public void TestDebitFilter() { Debit[] debits = new Debit[3]; Dictionary<string, object> payload = new Dictionary<string, object>(); payload.Add("amount", 100000); Dictionary<string, object> payload2 = new Dictionary<string, object>(); payload2.Add("amount", 777); Dictionary<string, object> payload3 = new Dictionary<string, object>(); payload3.Add("amount", 555); Card card = createCard(); debits[0] = card.Debit(payload); debits[1] = card.Debit(payload2); debits[2] = card.Debit(payload3); ResourceQuery<Debit> query = card.debits.Query().Filter("amount", "=", 777); Assert.AreEqual(1, query.Total()); Debit res = query.First(); Assert.AreEqual(debits[1].id, res.id); query = card.debits.Query().Filter("amount", 777); Assert.AreEqual(1, query.Total()); Assert.AreEqual(debits[1].id, query.First().id); query = ( card .debits .Query() .Filter("amount", "<", 800) .OrderBy("created_at", ResourceQuery<Debit>.SortOrder.ASCENDING) ); Assert.AreEqual(2, query.Total()); List<Debit> allDebits = query.All(); Assert.AreEqual(debits[1].id, allDebits[0].id); Assert.AreEqual(debits[2].id, allDebits[1].id); query = ( card .debits .Query() .Filter("amount", ">", 600) .Filter("amount", "<", 800) .OrderBy("amount", ResourceQuery<Debit>.SortOrder.DESCENDING) ); Assert.AreEqual(1, query.Total()); allDebits = query.All(); Assert.AreEqual(debits[1].id, allDebits[0].id); }
private static long payments(Debit d, long workedDays) { return (workedDays + d.pastDays) / d.period; }
/// <summary> /// </summary> public MangaContextFake() { var user1 = new User( SeedData.DefaultUserId, SeedData.DefaultExternalUserId); var customer = new Customer( SeedData.DefaultCustomerId, new Name(Messages.UserName), new Name(Messages.UserName), new SSN(Messages.UserSSN), user1.UserId); var credit = new Credit( new CreditId(Guid.NewGuid()), SeedData.DefaultAccountId, DateTime.Now, 800, Currency.Dollar.Code); var debit = new Debit( new DebitId(Guid.NewGuid()), SeedData.DefaultAccountId, DateTime.Now, 300, Currency.Dollar.Code); var account = new Account( SeedData.DefaultAccountId, SeedData.DefaultCustomerId, Currency.Dollar); account.Credits.Add(credit); account.Debits.Add(debit); this.Users.Add(user1); this.Customers.Add(customer); this.Accounts.Add(account); this.Credits.Add(credit); this.Debits.Add(debit); var user2 = new User( SeedData.SecondUserId, SeedData.SecondExternalUserId); var customer2 = new Customer( SeedData.SecondCustomerId, new Name(Messages.UserName), new Name(Messages.UserName), new SSN(Messages.UserSSN), SeedData.SecondUserId); var account2 = new Account( SeedData.SecondAccountId, SeedData.SecondCustomerId, Currency.Dollar); this.Users.Add(user2); this.Customers.Add(customer2); this.Accounts.Add(account2); }
public static string PerformDebitInInvestmentAccount(this Debit debitAccount) => debitAccount.FormatTransaction();
public ActionResult <Debit> Create(Debit debit) { _debitService.Create(debit); return(CreatedAtRoute("GetDebit", new { id = debit.Id.ToString() }, debit)); }
public Debit Add(Debit debit) { return(_debitDal.Add(debit)); }
//Adds debit to database and saves via context public void Add(Debit debit) { context.Debit.Add(debit); context.SaveChanges(); }
public IResult Delete(Debit debit) { _debitDal.Delete(debit); return(new SuccessResult(Messages.Deleted)); }
void IOutputPort.Ok(Debit debit, Account account) { _viewModel = Ok(new WithdrawResponse(new DebitViewModel(debit))); }
public IResult Update(Debit debit) { _debitDal.Update(debit); return(new SuccessResult(Messages.Updated)); }
public async Task <IActionResult> Withdraw([FromBody] WithdrawMessage message) { Debit debit = await withdraw.Handle(message); return(Ok()); }
void IOutputPort.Ok(Account originAccount, Debit debit, Account destinationAccount, Credit credit) => this._viewModel = this.Ok(new TransferResponse(new DebitModel(debit)));
public void Ok(Debit debit, Account account) { this.Account = account; this.Debit = debit; }
// Update one Debit document public void Update(string id, Debit debitIn) => _debits.ReplaceOne(debit => debit.Id == id, debitIn);
public static int Insert(Debit Debit) { return WebApi<int>.PostAsync(controllerName, Debit, "SinglePost").Result; }
void IOutputPort.Ok(Debit debit, Account account) => this._viewModel = this.Ok(new WithdrawResponse(new DebitModel(debit)));
public static string PerformDebitInSavingsAccount(this Debit debitAccount) => debitAccount.FormatTransaction();