//public IEnumerable<LotacaoModel> PesquisaLotacao { get { return _pesquisaLotacao; } }


        public IEnumerable <LotacaoModel> ObterLotacaoAtivaPorNome(string nome)
        {
            return(_appServico.ObterLotacaoesAtivaPorNome(nome).Select(domain => {
                var vm = new LotacaoModel();
                vm.DominioToModel(domain);
                return vm;
            }).ToList());
        }
Example #2
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            currentLotacaoModel = (LotacaoModel)dataGridView1.CurrentRow.DataBoundItem;


            lotacaoModelBindingSource.DataSource = currentLotacaoModel;

            //currentLotacaoVM = (LotacaoModel)lotacaoVMbindingSource.Current;



            //this.ViewModel.Model = currentLotacaoModel;

            //this.ViewModel.Model.IdLotacao = currentLotacaoModel.IdLotacao;
            //this.ViewModel.Model.Descricao = currentLotacaoModel.Descricao;
            //this.ViewModel.Model.Sigla = currentLotacaoModel.Sigla;
            //this.ViewModel.Model.Inativa = currentLotacaoModel.Inativa;
        }
Example #3
0
        private void Form2_Load(object sender, EventArgs e)
        {
            IEnumerable <LotacaoModel> lotacaoViewModels = _appServico.ObterTodos().Select(domain => {
                var vm = new LotacaoModel();
                vm.DominioToModel(domain);
                return(vm);
            }).ToList();



            var lotacaoBindingList = new BindingList <LotacaoModel>(lotacaoViewModels.ToList());

            dataGridView1.SelectionChanged += new EventHandler(dataGridView1_SelectionChanged);
            // lotacaoVMbindingSource.DataSource = lotacaoBindingList;
            dataGridView1.DataSource    = lotacaoBindingList;
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;



            //currentLotacaoModel = lotacaoBindingList.FirstOrDefault();
            //this.ViewModel.Model.IdLotacao = currentLotacaoModel.IdLotacao;
            //this.ViewModel.Model.Descricao = currentLotacaoModel.Descricao;
            //this.ViewModel.Model.Sigla = currentLotacaoModel.Sigla;
            //this.ViewModel.Model.Inativa = currentLotacaoModel.Inativa;


            //var lotacaoObservable = new ObservableCollection<LotacaoViewModel>(lotacaoViewModels);
            //lotacaoVMbindingSource.DataSource = lotacaoObservable;
            //dataGridView1.DataSource = lotacaoObservable;

            //button1.DataBindings.Add("Enabled", ckInativo, "Checked");

            // txtId.DataBindings.Add("Text", lotacaoVMbindingSource.Current, "IdLotacao");
            //txtDescricao.DataBindings.Add("Text", lotacaoVMbindingSource., "Descricao", false, DataSourceUpdateMode.OnPropertyChanged);
            //txtSigla.DataBindings.Add("Text", lotacaoVMbindingSource.Current, "Sigla",false, DataSourceUpdateMode.OnPropertyChanged);
            //textBox2.DataBindings.Add("Text", txtSigla, "Text");

            //ckInativo.DataBindings.Add("Checked", lotacaoVMbindingSource.Current, "Inativo");
        }