private void Search() { var mgr = new TaxManager(); Entity = mgr.Search(SearchEntity); ValidationErrors = mgr.ValidationErrors; if (!AcceptTerms) { ValidationErrors.Add(new KeyValuePair <string, string>("Accept", "You must accept the policy.")); } if (ValidationErrors.Count > 0) { IsValid = false; } if (Entity == null) { IsValid = false; } if (!IsValid) { return; } TotalTax = Entity.TaxItems.Where(t => t.TaxYear == SelectedTaxYear).Sum(x => x.Amount); TaxItems = Entity.TaxItems.Where(t => t.TaxYear == SelectedTaxYear).ToList(); IsTaxDataAvailable = TaxItems.Count > 0; IsDetailsVisible = true; }
private void Save() { IsValid = true; var mgr = new TaxManager(); mgr.Update(Entity); ValidationErrors = mgr.ValidationErrors; if (ValidationErrors.Count > 0) { IsValid = false; } if (!IsValid) { IsEditVisible = true; IsDetailsVisible = false; } else { IsEditVisible = false; IsDetailsVisible = true; Search(); GetTemplate(); } }
private void Search() { var mgr = new TaxManager(); Entity = mgr.Search(SearchEntity); ValidationErrors = mgr.ValidationErrors; if (!AcceptTerms) ValidationErrors.Add(new KeyValuePair<string, string>("Accept", "You must accept the policy.")); if (ValidationErrors.Count > 0) { IsValid = false; } if (Entity == null) IsValid = false; if (!IsValid) return; TotalTax = Entity.TaxItems.Where(t => t.TaxYear == SelectedTaxYear).Sum(x => x.Amount); TaxItems = Entity.TaxItems.Where(t => t.TaxYear == SelectedTaxYear).ToList(); IsTaxDataAvailable = TaxItems.Count > 0; IsDetailsVisible = true; }