Esempio n. 1
0
        private void BtnAtualizarTurma_Click(object sender, RoutedEventArgs e)
        {
            Turma T = lstTurma.SelectedItem as Turma;

            if (txtCurso.Text != "" && txtAno.Text != "" && txtTurma.Text != "")
            {
                Turma_Helper th = new Turma_Helper(App.ligacaoBD);
                Turma        t;
                if (_TurmaAEditar == null)
                {
                    t = new Turma();
                }
                else
                {
                    t = _TurmaAEditar;
                }
                t.Ano       = txtAno.Text;
                t.Curso     = txtCurso.Text;
                t.NomeTurma = txtTurma.Text;

                string estadoDaOperacao = th.atualizarTurma(t);
                if (estadoDaOperacao != "")
                {
                    MessageBox.Show("Erro:" + estadoDaOperacao);
                }
                else
                {
                    resetForm();
                }
            }
            else
            {
                MessageBox.Show("Todos os campos são de preenchimento obrigatório.");
            }
        }
Esempio n. 2
0
        private void preencherComboTurma()
        {
            Turma_Helper th = new Turma_Helper(App.ligacaoBD);

            if (cmbTurma.ItemsSource != null)
            {
                cmbTurma.ItemsSource = null;
            }
            if (cmbTurma.Items.Count > 0)
            {
                cmbTurma.Items.Clear();
            }
            List <Turma> listaTurmas = th.listar(Turma.TipoEstado.Ativo);

            if (listaTurmas.Count > 0)
            {
                cmbTurma.ItemsSource = listaTurmas;
            }
            else
            {
                Turma turma = new Turma();
                turma.NomeTurma = "Sem Turmas";
                cmbTurma.Items.Add(turma);
            }
            cmbTurma.SelectedIndex = 0;
        }
Esempio n. 3
0
        private void resetLista()
        {
            string       liga = App.ligacaoBD;
            Turma_Helper th   = new Turma_Helper(liga);

            _contentor           = new ObservableCollection <Turma>(th.listar(Turma.TipoEstado.Ativo));
            lstTurma.ItemsSource = _contentor;
        }
Esempio n. 4
0
 private void BtnApagarTurma_Click(object sender, RoutedEventArgs e)
 {
     if (_TurmaAEditar != null)
     {
         Turma_Helper th = new Turma_Helper(App.ligacaoBD);
         th.EliminarTurma(_TurmaAEditar);
     }
     resetForm();
 }