Example #1
0
        private void btnGravar_Click(object sender, EventArgs e)
        {
            FrequenciaDTO param = new FrequenciaDTO();

            if (lblCodigo.Text == string.Empty)
            {
                param.idFrequencia = 0;
            }
            else
            {
                param.idFrequencia = Convert.ToInt32(lblCodigo.Text);
            }

            param.idProjeto            = Convert.ToInt32(cmbProjetoEdit.SelectedValue);
            param.idTurma              = Convert.ToInt32(cmbTurmaEdit.SelectedValue);
            param.dtFrequencia         = Convert.ToDateTime(txtdtFrequencia.Text);
            param.idPessoaUltAlteracao = Sessao.Usuario.idUsuario;

            FrequenciaBLL bus          = new FrequenciaBLL();
            var           idFrequencia = bus.SalvarFrequencia(param);

            if (idFrequencia > 0)
            {
                lblCodigo.Text = idFrequencia.ToString();
                MessageBox.Show("Frequencia gerada com sucesso!");

                CarregaGrid();
                CarregaDetalhes(idFrequencia);
            }
            else
            {
                throw new Exception("Erro na geração da Frequencia");
            }
        }
Example #2
0
        public void CarregaDetalhes(int _idFrequencia)
        {
            CarregaComboProjetoEdit();

            panelEdit.Visible     = true;
            panelConsulta.Visible = false;

            // ************************************************** //
            // Preenche Tela de Detalhes
            // ************************************************** //

            var itemFreq = new FrequenciaBLL().GetByID(new FrequenciaDTO()
            {
                idFrequencia = _idFrequencia
            });

            lblCodigo.Text = _idFrequencia.ToString();
            cmbProjetoEdit.SelectedValue = itemFreq.idProjeto;
            cmbTurmaEdit.SelectedValue   = itemFreq.idTurma;
            txtdtFrequencia.Text         = itemFreq.dtFrequencia.ToShortDateString();

            txtdtCadastro.Text    = itemFreq.dtCadastro.ToShortDateString();
            txtDataAlteracao.Text = itemFreq.dtUltAlteracao.ToShortDateString();
            txtNomeAlteracao.Text = itemFreq.nomePessoaUltAlteracao;

            var listPresenca = new FrequenciaBLL().GetAlunos(new FrequenciaDTO()
            {
                idFrequencia = _idFrequencia
            });

            GridViewDataBind2(listPresenca);

            // ************************************************** //
            // Preenche Matricula
            // ************************************************** //

            /*
             * MatriculaDTO param = new MatriculaDTO();
             * param.idPessoa = _idPessoa;
             *
             * var listMatr = new MatriculaBLL().GetDataWithParam(param);
             */

            ControlFormEdit(false);
        }
Example #3
0
        private void btVisualizar_Click(object sender, EventArgs e)
        {
            FrequenciaBLL fbll = new FrequenciaBLL();
            FrequenciaDTO fdto = new FrequenciaDTO();

            VerificaRadioButton();

            if (txtMatricula.Text == string.Empty)
            {
                MessageBox.Show("Por favor, selecione um(a) aluno(a).", "Na moral pai");
                return;
            }
            else
            {
                fdto = fbll.Localizar(decisao, Convert.ToInt32(txtMatricula.Text));
                if (rbPresencas.Checked == true && fdto.Presente != 0)
                {
                    total = fdto.Presente;

                    MessageBox.Show("" + total.ToString() + " presenças até o momento.", "Presenças", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else if (rbPresencas.Checked == true && fdto.Presente == 0)
                {
                    MessageBox.Show("Nenhuma presença foi cadastrada até o momento.", "Ops");
                    return;
                }
                else if (rbAusencias.Checked == true && fdto.Ausente != 0)
                {
                    total = fdto.Ausente;

                    MessageBox.Show("" + total.ToString() + " faltas até o momento.", "Ausências", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    MessageBox.Show("Nenhuma ausencia foi cadastrada até o momento.", "Ops");
                    return;
                }
            }
        }
Example #4
0
        public void CarregaGrid()
        {
            int _idProjeto = 0;
            int _idTurma   = 0;

            if (cmbProjeto.SelectedValue != null)
            {
                _idProjeto = Convert.ToInt32(cmbProjeto.SelectedValue.ToString());
            }

            if (cmbTurma.SelectedValue != null)
            {
                _idTurma = Convert.ToInt32(cmbTurma.SelectedValue.ToString());
            }

            FrequenciaDTO itemFrequencia = new FrequenciaDTO()
            {
                idProjeto = _idProjeto, idTurma = _idTurma
            };

            List <FrequenciaDTO> lista = new FrequenciaBLL().GetAllData(itemFrequencia);

            Grid.GridViewDataBind(lista.ToDataTable(), gridMessage);
        }
Example #5
0
        private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                int idPessoa = Convert.ToInt32(this.dataGridView2[1, e.RowIndex].Value);

                // CarregaDetalhes(idPessoa);

                // MessageBox.Show("You have selected in image in " + e.RowIndex + " row.");
                // MessageBox.Show("You have selected in image in " + this.dataGridView1[1, e.RowIndex].Value.ToString() + " row.");
            }
            else if (e.ColumnIndex == dataGridView2.Columns["flagPresenca"].Index)
            {
                bool _out       = false;
                bool chkChecked = false;

                DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)dataGridView2.Rows[e.RowIndex].Cells["flagPresenca"];

                if (bool.TryParse(chk.Value.ToString(), out _out))
                {
                    chkChecked = Convert.ToBoolean(chk.Value);
                }

                if (chkChecked == true)
                {
                    chk.Value = false;
                }
                else
                {
                    chk.Value = true;
                }

                int _idPessoa = Convert.ToInt32(this.dataGridView2[1, e.RowIndex].Value);

                var _item = new FrequenciaDTO()
                {
                    idPessoa     = _idPessoa,
                    idFrequencia = Convert.ToInt32(lblCodigo.Text),
                    flagPresenca = Convert.ToBoolean(chk.Value)
                };

                dataGridView2.EndEdit();  //Stop editing of cell.

                var result = new FrequenciaBLL().UpdateListaChamada(_item);

                /*
                 * //dataGridView2.Rows[e.RowIndex].Cells["flagPresenca"].Value = true;
                 * if (Convert.ToBoolean(dataGridView1.Rows[e.RowIndex].Cells["chkcol"].Value) == false)
                 * {
                 *  for (int i = 0; i <= dataGridView1.Rows.Count - 1; i++)
                 *  {
                 *      dataGridView1.Rows[i].Cells["chkcol"].Value = false;
                 *  }
                 * }
                 */

                /*
                 * var bid = dataGridView2.Rows[e.RowIndex];
                 *
                 * var selectedRow = this.dataGridView2[1, e.RowIndex];
                 *
                 * if (selectedRow == null)
                 *  return;
                 *
                 * selectedRow.Selected = !selectedRow.Selected;
                 */
            }
        }