public void Limpiar() { TxtNombre1.Clear(); TxtNombre2.Clear(); TxtApellido1.Clear(); TxtApellido2.Clear(); TxtNumeroTarjeta.Clear(); TxtRegistroMedico.Clear(); PctSello.Image = null; Pt_Firma.Image = null; }
public void Limpiar() { TxtNombre1.Clear(); TxtNombre2.Clear(); TxtApellido1.Clear(); TxtApellido2.Clear(); TxtDireccion.Clear(); TxtTelefono.Clear(); PctHuella.Image = null; PctFoto.Image = null; Pt_Firma.Image = null; TxtEdad.Text = ""; DtFechaNacimiento.Value = DateTime.Now.Date; ModoEdicion.Visible = false; }
public void BuscarPaciente_(string Documento_) { string Query = "SELECT [Medic_TipoIdentificacion] " + ",[Medic_Identificacion] " + ",[Medic_Nombre1] " + ",[Medic_Nombre2] " + ",[Medic_Apellido1] " + ",[Medic_Apellido2] " + ",[Medic_Foto] " + ",[Medic_Firma],[Medic_NumeroTarjeta] ,[Medic_RegistroMedico] " + "FROM [dbo].[Medico] " + "WHERE Medic_Identificacion='" + Documento_ + "'"; //WHERE Pac_Identificacion=" + Documento; DataTable tablaPaciente2 = new DataTable(); tablaPaciente2 = ObjServer.LlenarTabla(Query); if (tablaPaciente2.Rows.Count > 0) { Guardar_o_Modificar = false; CboTipoDocumento.SelectedValue = tablaPaciente2.Rows[0]["Medic_TipoIdentificacion"]; TxtNombre1.Text = tablaPaciente2.Rows[0]["Medic_Nombre1"].ToString(); TxtNombre2.Text = tablaPaciente2.Rows[0]["Medic_Nombre2"].ToString(); TxtApellido1.Text = tablaPaciente2.Rows[0]["Medic_Apellido1"].ToString(); TxtApellido2.Text = tablaPaciente2.Rows[0]["Medic_Apellido2"].ToString(); TxtNumeroTarjeta.Text = tablaPaciente2.Rows[0]["Medic_NumeroTarjeta"].ToString(); TxtRegistroMedico.Text = tablaPaciente2.Rows[0]["Medic_RegistroMedico"].ToString(); // El campo productImage primero se almacena en un buffer if (tablaPaciente2.Rows[0]["Medic_Foto"].ToString() != "") { byte[] imageBuffer = (byte[])tablaPaciente2.Rows[0]["Medic_Foto"]; // Se crea un MemoryStream a partir de ese buffer System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBuffer); // Se utiliza el MemoryStream para extraer la imagen this.Pt_Firma.Image = Image.FromStream(ms); } if (tablaPaciente2.Rows[0]["Medic_Firma"].ToString() != "") { byte[] imageBuffer1 = (byte[])tablaPaciente2.Rows[0]["Medic_Firma"]; // Se crea un MemoryStream a partir de ese buffer System.IO.MemoryStream ms1 = new System.IO.MemoryStream(imageBuffer1); // Se utiliza el MemoryStream para extraer la imagen this.PctSello.Image = Image.FromStream(ms1); } } else { Guardar_o_Modificar = true; Limpiar(); if (MessageBox.Show("El Medico no se encuentra ¿Desea crearlo?", "Paciente", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes) { TxtNombre1.Focus(); } else { TxtDocumento.Focus(); TxtDocumento.SelectAll(); } } //tablaPaciente2.Dispose(); }
private void BtnGuardar_Click(object sender, EventArgs e) { //IndicadorOcupado.Visible = true; if (TxtDocumento.Text.Trim() == "") { TxtDocumento.Focus(); MessageBox.Show("Ingrese un numero de documento"); return; } if (TxtNombre1.Text.Trim() == "") { TxtNombre1.Focus(); MessageBox.Show("Ingrese el primer nombre del paciente"); return; } if (TxtApellido1.Text.Trim() == "") { TxtApellido1.Focus(); MessageBox.Show("Ingrese el primer apellido del paciente"); return; } if (Cbo_Municipio.SelectedValue == null) { Cbo_Municipio.Focus(); MessageBox.Show("Seleccionar un municipio"); return; } if (MessageBox.Show("¿Desea " + Accion + " el paciente?", "Continuar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } //se comiensa a guardar los datos del paciente que sera agregado var _Paciente = new Cls_Paciente(); _Paciente.Pac_TipoIdentificacion = new Cls_TipoDocumento { TipoIde_Codigo = CboTipoDocumento.SelectedValue.ToString(), TipoIde_Descripcion = CboTipoDocumento.Text }; _Paciente.Pac_Identificacion = TxtDocumento.Text; _Paciente.Pac_Nombre1 = TxtNombre1.Text; _Paciente.Pac_Nombre2 = TxtNombre2.Text; _Paciente.Pac_Apellido1 = TxtApellido1.Text; _Paciente.Pac_Apellido2 = TxtApellido2.Text; _Paciente.Pac_FechaNacimiento = Convert.ToDateTime(DtFechaNacimiento.Value.ToShortDateString()); _Paciente.Pac_Fecha = Convert.ToDateTime(DtFechaNacimiento.Value.ToShortDateString()); _Paciente.Pac_CodGenero = new Cls_Genero { Gen_Codigo = CboGenero.SelectedValue.ToString(), Gen_Descripcion = CboGenero.Text }; _Paciente.Pac_CodDepto = new Cls_Departamento { Dept_Codigo = Cbo_Departamento.SelectedValue.ToString(), Dept_Nombre = Cbo_Departamento.Text }; _Paciente.Pac_CodCiudad = new Cls_Ciudad { Ciud_Codigo = Cbo_Municipio.SelectedValue.ToString(), Ciud_Nombre = Cbo_Municipio.Text }; _Paciente.Pac_Direccion = TxtDireccion.Text; _Paciente.Pac_CodNivelEducativo = new Cls_NivelEducativo { NivEdu_Codigo = int.Parse(Cbo_NiverEducativo.SelectedValue.ToString()), NivEdu_Descripcion = Cbo_NiverEducativo.Text }; _Paciente.Pac_CodProfesion = new Cls_Profesion { Prof_Codigo = int.Parse(Cbo_Profesion.SelectedValue.ToString()), Prof_Descripcion = Cbo_Profesion.Text }; _Paciente.Pac_TipoSangre = new Cls_TipoSangre { TipSan_Codigo = int.Parse(CboTipoSangre.SelectedValue.ToString()), TipSan_Descripcion = CboTipoSangre.Text }; _Paciente.Pac_EstadoCivil = new Cls_EstadoCivil { EstCivil_Codigo = Convert.ToInt32(CboEstadoCivil.SelectedValue), EstCivil_Descripcion = CboEstadoCivil.Text }; _Paciente.Pac_Telefono = TxtTelefono.Text; _Paciente.Pac_Dominancia_Codigo = new Cls_Dominancia { Dom_Codigo = Convert.ToInt32(CboDominancia.SelectedValue), Dom_Descripcion = CboDominancia.Text }; _Paciente.Pac_CodEPS = new Cls_Eps { Eps_Codigo = Convert.ToInt32(CboEPS.SelectedValue), Eps_Descripcion = CboEPS.Text }; _Paciente.Pac_CodARL = new Cls_Arl { Arl_Codigo = Convert.ToInt32(CboARL.SelectedValue), Arl_Descripcion = CboARL.Text }; string[] fecha = DateTime.Now.ToString().Split(' '); _Paciente.Pac_Fecha = DateTime.Now; if (PctHuella.Image != null) { System.IO.MemoryStream ms1 = new System.IO.MemoryStream(); PctHuella.Image.Save(ms1, System.Drawing.Imaging.ImageFormat.Jpeg); _Paciente.Pac_Huella = ms1; } else { _Paciente.Pac_Huella = null; } if (PctFoto.Image != null) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); PctFoto.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); _Paciente.Pac_Foto = ms; } else { _Paciente.Pac_Foto = null; } if (Pt_Firma.Image != null) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); Pt_Firma.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); _Paciente.Pac_Firma = ms; } else { _Paciente.Pac_Firma = null; } //Fin //Se crea el objeto que contiene los metodos de agregar, actualizar y cargar Oper_Paciente oper_Paciente = new Oper_Paciente(); //Guardar_o_Modificar indica que operacion se va a realizar... True agrega y False actualiza if (Guardar_o_Modificar == true) { //Se agrega el paciente oper_Paciente.Insertar_Paciente(_Paciente); //Confirmamos que la operacion finalizada correctamente para almacenar el paciente en la lista if (oper_Paciente.error == "Datos guardados") { //Se agrega el paciente a la lista Cls_PacienteAgregado.cls_PacienteNuevos.Add(_Paciente); } else { //Si no se finaliza correctamente retornamos al metodo return; } } else { //Actualiza los datos del paciente si es el caso oper_Paciente.Actualizar_Paciente(_Paciente, documentoPaciente); } //Mostramos el mensaje que nos devuelve la clase MessageBox.Show(oper_Paciente.error); //Limpiamos los campos Limpiar(); //Se activa el focus de control del documento TxtDocumento.Focus(); }