private void btnEliminar_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtExpediente.Text.Trim())) { ErrorDatos.SetError(txtExpediente, "No ha elegido \nningun pacinte"); } else { bool ResultadoOK = false; string mensajeError = ""; objPaciente = new clFachadaPaciente(); try { objPaciente.EliminarPaciente(Convert.ToInt32(txtExpediente.Text), 1, ref ResultadoOK, ref mensajeError); } catch (Exception error) { MessageBox.Show(error.Message.ToString()); } if (ResultadoOK) { MessageBox.Show("Paciente Elimnado con exito \n\n En cualquier momento puede restaurar el paciente "); Efecto.LimpiarForm(this); } else { MessageBox.Show("Paciente no Eliminado"); } } }
private void btnEliminar_Click(object sender, EventArgs e) { if (dgvResultadoBusquedaP.SelectedRows.Count == 1) { clFachadaPaciente objPaciente = new clFachadaPaciente(); bool ResultadoOK = false; string mensajeError = ""; try { int Pa_ID = Convert.ToInt32(dgvResultadoBusquedaP.SelectedRows[0].Cells["colNoExp"].Value); objPaciente.EliminarPaciente(Convert.ToInt32(Pa_ID), 1, ref ResultadoOK, ref mensajeError); } catch (Exception error) { MessageBox.Show(error.Message.ToString()); } if (ResultadoOK) { MessageBox.Show("Paciente Elimnado con exito \n\n En cualquier momento puede restaurar el paciente "); ucBusquedaP_Load(sender, e); } else { MessageBox.Show("Paciente no Eliminado"); } } else { // ErrorDatos.SetError(txtExpediente, "No ha elegido \nningun pacinte"); } }
private void butSoloGuardarP_Click(object sender, EventArgs e) { if (Efecto.ValidarFormulario(this, ErrorDatos) == false) { objPaciente = new clFachadaPaciente(); string Pa_Cedula; int Pa_ID = 0; int Domi_ID = 0; if (string.IsNullOrEmpty(txtExpediente.Text.Trim())) { Pa_ID = 0; Domi_ID = 0; } else { try { Pa_ID = Convert.ToInt32(txtExpediente.Text); Domi_ID = Convert.ToInt32(txtDomi_ID.Text); } catch { Pa_ID = 0; Domi_ID = 0; } } string Pa_Nombre = txtNombre.Text; string Pa_Apellido = txtApellido.Text; int Gen_ID = Convert.ToInt32(cbbGenero.SelectedValue); DateTime Pa_FechaNac = Convert.ToDateTime(dtpFechNaci.Text); if (string.IsNullOrEmpty(txtCedula.Text)) { Pa_Cedula = null; } else { Pa_Cedula = txtCedula.Text; } int Est_ID = Convert.ToInt32(cbbEstadoCivil.SelectedValue); string Pa_Telefono = txtTelefono.Text; string Pa_Celular = txtCelular.Text; string Pa_Email = txtEmail.Text; int TP_ID = Convert.ToInt32(cbbTipoPaciente.SelectedValue); int Zo_ID = Convert.ToInt32(cbbZona.SelectedValue); string Sector = txtSector.Text; string Calle = txtCalle.Text; string Numero = txtNumero.Text; int ciudad_ID = Convert.ToInt32(cbbCiudad.SelectedValue); bool ResultadoOk = false; string MensajeError = ""; objPaciente.Registrar(ref Pa_ID, Pa_Nombre, Pa_Apellido, Gen_ID, Pa_FechaNac, Pa_Cedula, Est_ID, Pa_Telefono, Pa_Celular, Pa_Email, TP_ID, Zo_ID, Domi_ID, Sector, Calle, Numero, ciudad_ID, ref ResultadoOk, ref MensajeError); if (ResultadoOk) { if (string.IsNullOrEmpty(txtExpediente.Text.Trim())) { MessageBox.Show("Paciente Guardado", "Notificacion", MessageBoxButtons.OK, MessageBoxIcon.Information); txtExpediente.Text = Pa_ID.ToString(); } else { MessageBox.Show("Paciente Actualizado", "Notificacion", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show(MensajeError, "Notificacion", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { } }