Пример #1
0
        public gridPDF(Models.AmortizacaoPDF pdf)
        {
            InitializeComponent();

            txtBlockTotalAmortizacao.Text  = String.Format(CultureInfo.CurrentCulture, "{0:C2}", pdf.Source.TotalAmortizacao);
            txtBlockTotalJuros.Text        = String.Format(CultureInfo.CurrentCulture, "{0:C2}", pdf.Source.TotalJuros);
            txtBlockTotalPrestacao.Text    = String.Format(CultureInfo.CurrentCulture, "{0:C2}", pdf.Source.TotalPrestacao);
            txtBlockTotalSaldoDevedor.Text = "-";

            CollectionViewSource itemCollectionViewSource;

            itemCollectionViewSource        = (CollectionViewSource)(FindResource("ItemCollectionViewSource"));
            itemCollectionViewSource.Source = pdf.Source.Parcelas;
            _pdf = pdf;
            //dgValues.ItemsSource = pdf.Source.Parcelas;
        }
        private void CreateTxt_Click(object sender, RoutedEventArgs e)
        {
            Divida       divida      = new Divida(double.Parse(txtMontante.Text, NumberStyles.Currency), double.Parse(txtJuros.Text.Replace("%", "")), int.Parse(txtNParcelas.Text));
            IAmortizacao amortizacao = null;

            Models.AmortizacaoPDF pdf = null;
            string _title             = "Tabela";

            switch (cbTipo.SelectedIndex)
            {
            case 0:
                amortizacao = new SAC();
                pdf         = new Models.AmortizacaoPDF(typeof(SAC));
                _title      = "Tabela SAC";
                break;

            case 1:
                amortizacao = new Price();
                pdf         = new Models.AmortizacaoPDF(typeof(Price));
                _title      = "Tabela Price";
                break;

            case 2:
                amortizacao = new Americano();
                pdf         = new Models.AmortizacaoPDF(typeof(Americano));
                _title      = "Tabela Americano";
                break;
            }

            divida     = amortizacao.Calcular(divida);
            pdf.Source = divida;

            gridPDF grid = new gridPDF(pdf);

            grid.Title = _title;
            grid.Show();
        }