public override void Cadastrar() { this.txtPesquisa.Clear(); //Direcionando para tela de cadastro FormClinicaCadastro form = new FormClinicaCadastro(this.nSessao, 0, false, null); form.ShowDialog(); //Atualiza grid this.preencheGrid(); //base.Cadastrar(); }
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[1].Selected | this.dgDados.CurrentRow.Cells[3].Selected | this.dgDados.CurrentRow.Cells[11].Selected | this.dgDados.CurrentRow.Cells[12].Selected | this.dgDados.CurrentRow.Cells[13].Selected) { //Tratamento de erros try { //Obtendo dados da clinica this.nClinica = new Clinica(this.nUtil.convertStringParaInt(this.dgDados.CurrentRow.Cells[0].Value.ToString()), this.dgDados.CurrentRow.Cells[1].Value.ToString(), this.dgDados.CurrentRow.Cells[2].Value.ToString(), this.dgDados.CurrentRow.Cells[3].Value.ToString(), this.dgDados.CurrentRow.Cells[4].Value.ToString(), this.nUtil.convertStringParaInt(this.dgDados.CurrentRow.Cells[5].Value.ToString()), this.dgDados.CurrentRow.Cells[6].Value.ToString(), this.dgDados.CurrentRow.Cells[7].Value.ToString(), this.dgDados.CurrentRow.Cells[8].Value.ToString(), this.dgDados.CurrentRow.Cells[9].Value.ToString(), this.dgDados.CurrentRow.Cells[10].Value.ToString(), this.dgDados.CurrentRow.Cells[11].Value.ToString(), this.dgDados.CurrentRow.Cells[12].Value.ToString(), this.dgDados.CurrentRow.Cells[13].Value.ToString()); //Direcionando FormClinicaCadastro form = new FormClinicaCadastro(this.nSessao, this.nClinica.id, true, this.nClinica); form.ShowDialog(this); //Atualiza grid this.preencheGrid(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Selecione o clinica que deseja visualizar!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Não há clinicas cadastradas para visualizar!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Information); } //base.Visualizar(); }