public void UpdateDebtorCreditorPart(DebtorCreditorDTO dto) { if (dto.ClientId.Value > 0) { var client = new ClientDalFacade().GetClient(dto.ClientId); var amount = client.DebtorCreditor + dto.Amount; new ClientDalFacade().UpdateDebtorCreditorPart(dto.ClientId.Value, amount); } }
public void Add(DebtorCreditorDTO dto) { if (dto.IsDebtor) { dto.Amount = -1 * dto.Amount; } new DebtorCreditorsDalFacade().Add(dto); UpdateDebtorCreditorPart(dto); }
public void Update(DebtorCreditorDTO dto) { if (dto.IsDebtor) { dto.Amount = -1 * dto.Amount; } new DebtorCreditorsDalFacade().Update(dto); var creditorDebtorExsting = new DebtorCreditorsDalFacade().GetDebtorCreditorById(dto.Id); if (dto.IsDebtor) { dto.Amount = creditorDebtorExsting.Amount - dto.Amount; } else { dto.Amount = dto.Amount - creditorDebtorExsting.Amount; } UpdateDebtorCreditorPart(dto); }