Exemple #1
0
        private void FormSpedFiscal_Load(object sender, EventArgs e)
        {
            _FrontController = new FrontController();
            _FrontController.Initialize();

            var empresas = from emp in _FrontController.ListEmpresasDisponiveis()
                           select new { emp.CODIGO_EMPRESA, DESC_EMPRESA = emp.CODIGO_EMPRESA + " - " + emp.NOME_EMPRESA };

            this.cbxEmpresas.Items.Clear();
            this.cbxEmpresas.DataSource    = empresas.ToList();
            this.cbxEmpresas.DisplayMember = "DESC_EMPRESA";
            this.cbxEmpresas.ValueMember   = "CODIGO_EMPRESA";
            this.cbxEmpresas.SelectedIndex = 0;

            DateTime dataAtual = DateTime.Now.Date;

            this.dtpInicio.MinDate = new DateTime(2000, 1, 1);
            this.dtpFim.MinDate    = this.dtpInicio.MinDate;
            this.dtpInicio.MaxDate = dataAtual.AddDays(-1);
            this.dtpFim.MaxDate    = this.dtpInicio.MaxDate;

            // Inicializa os filtros de data, atribuindo aos mesmos os dias inicial e
            // final do mês anterior
            this.dtpFim.Value    = new DateTime(dataAtual.Year, dataAtual.Month, 1).AddDays(-1);
            this.dtpInicio.Value = new DateTime(this.dtpFim.Value.Year, this.dtpFim.Value.Month, 1);
        }