public bool RemoveCommercialTax(TaxCode taxCode) { if (taxCode == null) { throw new NotImplementedException("TaxCode is null"); } var existCommercialTax = CommercialTaxes .Where(ct => ct.TaxCodeId == taxCode.Id) .FirstOrDefault(); if (existCommercialTax != null && existCommercialTax.TaxPeriodId == null) { CommercialTaxes.Remove(existCommercialTax); ReCalculate(); return(true); } throw new NotImplementedException("Cannot Remove"); }
public bool RemoveCommercialTaxs() { if (PostStatus == LedgerPostStatus.Posted) { throw new Exception("Transaction is posted"); } var CommercialTaxs = CommercialTaxes.ToList(); CommercialTaxs.ForEach(ct => { if (ct.TaxPeriodId != null) { throw new Exception("Transaction is areardy assign to tax period"); } else { CommercialTaxes.Remove(ct); } }); ReCalculate(); return(true); }