public override void Cadastrar() { this.txtPesquisa.Clear(); //Direcionando para tela de cadastro FormFisioterapeutaCadastro form = new FormFisioterapeutaCadastro(this.nSessao, 0, false, null); form.ShowDialog(); //Atualiza grid this.preencherGrid(); this.configuraDataGrid(); }
public override void Visualizar() { this.txtPesquisa.Clear(); //Foca grid this.dgDados.Focus(); //Verifica se há linhas na grid if (this.dgDados.Rows.Count > 0) { //Verifica se a linha esta selecionada if (this.dgDados.CurrentRow.Cells[2].Selected | this.dgDados.CurrentRow.Cells[3].Selected | this.dgDados.CurrentRow.Cells[4].Selected | this.dgDados.CurrentRow.Cells[5].Selected) { //Tratamento de erros try { Clinica tempClinica = new Clinica(); this.nFisioterapeuta.id = Convert.ToInt32(this.nUtil.convertStringParaInt(this.dgDados.CurrentRow.Cells[0].Value.ToString())); tempClinica.id = Convert.ToInt32(this.dgDados.CurrentRow.Cells[1].Value.ToString()); this.nFisioterapeuta.clinica = tempClinica; this.nFisioterapeuta.nome = this.dgDados.CurrentRow.Cells[2].Value.ToString(); this.nFisioterapeuta.cpf = this.dgDados.CurrentRow.Cells[3].Value.ToString(); this.nFisioterapeuta.rg = this.dgDados.CurrentRow.Cells[4].Value.ToString(); this.nFisioterapeuta.crefito = this.dgDados.CurrentRow.Cells[5].Value.ToString(); this.nFisioterapeuta.especializacao = this.dgDados.CurrentRow.Cells[6].Value.ToString(); this.nFisioterapeuta.sexo = this.dgDados.CurrentRow.Cells[7].Value.ToString(); this.nFisioterapeuta.dataDeNascimento = Convert.ToDateTime(this.dgDados.CurrentRow.Cells[8].Value.ToString()); this.nFisioterapeuta.estadoCivil = this.dgDados.CurrentRow.Cells[9].Value.ToString(); this.nFisioterapeuta.logradouro = this.dgDados.CurrentRow.Cells[10].Value.ToString(); this.nFisioterapeuta.numero = Convert.ToInt32(this.dgDados.CurrentRow.Cells[11].Value.ToString()); this.nFisioterapeuta.complemento = this.dgDados.CurrentRow.Cells[12].Value.ToString(); this.nFisioterapeuta.bairro = this.dgDados.CurrentRow.Cells[13].Value.ToString(); this.nFisioterapeuta.cep = this.dgDados.CurrentRow.Cells[14].Value.ToString(); this.nFisioterapeuta.cidade = this.dgDados.CurrentRow.Cells[15].Value.ToString(); this.nFisioterapeuta.uf = this.dgDados.CurrentRow.Cells[16].Value.ToString(); this.nFisioterapeuta.telefone = this.dgDados.CurrentRow.Cells[17].Value.ToString(); this.nFisioterapeuta.celular = this.dgDados.CurrentRow.Cells[18].Value.ToString(); this.nFisioterapeuta.email = this.dgDados.CurrentRow.Cells[19].Value.ToString(); //Direcionando FormFisioterapeutaCadastro form = new FormFisioterapeutaCadastro(this.nSessao, this.nFisioterapeuta.id, true, this.nFisioterapeuta); form.ShowDialog(this); this.preencherGrid(); this.configuraDataGrid(); } //Atualiza grid catch (Exception ex) { MessageBox.Show(ex.Message, "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Selecione o fisioterapeuta que deseja visualizar!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Não há fisioterapeutas cadastrados para visualizar!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Information); } //base.Alterar(); }