Exemple #1
0
        private void btnNovo_Click(object sender, EventArgs e)
        {
            FrmAgendamento frmAgendamento = new FrmAgendamento(null, Acao.Cadastrar);

            frmAgendamento.ShowDialog();
            Pesquisar();
        }
Exemple #2
0
        void Carregar()
        {
            if (dgvDados.SelectedRows.Count == 0)
            {
                MessageBox.Show("Você precisa selecionar um agendamento.", "Op's!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                agendamento.codigo                     = Convert.ToInt32(dgvDados.CurrentRow.Cells["codigo"].Value);
                agendamento.Prontuario                 = new Prontuario();
                agendamento.Prontuario.numero          = dgvDados.CurrentRow.Cells["codigo_prontuario"].Value.ToString();
                agendamento.Prontuario.nome            = dgvDados.CurrentRow.Cells["nome_tmp"].Value.ToString();
                agendamento.Prontuario.telefoneCelular = dgvDados.CurrentRow.Cells["telcelular_tmp"].Value.ToString();
                agendamento.Prontuario.telefoneFixo    = dgvDados.CurrentRow.Cells["telfixo_tmp"].Value.ToString();
                agendamento.Prontuario.dataNascimento  = Convert.ToDateTime(dgvDados.CurrentRow.Cells["data_nascimento"].Value);
                agendamento.data_agendamento           = Convert.ToDateTime(dgvDados.CurrentRow.Cells["data_agendamento"].Value);
                agendamento.hora          = dgvDados.CurrentRow.Cells["hora"].Value.ToString();
                agendamento.consultorio   = dgvDados.CurrentRow.Cells["consultorio"].Value.ToString();
                agendamento.observacoes   = dgvDados.CurrentRow.Cells["observacoes"].Value.ToString();
                agendamento.data_registro = Convert.ToDateTime(dgvDados.CurrentRow.Cells["data_registro"].Value);
                agendamento.tipo          = dgvDados.CurrentRow.Cells["tipo"].Value.ToString();
                agendamento.status        = dgvDados.CurrentRow.Cells["status"].Value.ToString();

                FrmAgendamento frmAgendamento;

                switch (this.acaoSelecionada)
                {
                case Acao.Atualizar:
                    frmAgendamento = new FrmAgendamento(agendamento, Acao.Atualizar);
                    frmAgendamento.ShowDialog();
                    Pesquisar();
                    break;

                case Acao.Visualizar:
                    frmAgendamento = new FrmAgendamento(agendamento, Acao.Visualizar);
                    frmAgendamento.ShowDialog();
                    Pesquisar();
                    break;

                case Acao.Selecionar:
                    this.DialogResult = DialogResult.OK;
                    return;
                }
            }
        }