public void listado_fechaAdopcion() { List<FichaAdopcion> lista = new NFichaAdopcion().N_ListaFichaAdopcion(); this.grilla_fichaAdopcion.Rows.Clear(); for (int i = 0; i < lista.Count; i++) { int reglon = this.grilla_fichaAdopcion.Rows.Add(); this.grilla_fichaAdopcion.Rows[reglon].Cells["ID"].Value = lista[i].Id; this.grilla_fichaAdopcion.Rows[reglon].Cells["ID_PERSONA"].Value = lista[i].Persona.Id; this.grilla_fichaAdopcion.Rows[reglon].Cells["SERIE"].Value = lista[i].Usuario.Serie; this.grilla_fichaAdopcion.Rows[reglon].Cells["Codigo_usuario"].Value = lista[i].Usuario.Codigo; this.grilla_fichaAdopcion.Rows[reglon].Cells["Voluntario"].Value = lista[i].Usuario.Nombres + " " + lista[i].Usuario.Apellidos; this.grilla_fichaAdopcion.Rows[reglon].Cells["DNI_ADOPTANTE"].Value = lista[i].Persona.Dni; this.grilla_fichaAdopcion.Rows[reglon].Cells["Adoptante"].Value = lista[i].Persona.Nombre + " " + lista[i].Persona.Apellidos; this.grilla_fichaAdopcion.Rows[reglon].Cells["Relacion"].Value = lista[i].Rel_res; this.grilla_fichaAdopcion.Rows[reglon].Cells["Observaciones"].Value = lista[i].Observaciones; this.grilla_fichaAdopcion.Rows[reglon].Cells["Fecha"].Value = lista[i].Fec_adp.ToShortDateString(); } }
private void btn_registrar_ficha_Click(object sender, EventArgs e) { String relacion = ""; String observa_ficha = ""; Usuario voluntario = (Usuario)combo_voluntarios.SelectedItem; Persona persona = (Persona)combo_persona.SelectedItem; if (!String.IsNullOrEmpty(text_relacion.Text)) { relacion = text_relacion.Text; } if (!String.IsNullOrEmpty(text_observacion_ficha.Text)) { observa_ficha = text_observacion_ficha.Text; } DateTime fecha_adopcion = Convert.ToDateTime(fech_adopcion.Text); int respuesta = new NFichaAdopcion().N_asignar_adopcion(persona, voluntario, relacion, observa_ficha, fecha_adopcion); if (respuesta == 0) { MessageBox.Show("Error Al Registrar Por favor intente nuevamente"); } else { MessageBox.Show("Registrado Correctamente"); int id_ficha_adopcion = new NFichaAdopcion().N_maxima_FichaAdopcion(); lb_id_ficha.Text = "" + id_ficha_adopcion; inhabilitar_cajas_ficha(); btn_agregar_mascota.Enabled = true; habilitar_cajas_mascota(); limpiar_cajas_mascota(); btn_registrar_ficha.Enabled = false; btn_nueva_ficha.Enabled = false; btn_listar_ficha.Enabled = false; btn_nuevo_mascota.Enabled = true; } }
private void btn_editar_ficha_Click(object sender, EventArgs e) { if (this.btn_editar_ficha.Text.Equals("Editar Ficha Adopcion")) { btn_editar_ficha.Text = "Guardar Cambios"; btn_nueva_ficha.Enabled = true; btn_eliminar_ficha.Enabled =false; btn_cancelar_ficha.Enabled = true; btn_registrar_ficha.Enabled = false; combo_persona.Enabled = true; combo_voluntarios.Enabled = true; habilitar_cajas_ficha(); }else{ if (btn_editar_ficha.Text.Equals("Guardar Cambios")) { btn_modificar_mascota.Text = "Editar Ficha Adopcion"; int id_ficha_adopcion = Convert.ToInt32(lb_id_ficha.Text); String relacion = ""; String observa_ficha = ""; Usuario voluntario = (Usuario)combo_voluntarios.SelectedItem; Persona persona = (Persona)combo_persona.SelectedItem; if (!String.IsNullOrEmpty(text_relacion.Text)) { relacion = text_relacion.Text; } if (!String.IsNullOrEmpty(text_observacion_ficha.Text)) { observa_ficha = text_observacion_ficha.Text; } DateTime fecha_adopcion = Convert.ToDateTime(fech_adopcion.Text); int respuesta = new NFichaAdopcion().N_modificar_adopcion(id_ficha_adopcion, persona, voluntario, relacion, observa_ficha, fecha_adopcion); if (respuesta == 0) { MessageBox.Show("Error Al Guardar los Cambios Por favor intente nuevamente"); } else { MessageBox.Show("Cambios guardados correctamente"); inhabilitar_cajas_ficha(); limpiar_cajas_mascota(); btn_editar_ficha.Enabled = false; btn_nueva_ficha.Enabled = true; btn_registrar_ficha.Enabled = false; btn_eliminar_ficha.Enabled = false; } } } }
public void ver_DatosFichaAdopcion(int id) { Console.Write("id es : " + id); lb_id_ficha.Text = ""+id; FichaAdopcion ficha = new NFichaAdopcion().D_BuscarFichaAdopcionxID(id); Usuario usuario = ficha.Usuario; Persona persona = ficha.Persona; for (int i = 0; i < combo_persona.Items.Count; i++) { Persona per = (Persona)combo_persona.Items[i]; if (per.Id == persona.Id) { combo_persona.SelectedIndex = i; break; } } for (int i = 0; i < combo_voluntarios.Items.Count; i++) { Usuario usu = (Usuario)combo_voluntarios.Items[i]; if (usu.Serie == usuario.Serie) { combo_voluntarios.SelectedIndex = i; break; } } text_relacion.Text = ficha.Rel_res; text_observacion_ficha.Text = ficha.Observaciones; fech_adopcion.Text = ficha.Fec_adp.ToString(); btn_editar_ficha.Enabled = true; }
private void text_buscar_fichaAdopcion_KeyUp(object sender, KeyEventArgs e) { List<FichaAdopcion> lista = new NFichaAdopcion().N_ListaFichaAdopcion(); var filtro = from FichaAdopcion in lista where FichaAdopcion.Usuario.Serie.ToString().ToUpper().Contains(text_buscar_fichaAdopcion.Text.ToUpper()) || FichaAdopcion.Usuario.Codigo.ToString().ToUpper().Contains(text_buscar_fichaAdopcion.Text.ToUpper()) || FichaAdopcion.Usuario.Nombres.ToString().ToUpper().Contains(text_buscar_fichaAdopcion.Text.ToUpper()) || FichaAdopcion.Usuario.Apellidos.ToString().ToUpper().Contains(text_buscar_fichaAdopcion.Text.ToUpper()) || FichaAdopcion.Persona.Nombre.ToString().ToUpper().Contains(text_buscar_fichaAdopcion.Text.ToUpper()) || FichaAdopcion.Persona.Apellidos.ToString().ToUpper().Contains(text_buscar_fichaAdopcion.Text.ToUpper()) || FichaAdopcion.Persona.Dni.ToString().ToUpper().Contains(text_buscar_fichaAdopcion.Text.ToUpper()) || FichaAdopcion.Rel_res.ToString().ToUpper().Contains(text_buscar_fichaAdopcion.Text.ToUpper()) || FichaAdopcion.Observaciones.ToString().ToUpper().Contains(text_buscar_fichaAdopcion.Text.ToUpper()) || FichaAdopcion.Fec_adp.ToShortDateString().ToUpper().Contains(text_buscar_fichaAdopcion.Text.ToUpper()) select FichaAdopcion; lista = filtro.ToList<FichaAdopcion>(); this.grilla_fichaAdopcion.Rows.Clear(); for (int i = 0; i < lista.Count; i++) { int reglon = this.grilla_fichaAdopcion.Rows.Add(); this.grilla_fichaAdopcion.Rows[reglon].Cells["ID"].Value = lista[i].Id; this.grilla_fichaAdopcion.Rows[reglon].Cells["ID_PERSONA"].Value = lista[i].Persona.Id; this.grilla_fichaAdopcion.Rows[reglon].Cells["SERIE"].Value = lista[i].Usuario.Serie; this.grilla_fichaAdopcion.Rows[reglon].Cells["Codigo_usuario"].Value = lista[i].Usuario.Codigo; this.grilla_fichaAdopcion.Rows[reglon].Cells["Voluntario"].Value = lista[i].Usuario.Nombres + " " + lista[i].Usuario.Apellidos; this.grilla_fichaAdopcion.Rows[reglon].Cells["DNI_ADOPTANTE"].Value = lista[i].Persona.Dni; this.grilla_fichaAdopcion.Rows[reglon].Cells["Adoptante"].Value = lista[i].Persona.Nombre + " " + lista[i].Persona.Apellidos; this.grilla_fichaAdopcion.Rows[reglon].Cells["Relacion"].Value = lista[i].Rel_res; this.grilla_fichaAdopcion.Rows[reglon].Cells["Observaciones"].Value = lista[i].Observaciones; this.grilla_fichaAdopcion.Rows[reglon].Cells["Fecha"].Value = lista[i].Fec_adp.ToShortDateString(); } }