Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        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).OrderBy(x => x.DonationDate).ToList();
            IsTaxDataAvailable = TaxItems.Count > 0;

            if (string.IsNullOrEmpty(Entity.Email))
            {
                EditMode();
            }
            else
            {
                IsDetailsVisible = true;
            }
        }