Example #1
0
        private void GenerateTaxTabData()
        {
            int currentBikeId = GlobalVariables.CurrentBikeId;

            if (!taxService.HasTax(currentBikeId))
            {
                TaxInformationLabel.Text      = "Данъка не е платен";
                TaxInformationLabel.ForeColor = Color.Red;
                return;
            }

            LastTaxPayedViewModel model = taxService.GetLastTax(currentBikeId);
            int      contCount          = taxService.GeTaxContCount(model.TaxId);
            DateTime taxValidDay        = model.PayDate.AddYears(1);

            if (taxValidDay >= DateTime.Now)
            {
                if (contCount == 2)
                {
                    TaxInformationLabel.Text      = $"Данъка е платен до {taxValidDay:dd.MM.yyyy}";
                    TaxInformationLabel.ForeColor = Color.Green;
                    return;
                }
                else if (contCount == 1)
                {
                    TaxInformationLabel.Text      = $"Остава да направите 1 вноска";
                    TaxInformationLabel.ForeColor = Color.Orange;
                    double priceLeft = model.Price / 2;
                    priceLeft             = Math.Round(priceLeft, 2);
                    TaxContPriceText.Text = priceLeft.ToString();
                    return;
                }
            }

            TaxInformationLabel.Text      = "Данъка не е платен";
            TaxInformationLabel.ForeColor = Color.Red;
        }