private void btnIngresar_Click(object sender, EventArgs e) { if (txtUser.Text.Equals("") || txtPassword.Text.Equals("")) { frmMensaje mensaje = new frmMensaje("Ingresar usuario y/o contraseña", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return; } } else { Service.colaborador colaborador = verificarCampos(); if (colaborador != null) { colaborador.intentos = 0; Program.dbController.actualizarColaborador(colaborador); if (colaborador.tipo.nombre.Equals("Administracion")) { frmPrincipal Principal = new frmPrincipal(colaborador); Principal.Show(); this.Hide(); } else if (colaborador.tipo.nombre.Equals("Secretaria")) { frmPrincipalSec Principal = new frmPrincipalSec(colaborador); Principal.Show(); this.Hide(); } } } }
public bool verificarCampos() { int i; if (txtTelefono.Text.Equals("") || txtDireccion.Text.Equals("") || txtDistrito.Text.Equals("")) { frmMensaje mensaje = new frmMensaje("Todos los campos son obligatorios", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (!int.TryParse(txtTelefono.Text, out i)) { frmMensaje mensaje = new frmMensaje("Telefono debe ser numerico", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (txtTelefono.Text.Length < 7) { frmMensaje mensaje = new frmMensaje("Tamaño minimo de 7 numeros en el campo Telefono", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } return(true); }
public bool verificarCampos() { float i; if (txtNombreServicio.Text.Equals("") || txtDescripcion.Text.Equals("") || txtPrecio.Text.Equals("") || txtDireccion.Text.Equals("") || cboDistrito.SelectedIndex == -1) { frmMensaje mensaje = new frmMensaje("Todos los campos son obligatorios", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (float.TryParse(txtPrecio.Text, out i)) { if (i <= 0) { frmMensaje mensaje = new frmMensaje("El precio debe ser mayor a cero", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } } else { frmMensaje mensaje = new frmMensaje("TDebe ingresar un precio válido", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (dtpHoraIni.Value > dtpHoraFin.Value) { frmMensaje mensaje = new frmMensaje("El horario tiene una hora de inicio mayor a la hora final", "Error de Servicio", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } int horaIni = dtpHoraIni.Value.Hour * 100 + dtpHoraIni.Value.Minute; int horaFin = dtpHoraFin.Value.Hour * 100 + dtpHoraFin.Value.Minute; if (horaFin - horaIni > 300 | horaFin - horaIni < 130) { frmMensaje mensaje = new frmMensaje("La duración de la clase particular debe ser de mínimo 2hrs y máximo 3 hrs", "Error de Servicio", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } return(true); }
public bool verificarCampos() { if (txtClinica.Text.Equals("") || txtMedico.Text.Equals("")) { frmMensaje mensaje = new frmMensaje("Complete los datos obligatorios", "Error de CAMPOS", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } return(true); }
public bool verificarCampos() { if (txtDescripcion.Text.Equals("") || txtNombreCondicion.Text.Equals("")) { frmMensaje mensaje = new frmMensaje("Complete los campos obligatorios", "Error de CAMPOS", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } return(true); }
public bool verificarCampos() { if (txtDNIBebe.Text.Equals("") || txtNombre.Text.Equals("") || cboRelacion.SelectedIndex == -1 || (rbMasculino.Checked == false && rbFemenino.Checked == false)) { frmMensaje mensaje = new frmMensaje("Complete los campos obligatorios", "Error de CAMPOS", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } return(true); }
public bool verificarCampos() { int i; if (txtNombre.Text.Equals("") || txtDNI.Text.Equals("") || txtCorreo.Text.Equals("") || txtTelefono.Text.Equals("") || (rbFemenino.Checked == false && rbMasculino.Checked == false) || cboTipo.SelectedIndex == -1 || txtDireccion.Text.Equals("")) { frmMensaje mensaje = new frmMensaje("Complete los campos obligatorios", "Error de CAMPOS", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (txtTelefono.Text.Length < 7 || txtTelefono.Text.Length == 8) { frmMensaje mensaje = new frmMensaje("Telefono de longitud incorrecta", "Error de TELEFONO", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (!Program.dbController.validarUsuarioUnico(txtUsuario.Text)) { frmMensaje mensaje = new frmMensaje("El nombre de USUARIO no esta disponible.", "Error de USUARIO", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (!IsValidEmail(txtCorreo.Text)) { frmMensaje mensaje = new frmMensaje("Ingrese un correo electronico valido", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (!int.TryParse(txtDNI.Text, out i) || !int.TryParse(txtTelefono.Text, out i)) { frmMensaje mensaje = new frmMensaje("Dni y Telefono deben ser numericos", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } return(true); }
private void btnCerrarSesion_Click(object sender, EventArgs e) { frmMensaje mensaje = new frmMensaje("Seguro que quiere cerrar sesion?", "", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { } ; if (mensaje.ShowDialog() == DialogResult.OK) { this.Hide(); FormLogin login = new FormLogin(); login.Show(); } }
private void btnConfirmar_Click(object sender, EventArgs e) { if (txtActual.Text.Equals("") || txtNueva.Text.Equals("") || txtRepetir.Text.Equals("")) { frmMensaje msj = new frmMensaje("Complete todos los campos", "", ""); if (msj.ShowDialog() == DialogResult.OK) { return; } return; } if (Encriptar.HashTable(txtActual.Text).Equals(Encriptar.HashTable(colaborador.password))) { frmMensaje msj = new frmMensaje("Contraseña actual incorrecta", "", ""); if (msj.ShowDialog() == DialogResult.OK) { return; } return; } frmMensaje mensaje1 = new frmMensaje("Seguro que desea continuar?", "", "Confirmar"); if (mensaje1.ShowDialog() == DialogResult.OK) { string cont = txtNueva.Text; colaborador.password = Encriptar.HashTable(txtNueva.Text); Program.dbController.actualizarColaborador(colaborador); frmMensaje mensaje2 = new frmMensaje("Cambio de Contraseñas exitoso", "", "Confirmar"); if (mensaje2.ShowDialog() == DialogResult.OK) { this.Close(); Correo c = new Correo(); c.CambiarPass(colaborador, cont); padre.Hide(); } FormLogin login = new FormLogin(); login.Show(); } }
public bool verificarCampos() { float i; if (cliente == null || servMat == null || txtAbonar.Text.Equals("") || cboFormaPago.SelectedIndex == -1) { frmMensaje mensaje = new frmMensaje("Todos los campos son oligatorios", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (!float.TryParse(txtAbonar.Text, out i)) { frmMensaje mensaje = new frmMensaje("Ingrese una cantidad numerica valida", "Error de Abonar", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (float.Parse(txtAbonar.Text) < 0) { frmMensaje mensaje = new frmMensaje("Ingrese una cantidad numerica positiva", "Error de Abonar", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (float.Parse(txtAbonar.Text) == 0) { frmMensaje mensaje = new frmMensaje("No es posible abonar 0 soles", "Error de Abonar", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } return(true); }
public bool verificarCampos() { float i; if (txtPorcentaje.Text.Equals("") || txtNombre.Text.Equals("") || txtDescripcion.Text.Equals("")) { frmMensaje mensaje = new frmMensaje("Todos los campos son obligatorios", "Error de Campos", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (!float.TryParse(txtPorcentaje.Text, out i)) { frmMensaje mensaje = new frmMensaje("Ingrese un procentaje valido(Ej. 25, 30.5)", "Porcentaje Invalido", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (float.Parse(txtPorcentaje.Text) < 0 || float.Parse(txtPorcentaje.Text) > 100) { frmMensaje mensaje = new frmMensaje("El porcentaje debe estar entre 0 y 100", "Porcentaje Invalido", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (cboTipo.SelectedIndex == -1) { frmMensaje mensaje = new frmMensaje("Escoja un Tipo de Seguro", "Error de Tipo", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } return(true); }
public bool verificarCampos() { float i; if (txtNombreCurso.Text.Equals("") || txtDescripcion.Text.Equals("") || txtPrecio.Text.Equals("")) { frmMensaje mensaje = new frmMensaje("Todos los campos son obligatorios", "Error de campos", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (!float.TryParse(txtPrecio.Text, out i)) { frmMensaje mensaje = new frmMensaje("Añada un precio válido", "Error en Precio", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } return(true); }
private void btnAddHorario_Click(object sender, EventArgs e) { if (curso == null) { frmMensaje mensaje = new frmMensaje("Seleccione un curso", "Error", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } return; } frmGestionarHorario formGestionarHorario = new frmGestionarHorario(curso); if (formGestionarHorario.ShowDialog() == DialogResult.OK) { horario = formGestionarHorario.HorarioSeleccionado; Service.asistencia a = new Service.asistencia(); horarios.Add(horario); Object[] filaHorario = new Object[7]; filaHorario[0] = horario.clase; filaHorario[1] = horario.horaIni.ToShortTimeString(); filaHorario[2] = horario.horaFin.ToShortTimeString(); if (horario.colaborador.idPersona != 0) { filaHorario[3] = horario.colaborador.nombre; } else { filaHorario[3] = "-"; } filaHorario[4] = horario.fecha.ToShortDateString(); filaHorario[5] = horario.sede.direccion; filaHorario[6] = horario.numVacantes; dgvHorarios.Rows.Add(filaHorario); } }
private void btnGuardar_Click(object sender, EventArgs e) { if (curso == null) { frmMensaje mensaje = new frmMensaje("Seleccione un curso", "Error", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } return; } foreach (Service.asistencia a in asist) { Program.dbController.eliminarAsistencia(a); } foreach (Service.horario h in horarios) { if (h.idHorario != 0) { //Console.WriteLine(h.colaborador.idPersona); Program.dbController.actualizarHorario(h); } else { Program.dbController.insertarHorario(h, curso.id_servicio); } } frmMensaje mensaje1 = new frmMensaje("Cambios realizados", "Mensaje de confirmación", "Confirmar"); if (mensaje1.ShowDialog() == DialogResult.OK) { } ; }
private void btnEliminarHorario_Click(object sender, EventArgs e) { if (curso == null) { frmMensaje mensaje = new frmMensaje("Seleccione un curso", "Error", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } return; } frmMensaje dr = new frmMensaje("Seguro que quiere eliminar horario?", "", "Confirmar"); if (dr.DialogResult == DialogResult.OK) { horario = horarios[dgvHorarios.CurrentRow.Index]; horarios.Remove(horario); dgvHorarios.Rows.Remove(dgvHorarios.CurrentRow); } else if (dr.DialogResult == DialogResult.Cancel) { return; } }
private void btnGuardar_Click(object sender, EventArgs e) { if (verificarCampos()) { if (tabTipo.SelectedTab == tabApoderado) { if (dgvBebes.RowCount == 0) { frmMensaje mensaje = new frmMensaje("Debe registrar un bebe para poder Registrar Apoderado", "", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { } ; return; } apoderado.nombre = txtNombreCliente.Text; apoderado.dni = txtDNI.Text; apoderado.email = txtCorreo.Text; apoderado.telefono = txtTelef.Text; apoderado.aseguradora = txtAseguradora.Text; apoderado.numSeguro = txtNumAseguradora.Text; if (rbFemenino.Checked == true) { apoderado.sexo = 'F'; } else { apoderado.sexo = 'M'; } apoderado.contactos = contactos.ToArray(); apoderado.bebes = bebes.ToArray(); if (estadoObjCliente == Estado.Nuevo) { if (!Program.dbController.verificarDNI(txtDNI.Text)) { frmMensaje msj = new frmMensaje("El Dni ya existe en la base de datos", "Error de Dni", ""); if (msj.ShowDialog() == DialogResult.OK) { } return; } string cod = Program.dbController.insertarApoderado(apoderado, ((Service.sede)cboSedes.SelectedItem).distrito); Console.WriteLine(cod); frmMensaje mensaje = new frmMensaje("Se ha registrado un nuevo Apoderado", "Mensaje de confirmación", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { } ; } else { Program.dbController.actualizarApoderado(apoderado); frmMensaje mensaje = new frmMensaje("Se han actualizado los datos", "Mensaje de confirmación", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { } ; } } else { if (dgvGestaciones.RowCount == 0) { frmMensaje mensaje = new frmMensaje("Debe registrar una gestacion para poder Registrar Gestante", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } return; } if (udNumEmbarazos.Value < udNumPartos.Value) { frmMensaje mensaje = new frmMensaje("Numero de Partos no puede se mayor que el Numero de Embarazos", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } return; } gestante.nombre = txtNombreCliente.Text; gestante.dni = txtDNI.Text; gestante.email = txtCorreo.Text; gestante.telefono = txtTelef.Text; gestante.aseguradora = txtAseguradora.Text; gestante.numSeguro = txtNumAseguradora.Text; if (rbFemenino.Checked == true) { gestante.sexo = 'F'; } else { gestante.sexo = 'M'; } gestante.contactos = contactos.ToArray(); gestante.numPartos = (int)udNumPartos.Value; gestante.cantEmbar = (int)udNumEmbarazos.Value; gestante.fechaNaci = dtpFechaNacimiento.Value; gestante.fechaNaciSpecified = true; //condiciones for (int i = 0; i < dgvCondiciones.Rows.Count; i++) { if (dgvCondiciones.Rows[i].Cells[1].Value == null) { } else if ((bool)dgvCondiciones.Rows[i].Cells[1].Value == true) { Service.condicionMedica cond = new Service.condicionMedica(); cond = (Service.condicionMedica)dgvCondiciones.Rows[i].DataBoundItem; condiciones.Add(cond); } } gestante.condMedicas = condiciones.ToArray <Service.condicionMedica>(); //si hay pareja if (!txtDNIPareja.Text.Equals("")) { Service.pareja pareja = new Service.pareja(); pareja.nombre = txtNombrePareja.Text; pareja.dni = txtDNIPareja.Text; if (rbFemeninoPareja.Checked == true) { pareja.sexo = 'F'; } else { pareja.sexo = 'M'; } gestante.pareja = pareja; } gestante.gestaciones = gestaciones.ToArray(); gestante.observMedicas = txtObservaciones.Text; if (estadoObjCliente == Estado.Nuevo) { if (!Program.dbController.verificarDNI(txtDNI.Text) || !Program.dbController.verificarDNI(txtDNIPareja.Text)) { frmMensaje msj = new frmMensaje("El Dni ya existe en la base de datos", "Error de Dni", ""); if (msj.ShowDialog() == DialogResult.OK) { } return; } string cod = Program.dbController.insertarGestante(gestante, ((Service.sede)cboSedes.SelectedItem).distrito); frmMensaje mensaje = new frmMensaje("Cliente apoderado registrado", "Mensaje de confirmación", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } } else { Program.dbController.actualizarGestante(gestante); frmMensaje mensaje = new frmMensaje("Cliente apoderado actualizado", "Mensaje de confirmación", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } } } estadoComponentes(Estado.Inicial); limpiarComponentes(); } }
public bool verificarCampos() { if (txtNumClase.Text.ToString().Equals("")) { frmMensaje mensaje = new frmMensaje("Ingrese un número de clase o número de vacantes válido", "Error de Servicio", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } int nClases = Int32.Parse(txtNumClase.Text); if (Curs.numClases < nClases) { frmMensaje mensaje = new frmMensaje("El curso tiene como máximo: " + Curs.numClases + " clases", "Error de Servicio", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (dtpFechaMatricula.Value.Date < DateTime.Now.Date) { frmMensaje mensaje = new frmMensaje("El curso no puede crearse un fecha anterior al actual", "Error de Servicio", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (dtpHoraIni.Value > dtpHoraFin.Value) { frmMensaje mensaje = new frmMensaje("El horario tiene una hora de inicio mayor a la hora final", "Error de Servicio", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } int horaIni = dtpHoraIni.Value.Hour * 100 + dtpHoraIni.Value.Minute; int horaFin = dtpHoraFin.Value.Hour * 100 + dtpHoraFin.Value.Minute; if (horaFin - horaIni > 300 | horaFin - horaIni < 130) { frmMensaje mensaje = new frmMensaje("El horario debe durar minimo 2hrs y maximo 3 hrs", "Error de Servicio", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (txtNumVac.Text.ToString().Equals("")) { frmMensaje mensaje = new frmMensaje("Ingrese un número de clase o número de vacantes válido", "Error de Servicio", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (Int32.Parse(txtNumVac.Text.ToString()) > 30) { frmMensaje mensaje = new frmMensaje("El horario debe terner máximo 30 vacantes", "Error de Servicio", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } return(true); }
public frmBuscarServicioPorCliente(Service.cliente c) { InitializeComponent(); dgvMatriculas.AutoGenerateColumns = false; Formateador f = new Formateador(); Paleta p = new Paleta(); this.BackColor = p.Blanco; f.formatearBotonNaranja(btnSeleccionar); btnSeleccionar.Top = dgvMatriculas.Top + dgvMatriculas.Height + 10; btnSeleccionar.Left = dgvMatriculas.Left + dgvMatriculas.Width - 85; IEnumerable <Service.matricula> mats; if (c is Service.apoderado) { mats = Program.dbController.listarMatriculaActivaPorApoderado(c.idPersona); } else { mats = Program.dbController.listarMatriculaActivaPorGestante(c.idPersona); } if (mats != null) { matriculas = mats.ToList(); foreach (Service.matricula m in matriculas) { Object[] fila = new Object[3]; fila[0] = m.servicio.nombre; fila[1] = m.fecha.ToShortDateString(); fila[2] = m.saldo; dgvMatriculas.Rows.Add(fila); } } else { frmMensaje mensaje = new frmMensaje("El cliente no tiene servicios asociados", "Mensaje de advertencia", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } this.DialogResult = DialogResult.OK; this.Hide(); } }
private void btnAsistenciaCurso_Click(object sender, EventArgs e) { if (cboMesesCurso.SelectedIndex != -1 & cboYearsCurso.SelectedIndex != -1) { saveFileDialog1.ShowDialog(); byte[] arreglo = Program.dbController.generarReporteAsistenciaPorCursoPDF(cboMesesCurso.SelectedIndex + 1, Int32.Parse((String)cboYearsCurso.SelectedItem)); File.WriteAllBytes(saveFileDialog1.FileName + ".pdf", arreglo); } else { frmMensaje mensaje = new frmMensaje("Todos los campos son obligatorios", "Mensaje de advertencia", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } } }
private void btnAsistenciaHorario_Click(object sender, EventArgs e) { int id; if (curso != null) { if (dgvHorarios.RowCount != 0) { id = horarios[dgvHorarios.CurrentRow.Index].idHorario; saveFileDialog1.ShowDialog(); byte[] arreglo = Program.dbController.generarReporteAlumnosPorHorarioPDF(horarios[dgvHorarios.CurrentRow.Index].idHorario); File.WriteAllBytes(saveFileDialog1.FileName + ".pdf", arreglo); } else { frmMensaje mensaje = new frmMensaje("No se ha seleccionado un horario", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } } } else { frmMensaje mensaje = new frmMensaje("Seleccione un curso", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } } }
private void btnSeleccionarHorario_Click(object sender, EventArgs e) { if (dgvHorarios.RowCount != 0) { Service.horario h = horarios[dgvHorarios.CurrentRow.Index]; Service.asistencia a = new Service.asistencia(); a.horario = h; if (cliente is Service.gestante) { a.persona = cliente; } else { a.persona = (Service.persona)cboBebes.SelectedItem; } IEnumerable <Service.curso> cur = Program.dbController.cruceHorario(horarios[dgvHorarios.CurrentRow.Index], cliente.idPersona); if (cur == null) { Program.dbController.registrarClienteEnHorario(a); frmMensaje mensaje = new frmMensaje("Cliente registrado en horario", "Mensaje Confirmación", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { } } else { foreach (Service.curso c in cur) { frmMensaje mensaje = new frmMensaje("Cuce de horarios con la clase " + c.horario[0].clase + " del curso " + c.nombre, "Advertencia", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } break; } } } }
private void btnRegistrar_Click(object sender, EventArgs e) { if (asistencias.Any()) { Service.asistencia a = asistencias[dgvPorAsistir.CurrentRow.Index]; a.asistio = true; asistencias.RemoveAt(dgvPorAsistir.CurrentRow.Index); Program.dbController.actualizarAsistencia(a); Object[] fila = new Object[5]; fila[0] = dgvPorAsistir.CurrentRow.Cells[0].Value; fila[1] = dgvPorAsistir.CurrentRow.Cells[1].Value; fila[2] = dgvPorAsistir.CurrentRow.Cells[2].Value; fila[3] = dgvPorAsistir.CurrentRow.Cells[3].Value; fila[4] = dgvPorAsistir.CurrentRow.Cells[4].Value; dgvYaAsistieron.Rows.Add(fila); dgvPorAsistir.Rows.RemoveAt(dgvPorAsistir.CurrentRow.Index); frmMensaje mensaje = new frmMensaje("Asistencia registrada", "Mensaje de confirmación", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { } ; } else { frmMensaje mensaje = new frmMensaje("No hay asistentes el día de hoy", "Mensaje de error", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } } }
private void btnAddContacto_Click(object sender, EventArgs e) { int i; if (int.TryParse(txtTelefonoEmergencia.Text, out i) && (txtTelefonoEmergencia.Text.Length == 7 || txtTelefonoEmergencia.Text.Length == 9) && !txtNombreEmergencia.Text.Equals("")) { Service.contactoEmergencia cont = new Service.contactoEmergencia(); cont.nombre = txtNombreEmergencia.Text; cont.telefono = txtTelefonoEmergencia.Text; contactos.Add(cont); Object[] filaContacto = new Object[2]; filaContacto[0] = cont.nombre; filaContacto[1] = cont.telefono; dgvContactos.Rows.Add(filaContacto); } else { frmMensaje mensaje = new frmMensaje("Ingrese datos del contacto de emergencia correctamente", "Error de CAMPOS", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } } }
private void btnListarServicios_Click(object sender, EventArgs e) { if (cliente != null) { frmBuscarServicioPorCliente formBuscarServicioPorCliente = new frmBuscarServicioPorCliente(cliente); if (formBuscarServicioPorCliente.Matriculas != null) { if (formBuscarServicioPorCliente.ShowDialog() == DialogResult.OK) { limpiarComponentes(); mat = formBuscarServicioPorCliente.ServMat; txtNombreServicio.Text = mat.servicio.nombre; txtDescripcion.Text = mat.servicio.descripcion; txtSaldo.Text = mat.saldo.ToString(); txtPrecio.Text = (mat.servicio.precio * (1 - (mat.descuento.porcentaje / 100))).ToString("0.0"); if (mat.descuento.porcentaje != 0) { txtDescuento.Text = mat.descuento.nombre + " - " + mat.descuento.porcentaje.ToString() + "%"; } dtpFechaMatricula.Value = mat.fecha; //datagridview //List<Service.cuota> cuotas = Program.dbController.listarCuotasPorMatricula(mat.idMatricula).ToList<Service.cuota>(); IEnumerable <Service.cuota> cuotas = Program.dbController.listarCuotasPorMatricula(mat.idMatricula); if (cuotas != null) { dgvHistorico.RowCount = 0; foreach (Service.cuota c in cuotas) { Object[] fila = new Object[3]; fila[0] = c.fecha.ToShortDateString(); fila[1] = c.monto.ToString("0.0"); fila[2] = c.formaPago; dgvHistorico.Rows.Add(fila); } } } } } else { frmMensaje mensaje = new frmMensaje("Seleccione un Cliente", "", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { } ; } }
private void btnAbonar_Click(object sender, EventArgs e) { if ((verificarCampos())) { float monto = float.Parse(txtAbonar.Text); float pendiente = float.Parse(txtPendiente.Text); if (pendiente < monto) { frmMensaje mensaje = new frmMensaje("Monto máximo a abonar: " + pendiente.ToString("0.0"), "Mensaje de advertencia", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } txtAbonar.Text = "0"; } else { Service.cuota c = new Service.cuota(); c.fecha = DateTime.Today; c.fechaSpecified = true; c.monto = float.Parse(txtAbonar.Text); c.formaPago = (String)cboFormaPago.SelectedItem; servMat.saldo = servMat.saldo - c.monto; Program.dbController.actualizarMatricula(servMat); Program.dbController.insertarCuota(c, servMat.idMatricula); frmMensaje mensaje = new frmMensaje("Cuota Registrada exitosamente", "Mensaje Confirmación", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { } ; Correo correo = new Correo(); correo.RegistroCuota(servMat, txtAbonar.Text); txtPendiente.Text = (float.Parse(txtPendiente.Text) - float.Parse(txtAbonar.Text)).ToString("0.0"); txtAbonar.Text = "0"; } } }
public void CorreoNuevoServicio(Service.cliente cliente, BindingList <Service.matricula> matriculas) { double monto = 0; using (MailMessage mail = new MailMessage()) { mail.From = new MailAddress(emailFromAddress); mail.To.Add(cliente.email); mail.Subject = "Bienvenida/o a Escuela para embarazadas " + cliente.nombre; mail.Body = "La relacion de sus matricuals es<br><br>"; foreach (Service.matricula mat in matriculas) { if (mat.cuotas != null) { monto = mat.cuotas[0].monto; } mail.Body += "Curso: " + mat.servicio.nombre + "<br>Monto inicial Abonado: " + monto + "<br>Saldo: " + mat.saldo + "<br><br>"; } mail.IsBodyHtml = true; using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber)) { smtp.Credentials = new NetworkCredential(emailFromAddress, password); smtp.EnableSsl = enableSSL; smtp.Send(mail); frmMensaje mensaje = new frmMensaje("Se ha enviado correo con los detalles a " + cliente.email, "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } } } }
private void btnListarServicios_Click(object sender, EventArgs e) { if (cliente != null) { frmBuscarServicioDeudaPorCliente formBuscarServicioPorCliente = new frmBuscarServicioDeudaPorCliente(cliente); if (formBuscarServicioPorCliente.Matriculas != null) { if (formBuscarServicioPorCliente.ShowDialog() == DialogResult.OK) { servMat = formBuscarServicioPorCliente.ServMat; servMat.cliente = cliente; txtNombreServicio.Text = servMat.servicio.nombre; dtpFechaMatricula.Value = servMat.fecha; txtPendiente.Text = servMat.saldo.ToString("0.0"); } } } else { frmMensaje mensaje = new frmMensaje("Seleccione un Cliente", "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } } }
public void RecuperarPassword(Service.colaborador colaborador, string cont) { using (MailMessage mail = new MailMessage()) { mail.From = new MailAddress(emailFromAddress); mail.To.Add(colaborador.email); mail.Subject = "Recuperar Contraseña"; mail.Body = "Estimado " + colaborador.nombre + ",<br><br> Nuestro sistema ha detectato que olvidaste tu contraseña por lo que se ha generado una nueva.+" + "<br>Contraseña nueva: " + cont + "<br> Contraseña personal. Por favor, no comparta con nadie su contraseña"; mail.IsBodyHtml = true; using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber)) { smtp.Credentials = new NetworkCredential(emailFromAddress, password); smtp.EnableSsl = enableSSL; smtp.Send(mail); frmMensaje mensaje = new frmMensaje("Se ha enviado un correo a " + colaborador.email, "", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { } ; } } }
public void CambiarPass(Service.colaborador colaborador, string pass) { using (MailMessage mail = new MailMessage()) { mail.From = new MailAddress(emailFromAddress); mail.To.Add(colaborador.email); mail.Subject = "Cambio de Contraseña de " + colaborador.nombre; mail.Body = "Usuario: " + colaborador.user + "<br>Contraseña: " + pass + "<br> Contraseña personal. Por favor, no comparta con nadie su contraseña"; mail.IsBodyHtml = true; using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber)) { smtp.Credentials = new NetworkCredential(emailFromAddress, password); smtp.EnableSsl = enableSSL; smtp.Send(mail); frmMensaje mensaje = new frmMensaje("Se ha enviado el correo a " + colaborador.email, "", ""); if (mensaje.ShowDialog() == DialogResult.OK) { } } } }
public bool verificarCampos() { int i; if (txtNombreCliente.Text.Equals("") || txtDNI.Text.Equals("") || cboSedes.SelectedIndex == -1 || txtTelef.Text.Equals("")) { frmMensaje mensaje = new frmMensaje("Complete los campos obligatorios", "Error de Campos", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (!int.TryParse(txtTelef.Text, out i)) { frmMensaje mensaje = new frmMensaje("Campo TELEFONO debe ser numerico", "Error de TELEFONO", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (txtDNI.Text.Length != 8) { frmMensaje mensaje = new frmMensaje("DNI de longitud incorrecta", "Error de DNI", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (txtTelef.Text.Length < 7 || txtTelef.Text.Length == 8) { frmMensaje mensaje = new frmMensaje("Telefono de longitud incorrecta", "Error de TELEFONO", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (!IsValidEmail(txtCorreo.Text)) { frmMensaje mensaje = new frmMensaje("Ingrese un correo electronico valido: [email protected]", "Error de CORREO", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if (rbFemenino.Checked == false && rbMasculino.Checked == false) { frmMensaje mensaje = new frmMensaje("Campo SEXO(cliente o pareja) debe ser seleccionado", "Error de SEXO", ""); if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if ((!txtAseguradora.Text.Equals("") && txtNumAseguradora.Text.Equals("")) || (txtAseguradora.Text.Equals("") && !txtNumAseguradora.Text.Equals(""))) { frmMensaje mensaje = new frmMensaje("Completar Campos de Aseguradora", "Error de ASEGURADORA", ""); if (!int.TryParse(txtNumAseguradora.Text, out i)) { frmMensaje mensaje1 = new frmMensaje("Campo Num. ASEGURADORA debe ser numerico", "Error de ASEGURADORA", ""); if (mensaje1.ShowDialog() == DialogResult.OK) { return(false); } } if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } if ((!txtDNIPareja.Text.Equals("") && txtNombrePareja.Text.Equals("")) || (txtDNIPareja.Text.Equals("") && !txtNombrePareja.Text.Equals(""))) { frmMensaje mensaje = new frmMensaje("Completar Campos de Pareja", "Error de PAREJA", ""); if (rbFemeninoPareja.Checked == false && rbMasculinoPareja.Checked == false) { frmMensaje mensaje1 = new frmMensaje("Campo SEXO(cliente o pareja) debe ser seleccionado", "Error de SEXO", ""); if (mensaje1.ShowDialog() == DialogResult.OK) { return(false); } } if (mensaje.ShowDialog() == DialogResult.OK) { return(false); } } return(true); }