private void btnPesquisarATSU_Click(object sender, EventArgs e) { // abre o form dentro do form form_ConsAtendimento Form_Cad = new form_ConsAtendimento(); Form_Cad.ShowInTaskbar = false; Form_Cad.StartPosition = FormStartPosition.CenterParent; Form_Cad.ShowDialog(ActiveForm); if (Form_Cad.codigo != 0) { ConexaoDAL conexao = new ConexaoDAL(DadosConexaoDAL.StringDeConexão); AtendimentoBLL bll = new AtendimentoBLL(conexao); AtendimentoDTO ate = bll.CarregaAtendimentoDTO(Form_Cad.codigo); ClienteBLL cbll = new ClienteBLL(conexao); //Verificar se OK sus_atendimentoTextBox.Text = ate.Ate_id.ToString(); AlterarBotoesSU(3); } else { this.LimpaTelaSU(); this.AlterarBotoesSU(1); } //encerra form Form_Cad.Dispose(); }
private void form_ConsAtendimento_Load(object sender, EventArgs e) { ConexaoDAL conexao = new ConexaoDAL(DadosConexaoDAL.StringDeConexão); AtendimentoBLL bll = new AtendimentoBLL(conexao); dgv_ate.DataSource = bll.PesquisarTodosAtendimentos(); //------CONFIG DO PESQUISAR ------// btnPesquisar_Click(sender, e); //------ DEFINE DGV COR TEXTO E FUNDO----- // this.dgv_ate.DefaultCellStyle.Font = new Font("Verdana", 11); this.dgv_ate.DefaultCellStyle.ForeColor = Color.Black; this.dgv_ate.DefaultCellStyle.BackColor = Color.White; }
private void btnPesquisar_Click(object sender, EventArgs e) { if (cbFiltrarAtendimento.Text == "Pesquisar Todos") { ConexaoDAL conexao = new ConexaoDAL(DadosConexaoDAL.StringDeConexão); AtendimentoBLL bll = new AtendimentoBLL(conexao); dgv_ate.DataSource = bll.PesquisarTodosAtendimentos(); } if (cbFiltrarAtendimento.Text == "Pesquisar por Cliente") { ConexaoDAL conexao = new ConexaoDAL(DadosConexaoDAL.StringDeConexão); AtendimentoBLL bll = new AtendimentoBLL(conexao); ClienteBLL cbll = new ClienteBLL(conexao); // dgv_ate.DataSource = bll.PesquisarNomeCliente(cli_nome); } }
private void BtnSalvar_Click(object sender, EventArgs e) { try { //leitura dos dados AtendimentoDTO ate = new AtendimentoDTO(); ate.Ate_cliente = Convert.ToInt32(ate_clienteTextBox.Text); ate.Ate_animal = Convert.ToInt32(ate_animalComboBox.SelectedValue); // remover depois ate.Ate_medico = Convert.ToInt32(ate_medicoComboBox.SelectedValue); ate.Ate_tipo = Convert.ToInt32(ate_tipoComboBox.SelectedValue); ate.Ate_anamnese = ate_anamneseTextBox.Text; ate.Ate_tratamento = ate_tratamentoTextBox.Text; //obj para gravar dados no bd ConexaoDAL conexao = new ConexaoDAL(DadosConexaoDAL.StringDeConexão); AtendimentoBLL bll = new AtendimentoBLL(conexao); if (this.operacao == "inserir") /// alterar salvar para inserir { bll.Incluir(ate); MessageBox.Show("Cadastrado com Sucesso: Código: " + ate.Ate_id.ToString()); //this.LimpaTela(); pnInfo.Show(); } else { ate.Ate_id = Convert.ToInt32(ate_idTextBox.Text); bll.Alterar(ate); MessageBox.Show("Cadastrado Alterado com Sucesso: Código: " + ate.Ate_id.ToString()); } this.LimpaTela(); this.AlterarBotoes(1); } //try catch (Exception erro) { MessageBox.Show(erro.Message); } }
private void btnExcluir_Click(object sender, EventArgs e) { try { DialogResult d = MessageBox.Show("Deseja excluir o registro?", "Aviso", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { //obj para gravar dados no bd ConexaoDAL conexao = new ConexaoDAL(DadosConexaoDAL.StringDeConexão); AtendimentoBLL bll = new AtendimentoBLL(conexao); bll.Excluir(Convert.ToInt32(ate_idTextBox.Text)); this.LimpaTela(); this.AlterarBotoes(1); } }//try catch { MessageBox.Show("Impossível excluir o registro.\n O registro está sendo utilizado em outro local."); this.AlterarBotoes(3); } }
private void BtnPesquisar_Click(object sender, EventArgs e) { // abre o form dentro do form form_ConsAtendimento Form_Cad = new form_ConsAtendimento(); Form_Cad.ShowInTaskbar = false; Form_Cad.StartPosition = FormStartPosition.CenterParent; Form_Cad.ShowDialog(ActiveForm); if (Form_Cad.codigo != 0) { ConexaoDAL conexao = new ConexaoDAL(DadosConexaoDAL.StringDeConexão); AtendimentoBLL bll = new AtendimentoBLL(conexao); AtendimentoDTO ate = bll.CarregaAtendimentoDTO(Form_Cad.codigo); ClienteBLL cbll = new ClienteBLL(conexao); //Verificar se OK ate_idTextBox.Text = ate.Ate_id.ToString(); ate_clienteTextBox.Text = ate.Ate_cliente.ToString(); ate_animalComboBox.SelectedValue = ate.Ate_animal; // remover depois ate_medicoComboBox.SelectedValue = ate.Ate_medico; ate_tipoComboBox.SelectedValue = ate.Ate_tipo; ate_anamneseTextBox.Text = ate.Ate_anamnese; ate_tratamentoTextBox.Text = ate.Ate_tratamento; AlterarBotoes(3); } else { this.LimpaTela(); this.AlterarBotoes(1); } //encerra form Form_Cad.Dispose(); }
public IActionResult Atendimento(int idPaciente, int idColaborador, string saveBtn, int idSelecionado, string saveBtn2, DateTime dataInicial, DateTime dataFinal, int idTipoProcedimento, string status, int qtdpro) { if (saveBtn2 == "Deletar") { AtendimentoBLL bll = new AtendimentoBLL(); Atendimento a = new Atendimento(); AtendimentoProcedimentosBLL bllap = new AtendimentoProcedimentosBLL(); AtendimentoProcedimentos ap = new AtendimentoProcedimentos(); ap.Id = idSelecionado; ap = bllap.GetById(ap); a = bll.GetById(ap.Atendimento); if (!bll.Delete(a).Contains("!")) { ViewData["result"] = bll.Delete(a); return(View()); } else { ViewData["result"] = bllap.Delete(ap); return(View()); } } if (idSelecionado != 0) { AtendimentoBLL bll = new AtendimentoBLL(); Atendimento a = new Atendimento(); ProcedimentoBLL pbll = new ProcedimentoBLL(); Procedimento procedimento = new Procedimento(); AtendimentoProcedimentosBLL bllap = new AtendimentoProcedimentosBLL(); AtendimentoProcedimentos ap = new AtendimentoProcedimentos(); a.Paciente = new Paciente(); a.Colaborador = new Colaborador(); ap.Id = idSelecionado; ap = bllap.GetById(ap); a = bll.GetById(ap.Atendimento); a.StatusAtendimento = status; a.DtInicioAtendimento = dataInicial; a.DtFinalAtendimento = dataFinal; a.Paciente.Id = idPaciente; a.Colaborador.Id = idColaborador; if (!bll.Update(a).Contains("!")) { ViewData["result"] = bll.Update(a); return(View()); } else { ap.QtdProcedimento = qtdpro; ap.Atendimento = a; ap.Procedimento = new Procedimento(); ap.Procedimento.Id = idTipoProcedimento; ap.Procedimento = pbll.GetById(ap.Procedimento); ViewData["result"] = bllap.Update(ap); return(View()); } } if (saveBtn == "Salvar") { AtendimentoBLL bll = new AtendimentoBLL(); Atendimento a = new Atendimento(); ProcedimentoBLL pbll = new ProcedimentoBLL(); Procedimento procedimento = new Procedimento(); AtendimentoProcedimentosBLL bllap = new AtendimentoProcedimentosBLL(); AtendimentoProcedimentos ap = new AtendimentoProcedimentos(); a.Paciente = new Paciente(); a.Colaborador = new Colaborador(); a.StatusAtendimento = status; a.DtInicioAtendimento = dataInicial; a.DtFinalAtendimento = dataFinal; a.Paciente.Id = idPaciente; a.Colaborador.Id = idColaborador; if (!bll.Insert(a).Contains("!")) { ViewData["result"] = bll.Insert(a); return(View()); } else { ap.QtdProcedimento = qtdpro; ap.Atendimento = bll.GetLastRegister(); ap.Procedimento = new Procedimento(); ap.Procedimento.Id = idTipoProcedimento; ap.Procedimento = pbll.GetById(ap.Procedimento); ViewData["result"] = bllap.Insert(ap); View(); } return(View()); } return(View()); }