public frm_editar_socio(DTO_Socio seleccionado, Form caller) { InitializeComponent(); this.seleccionado = seleccionado; service = new Service_socio(); this.caller = caller; }
private void btn_guardar_pagar_Click(object sender, EventArgs e) { bool retorno = false; Support support = Support.GetSupport(); if (validarCampos() != null) { MessageBox.Show("Ha dejado el campo " + validarCampos() + " vacio", "Atencion", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (support.esUnNumeroSinAdvertencia(txt_dni.Text) == true && support.esUnNumeroSinAdvertencia(txt_celular.Text) == true && support.esUnNumeroSinAdvertencia(txt_telefono.Text) == true && support.esUnNumeroSinAdvertencia(txt_telefono.Text) == true) { DTO_Socio dto = new DTO_Socio(); dto.Nombre = txt_nombre.Text; dto.Apellido = txt_apellido.Text; dto.Dni = txt_dni.Text; dto.Email = txt_mail.Text; dto.Celular = txt_celular.Text; dto.Telefono = txt_telefono.Text; dto.HoraInicio = combo_inicio.SelectedItem.ToString(); dto.HoraFin = combo_fin.SelectedItem.ToString(); DateTime inicio = dtp_fecha_inicio.Value; DateTime fin = dtp_fecha_vto.Value; double monto = Convert.ToDouble(txt_monto_pagar.Text); retorno = (service.registrarSocioConPago(dto, monto, inicio, fin) > 0); if (retorno == true) { IForm frm_p = principal as IForm; IForm frm_ps = subPrincipal as IForm; if (frm_p != null && frm_ps != null) { frm_p.actualizarDatos(); frm_ps.actualizarDatos(); } MessageBox.Show("Socio registrado con exito", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); if (support.guardarFoto(pic_socio.Image, txt_nombre.Text + "_" + txt_apellido.Text) == false) { MessageBox.Show("Error al guardar la foto", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.limpiarCampos(); } else { MessageBox.Show("Hubo un problema al registrar al socio, intente nuevamente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.limpiarCampos(); } } else { MessageBox.Show("Hay un problema con alguno de los formatos de los campos", "Atencion", MessageBoxButtons.OK, MessageBoxIcon.Error); this.limpiarCampos(); } } }
private void btn_eliminar_Click(object sender, EventArgs e) { if (dgv_socios.CurrentRow != null) { int id = Convert.ToInt32(dgv_socios.CurrentRow.Cells["col_nro"].Value.ToString()); DTO_Socio dto = svSocio.getSocio(id); Form eliminar = new frm_eliminar_socio(dto, this); eliminar.ShowDialog(); } else { MessageBox.Show("No selecciono ningun socio", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dgv_horarios_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (dgv_horarios.CurrentRow != null) { int id = Convert.ToInt32(dgv_horarios.CurrentRow.Cells["col_socio"].Value.ToString()); DTO_Socio dto = service.getSocio(id); if (dto != null) { Form editarVer = new frm_editar_socio(dto, caller, this); editarVer.ShowDialog(); } else { MessageBox.Show("Error al cargar los datos del socio", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("No selecciono ningun socio", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public frm_editar_socio(DTO_Socio seleccionado) { InitializeComponent(); this.seleccionado = seleccionado; service = new Service_socio(); }
private void btn_guardar_Click(object sender, EventArgs e) { if (!String.IsNullOrWhiteSpace(txt_nombre.Text) && !String.IsNullOrWhiteSpace(txt_apellido.Text) && check_editar.Checked == true) { DTO_Socio dto = new DTO_Socio(); dto.NumeroSocio = seleccionado.NumeroSocio; dto.Nombre = txt_nombre.Text; dto.Apellido = txt_apellido.Text; dto.Dni = txt_dni.Text; dto.Email = txt_mail.Text; dto.Telefono = txt_telefono.Text; dto.Celular = txt_celular.Text; if (combo_inicio.SelectedIndex != -1 && combo_fin.SelectedIndex != -1) { dto.HoraInicio = combo_inicio.SelectedItem.ToString(); dto.HoraFin = combo_fin.SelectedItem.ToString(); DialogResult resultado = MessageBox.Show("¿Desea modificar los datos del socio?", "Alerta!!!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resultado == DialogResult.Yes) { bool control = service.modificarSocio(dto); if (control == true) { MessageBox.Show("Se aplicaron los cambios con exito", "Atencion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); if (support.guardarFoto(pic_socio.Image, txt_nombre.Text + "_" + txt_apellido.Text) == false) { MessageBox.Show("Error al guardar la foto", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } var aux = main as IForm; var aux2 = caller as IForm; if (aux != null) { aux.actualizarDatos(); } if (aux2 != null) { aux2.actualizarDatos(); } } else { MessageBox.Show("Hubo un error al modificar los datos, intente nuevamente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); llenarCampos(); this.DialogResult = DialogResult.None; } } { this.DialogResult = DialogResult.None; } } else { MessageBox.Show("Horario de Inicio o Fin no esta seleccionado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.DialogResult = DialogResult.None; } } else { MessageBox.Show("El campo nombre o apellido se encuentra vacio", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public frm_eliminar_socio(DTO_Socio dto, Form subPrincipal) { this.subPrincipal = subPrincipal; seleccionado = dto; InitializeComponent(); }
public bool modificarSocio(DTO_Socio dto) { return(dao.modificarSocio(mapSocio.getSocio(dto)) == 1); }
public int registrarSocioConPago(DTO_Socio dto, double monto, DateTime inicio, DateTime fin) { return(dao.registrarSocioConPago(mapSocio.getSocio(dto), monto, inicio, fin)); }
public int registrarSocio(DTO_Socio dto) { return(dao.registrarSocio(mapSocio.getSocio(dto))); }