Example #1
0
 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);
     }
 }
Example #2
0
 public void Add(DebtorCreditorDTO dto)
 {
     if (dto.IsDebtor)
     {
         dto.Amount = -1 * dto.Amount;
     }
     new DebtorCreditorsDalFacade().Add(dto);
     UpdateDebtorCreditorPart(dto);
 }
Example #3
0
        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);
        }