private void frmTurnos_Load(object sender, EventArgs e) { if (id == 1) { this.btnAusente.Enabled = false; this.btnPresente.Enabled = false; } try { this.row = -1; this.tabla = new DataTable("Turnos"); dtpFecha.Value = DateTime.Now; MedicoNegocio MN = new MedicoNegocio(); cbxMedico.DataSource = MN.ListarMedicos(); // this.btnHistoriaClinica.Enabled = false; // this.btnPresente.Enabled = false; // this.btnAusente.Enabled = false; // this.dgvTurnos.Enabled = false; if (cbxMedico.Items.Count > 0) { cbxMedico.SelectedIndex = 0; } }catch (Exception ex) { return; } }
public void cargarGrilla() { MedicoNegocio negocio = new MedicoNegocio(); try { //// ACA MANEJAMOS LA LISTA DE LOS MEDICOS , TODOS LOS CAMPOS Y ESO. ECT ///// ME TIRA TODO DESPUES RESTRINGIR EN CADA CASO. listaLocal = negocio.listarMedicos(); dgv_medicos.DataSource = listaLocal; //dgv_medicos.Columns[0].Visible =false; //dgv_medicos.Columns[1].Visible = false; //dgv_medicos.Columns[2].Visible = false; //dgv_medicos.Columns[3].Visible = false; //dgv_medicos.Columns[4].Visible = false; //dgv_medicos.Columns[5].Visible = false; //dgv_medicos.Columns[6].Visible = false; //DNI //dgv_medicos.Columns[7].Visible = false; //DIRECCION //dgv_medicos.Columns[8].Visible = false; //EMAIL } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void button1_Click(object sender, EventArgs e) { MedicoNegocio negocio = new MedicoNegocio(); try { if (dgvMedicos.SelectedRows.Count > 0) { if (MessageBox.Show("Está seguro de que desea eliminar el registro?", "Confirmacion", MessageBoxButtons.YesNo) == DialogResult.Yes) { //unGestorClientes.eliminarLogico((int)dgwClientes.CurrentRow.Cells[0].Value); negocio.eliminarLogico((int)dgvMedicos.CurrentRow.Cells[0].Value); MessageBox.Show("Cliente eliminado"); CargarMedicos(); } } else { MessageBox.Show("Debe seleccionar un registro"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void button1_Click(object sender, EventArgs e) { MedicoNegocio negocio = new MedicoNegocio(); try { if (medicolocal == null) { medicolocal = new Medicos(); } medicolocal.Direcc = new Direccion(); // medicolocal.IdMedico = int.Parse(textBox3.Text); medicolocal.Nombre = txbNombre.Text.Trim(); medicolocal.Apellido = txbApellido.Text.Trim(); medicolocal.DNI = txtDNI.Text.Trim(); medicolocal.Especialidad = (Especialidades)cbxEspecialidad.SelectedItem; medicolocal.FechaNacimiento = Nacimiento.Value; medicolocal.Email = txbEmail.Text.Trim(); if (rbtMasculino.Checked == true) { medicolocal.Sexo = "M"; } else { medicolocal.Sexo = "F"; } medicolocal.Telephone = txbTelefono.Text.Trim(); medicolocal.matricula = txbMatricula.Text.Trim(); medicolocal.TipoTel = (string)comboBoxTipoTel.SelectedItem; medicolocal.Direcc.Localidad = txbLocalidad.Text.Trim(); medicolocal.Direcc.CodigoPostal = txbCP.Text.Trim(); medicolocal.Direcc.Calle = txbDomicilio.Text.Trim(); medicolocal.Direcc.Provincia = (string)comboBoxPROV.SelectedItem; if (medicolocal.IdMedico != 0) { negocio.modificarMedico(medicolocal); MessageBox.Show("Modificado Correctamente :)"); } else { negocio.AgregarMedicos(medicolocal); MessageBox.Show("Agregado Correctamente"); } Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void CargarEspecialidad(ref Medico medico) { MedicoNegocio MN = new MedicoNegocio(); cbxEspecialidad.DataSource = MN.EspeMedico(medico.dni); if (cbxEspecialidad.Items.Count > 0) { cbxEspecialidad.SelectedIndex = 0; } this.Espe = (Especialidad)cbxEspecialidad.SelectedItem; }
public void CadastrarMedico() { Medico medico = new Medico(); MedicoNegocio medicoNegocio = new MedicoNegocio(); medico.nome = txtNome.Text; medico.rg = txtRG.Text; medico.cpf = txtCPF.Text; if (rbMasculino.Checked == true) { medico.sexo = '1'; } else if (rbFeminino.Checked == true) { medico.sexo = '2'; } else { medico.sexo = '3'; } medico.crm = txtCRM.Text; medico.nascimento = dtpNascimento.Value; medico.idade = Convert.ToInt32(txtIdade.Text); medico.endereco = txtEndereco.Text; medico.cep = txtCEP.Text; medico.cidade = txtCidade.Text; medico.bairro = txtBairro.Text; medico.estado = cboEstado.Text; medico.telefone = txtTelefone.Text; medico.celular = txtTelefoneCelular.Text; medico.email = txtEmail.Text; bool retorno = medicoNegocio.InserirMedico(medico); if (retorno == true) { MessageBox.Show("Médico inserido com sucesso.", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information); LimparDados(); } else { MessageBox.Show("Não foi possível inserir médico.", "Falha ao inseri médico", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void AgregarEspe(int id, string costo) { MedicoNegocio MN = new MedicoNegocio(); if (MN.AgregarEspe(txbDni.Text.Trim(), id, costo) == false) { MessageBox.Show("Error al Agregar Especialidad"); return; } cbxEspecialidad.DataSource = MN.EspeMedico(txbDni.Text.Trim()); if (cbxEspecialidad.Items.Count > 0) { cbxEspecialidad.SelectedIndex = 0; } }
public void CargarMedicos() { MedicoNegocio negocio = new MedicoNegocio(); listaLocal = negocio.listarMedicos(); dgvMedicos.DataSource = listaLocal; dgvMedicos.Columns[0].Visible = false; dgvMedicos.Columns[1].Visible = false; // dgvMedicos.Columns[2].Visible = false; //dgv_medicos.Columns[3].Visible = false; //dgv_medicos.Columns[4].Visible = false; // dgvMedicos.Columns[5].Visible = false; //dgv_medicos.Columns[6].Visible = false; //DNI //dgvMedicos.Columns[7].Visible = false; //DIRECCION //dgvMedicos.Columns[8].Visible = false; //EMAIL }
private void frmTurnos_Load(object sender, EventArgs e) { try { this.row = -1; this.tabla = new DataTable("Turnos"); dtpFecha.Value = DateTime.Now; MedicoNegocio MN = new MedicoNegocio(); cbxMedico.DataSource = MN.ListarMedicos(); if (cbxMedico.Items.Count > 0) { cbxMedico.SelectedIndex = 0; } }catch (Exception ex) { return; } }
/// <summary> /// /// </summary> public MedicoController() { _medicoNegocio = new MedicoNegocio(); }
private void btnAceptarEspe_Click(object sender, EventArgs e) { if (this.Operacion == 1) //Modificar { if (!this.ValidarNumero(tbxCosto.Text, "Costo")) { return; } Espe = (Especialidad)this.cbxEspecialidad.SelectedItem; EspeAux = Espe.nombre; MedicoNegocio MN = new MedicoNegocio(); if (chbBajaDef.Checked == true) { Espe.estado = 0; } else { Espe.estado = 1; } if (MN.ModificarEspe(txbDni.Text.Trim(), Espe.id, float.Parse(tbxCosto.Text), Espe.estado) == false) { MessageBox.Show("Error al Modificar la Especialidad"); return; } MessageBox.Show("Modificación realizada"); cbxEspecialidad.DataSource = null; cbxEspecialidad.Text = ""; tbxCosto.Text = "0"; cbxEspecialidad.DataSource = MN.EspeMedico(txbDni.Text.Trim()); for (int i = 0; i < cbxEspecialidad.Items.Count; i++) { Especialidad aux = (Especialidad)cbxEspecialidad.Items[i]; if (aux.nombre == EspeAux) { cbxEspecialidad.SelectedIndex = i; break; } } } if (this.Operacion == 2) // Baja { if (this.cbxEspecialidad.Items.Count < 1) { return; } if (this.medico == null) { return; } if (this.medico.dni.Length < 1) { return; } if (chbBajaEsp.Checked == true) { MessageBox.Show("Especialidad con baja registrada!!!"); } else { Espe = (Especialidad)this.cbxEspecialidad.SelectedItem; EspeAux = Espe.nombre; MedicoNegocio MN = new MedicoNegocio(); if (MN.EliminarEspe(txbDni.Text.Trim(), Espe.id) == false) { MessageBox.Show("Error al Eliminar la Especialidad"); return; } MessageBox.Show("Baja Realizada"); //cbxEspecialidad.DataSource = null; //cbxEspecialidad.Text = ""; //tbxCosto.Text = "0"; cbxEspecialidad.DataSource = MN.EspeMedico(txbDni.Text.Trim()); for (int i = 0; i < cbxEspecialidad.Items.Count; i++) { Especialidad aux = (Especialidad)cbxEspecialidad.Items[i]; if (aux.nombre == EspeAux) { cbxEspecialidad.SelectedIndex = i; break; } } } } this.btnBuscar.Enabled = true; this.btnModificar.Enabled = true; this.lklActualizarHorarios.Enabled = true; this.btnAceptarEspe.Visible = false; this.btnCancelarEspe.Visible = false; // this.cbxEspecialidad.Enabled = false; this.tbxCosto.Enabled = false; this.chbBajaEsp.Enabled = false; this.cbxEspecialidad.Enabled = true; this.llbAgregarEspecialidad.Enabled = true; this.linkLabel1.Enabled = true; this.linkLabel2.Enabled = true; }
private void btnAceptar_Click(object sender, EventArgs e) { this.btnAceptar.Visible = false; this.btnCancelar.Visible = false; this.btnBuscar.Enabled = true; if (Operacion == 1) // Buscar { cbxEspecialidad.DataSource = null; cbxEspecialidad.Text = ""; tbxCosto.Text = "0"; if (!ValidarNumero(this.txbDni.Text.ToString(), "Documento")) { this.btnAceptar.Visible = true; this.btnCancelar.Visible = true; this.btnBuscar.Enabled = false; return; } this.medico = new Medico(); MedicoNegocio mediconegocio = new MedicoNegocio(); mediconegocio.Leer(this.txbDni.Text.Trim(), ref medico); if (medico.matricula == 0) { MessageBox.Show("Profesional NO Registrado"); this.medico = null; this.btnAceptar.Visible = true; this.btnCancelar.Visible = true; return; } this.groupBox1.Enabled = true; if (id == 2) { this.btnModificar.Enabled = true; this.llbAgregarEspecialidad.Enabled = true; this.lklActualizarHorarios.Enabled = true; this.btnAgregar.Enabled = true; } this.tbxCosto.Enabled = false; this.chbBajaEsp.Enabled = false; this.txbDni.Enabled = false; CargarPantalla(medico); CargarEspecialidad(ref medico); } if (Operacion == 2) //Modificar { MedicoNegocio medicoNegocio; int auxiliar; if (!ValidarCampos()) { CargarPantalla(medico); Deshabilitar_Campos(); this.lklActualizarHorarios.Enabled = true; this.llbAgregarEspecialidad.Enabled = true; this.btnAgregar.Enabled = true; this.btnModificar.Enabled = true; this.groupBox1.Enabled = true; this.tbxCosto.Enabled = false; this.chbBajaEsp.Enabled = false; return; } else { medico = new Medico(); medico.dni = this.txbDni.Text.ToString(); int.TryParse(this.txbMatricula.Text.ToString(), out auxiliar); medico.matricula = auxiliar; medico.nombre = this.txbNombre.Text.ToUpper(); medico.apellido = this.txbApellido.Text.ToUpper(); medico.telefono = this.txbTelefono.Text.ToUpper(); medico.mail = this.txbMail.Text.ToUpper(); if (this.rbnFem.Checked == true) { medico.sexo = 'F'; } if (this.rbnMasc.Checked == true) { medico.sexo = 'M'; } if (this.rbnOtros.Checked == true) { medico.sexo = 'O'; } medico.desde = this.dtpBaja.Value; medico.hasta = this.dtpReinc.Value; if (this.chbBajaDef.Checked == true) { medico.estado = 0; } else { medico.estado = 1; } medicoNegocio = new MedicoNegocio(); if (medicoNegocio.Escribir(medico) == false) { MessageBox.Show("Error al Modificar"); } Deshabilitar_Campos(); this.groupBox1.Enabled = true; this.tbxCosto.Enabled = false; this.chbBajaEsp.Enabled = false; this.btnModificar.Enabled = true; this.btnAgregar.Enabled = true; this.lklActualizarHorarios.Enabled = true; } } if (Operacion == 3) //Agregar { MedicoNegocio medicoNegocio; int auxiliar; if (!ValidarCampos()) { this.btnModificar.Enabled = false; this.btnBuscar.Enabled = false; this.btnAgregar.Enabled = false; this.btnAceptar.Visible = true; this.btnCancelar.Visible = true; return; } else { medico = new Medico(); medico.dni = this.txbDni.Text.ToString(); int.TryParse(this.txbMatricula.Text.ToString(), out auxiliar); medico.matricula = auxiliar; medico.nombre = this.txbNombre.Text.ToUpper(); medico.apellido = this.txbApellido.Text.ToUpper(); medico.telefono = this.txbTelefono.Text.ToUpper(); medico.mail = this.txbMail.Text.ToUpper(); if (this.rbnFem.Checked == true) { medico.sexo = 'F'; } if (this.rbnMasc.Checked == true) { medico.sexo = 'M'; } if (this.rbnOtros.Checked == true) { medico.sexo = 'O'; } medico.desde = this.dtpBaja.Value; medico.hasta = this.dtpReinc.Value; medicoNegocio = new MedicoNegocio(); if (medicoNegocio.Agregar(medico) == false) { MessageBox.Show("El Médico ya Existe"); Limpiar_Campos(); this.btnModificar.Enabled = false; this.cbxEspecialidad.Enabled = false; } Deshabilitar_Campos(); this.btnAceptar.Visible = false; this.btnCancelar.Visible = false; this.lklActualizarHorarios.Enabled = false; this.tbxCosto.Enabled = false; this.chbBajaEsp.Enabled = false; this.linkLabel1.Enabled = false; this.linkLabel2.Enabled = false; this.llbAgregarEspecialidad.Enabled = true; this.btnAgregar.Enabled = true; this.btnModificar.Enabled = true; } } }