public wnwPagoEmpleados(string pCedula) { InitializeComponent(); EmpleadoMantenimiento empleado = new EmpleadoMantenimiento(); bool color = true; Empleado = empleado.AutenticaEmpleado(pCedula); //dtgPagos.ItemsSource = empleado.ListarPagosEmpleados(pCedula); List<SIGEEA_spObtenerPagosEmpleadosPendientesResult> lista = new List<SIGEEA_spObtenerPagosEmpleadosPendientesResult>(); lista = empleado.ListarPagosEmpleados(pCedula); foreach (SIGEEA_spObtenerPagosEmpleadosPendientesResult p in lista) { uc_PagoEmpleado Pago = new uc_PagoEmpleado(); Pago.PagoId = p.PK_Id_HorLaboradas; Pago.Fechas = p.Fecha; Pago.CantidadHoras = Convert.ToInt32(p.Diferencia); Pago.Puestos = p.Nombre_Puesto; Pago.Tarifas = p.Tarifa; Pago.Totales = p.Total; Pago.Color(color); color = !color; stpPagos.Children.Add(Pago); } }
public wnwDirecciones(string pCedula_pCodigo, string tipoPersona, int pkFinca) { InitializeComponent(); PersonaMantenimiento persona = new PersonaMantenimiento(); DataClasses1DataContext dc = new DataClasses1DataContext(); AsociadoMantenimiento asociado = new AsociadoMantenimiento(); cmbProvincia.ItemsSource = persona.ListarProvinciasNacionales();//Se carga el ComboBox de provincias pk_finca = pkFinca; tipo = tipoPersona; if (tipoPersona == "Asociado") { if (asociado.DireccionRegistradaAsociado(pCedula: pCedula_pCodigo, pCodigo: null) == true)//Si el asociado tiene ya una dirección registrada { CargaInformacion(tipoPersona, pCedula: pCedula_pCodigo, pCodigo: null, pIdFinca:null); editar = true; } else { MessageBox.Show("Este asociado no cuenta con ninguna dirección registrada. Puede registrarla a continuación.", "SIGEEA", MessageBoxButton.OK); editar = false; pk_persona = dc.SIGEEA_Personas.First(p => p.CedParticular_Persona == pCedula_pCodigo).PK_Id_Persona; } } else if (tipoPersona == "Empleado") { EmpleadoMantenimiento empleado = new EmpleadoMantenimiento(); if (empleado.DireccionRegistradaEmpleado(pCedula_pCodigo) == true)// Si el empleado ya tiene una dirección registrada { CargaInformacion(tipoPersona, pCedula: pCedula_pCodigo, pCodigo: null, pIdFinca:null); editar = true; } else { MessageBox.Show("Este empleado no cuenta con ninguna dirección registrada. Puede registrarla a continuación.", "SIGEEA", MessageBoxButton.OK); editar = false; pk_persona = dc.SIGEEA_Personas.First(p => p.CedParticular_Persona == pCedula_pCodigo).PK_Id_Persona; } } else if (tipoPersona == "Finca") { FincaMantenimiento finca = new FincaMantenimiento(); if (finca.DireccionRegistradaFinca(pk_finca.ToString()) == true)// Si el empleado ya tiene una dirección registrada { CargaInformacion(tipoPersona, pCedula: pCedula_pCodigo, pCodigo: null, pIdFinca: null); editar = true; } else { MessageBox.Show("Esta Finca no cuenta con ninguna dirección registrada. Puede registrarla a continuación.", "SIGEEA", MessageBoxButton.OK); editar = false; } } }
private void btnRegistrar_Click(object sender, RoutedEventArgs e) { try { EmpleadoMantenimiento empleado = new EmpleadoMantenimiento(); empleado.RegistrarHoras(txbCedula.Text, cmbPuestos.SelectedItem.ToString()); MessageBox.Show("Día laboral iniciado", "SIGEEA", MessageBoxButton.OK); this.Close(); } catch(Exception Ex) { MessageBox.Show("Error en el sistema: " + Ex.Message, "SIGEEA", MessageBoxButton.OK); } }
private void btnGuardar_Click(object sender, RoutedEventArgs e) { try { //ComboBoxItem item = (ComboBoxItem)cmbPuestos.SelectedItem; EmpleadoMantenimiento empleado = new EmpleadoMantenimiento(); empleado.EditarPuesto(cmbPuestos.SelectedItem.ToString(), Convert.ToDouble(txbTarifa1.Text)); MessageBox.Show("Modificación realizada con éxito", "SIGEEA", MessageBoxButton.OK); this.Close(); } catch { MessageBox.Show("Error al modificar", "SIGEEA", MessageBoxButton.OK); } }
private void btnValidar_Click(object sender, RoutedEventArgs e) { EmpleadoMantenimiento empleado = new EmpleadoMantenimiento(); if (empleado.AutenticaEmpleado(txbCedula.Text) != null) { try { if (empleado.DiaIncompleto(txbCedula.Text) == false)//Tiene sus días laborales completos { DataClasses1DataContext dc = new DataClasses1DataContext(); MessageBox.Show("A continuación debe elegir la labor que desempeñará el empleado el dia de hoy.", "SIGEEA", MessageBoxButton.OK); cnvPrincipal.Visibility = Visibility.Collapsed; cnvSecundaria.Visibility = Visibility.Visible; btnValidar.IsDefault = false; btnRegistrar.IsDefault = true; List<SIGEEA_spListarPuestosResult> lista = dc.SIGEEA_spListarPuestos().ToList(); foreach (SIGEEA_spListarPuestosResult p in lista) { cmbPuestos.Items.Add(p.Nombre_Puesto); } } else //Tiene un día laboral sin hora de salida { empleado.RegistrarHoras(txbCedula.Text, null); MessageBox.Show("Día laboral concluido", "SIGEEA", MessageBoxButton.OK); this.Close(); } } catch (Exception Ex) { MessageBox.Show("Error en el sistema: " + Ex.Message, "SIGEEA", MessageBoxButton.OK); } } else { MessageBox.Show("Error. El número de cédula digitado no coincide con los registros.", "SIGEEA", MessageBoxButton.OK); } }
private void btnRegistrar_Click(object sender, RoutedEventArgs e) { EmpleadoMantenimiento empleado = new EmpleadoMantenimiento(); if (empleado.AutenticaEmpleado(txbCedula.Text) != null) { if (solicitud == "Editar") { wnwRegistrarPersona ventana = new wnwRegistrarPersona("Empleado", pAsociado: null, pEmpleado: empleado.AutenticaEmpleado(txbCedula.Text), pCliente: null); ventana.ShowDialog(); this.Close(); } else if (solicitud == "Direccion") { wnwDirecciones ventana = new wnwDirecciones(txbCedula.Text, "Empleado", pkFinca: 0); ventana.ShowDialog(); this.Close(); } else if (solicitud == "Pagos") { if (empleado.ListarPagosEmpleados(txbCedula.Text).Count != 0) { wnwPagoEmpleados ventana = new wnwPagoEmpleados(txbCedula.Text); ventana.ShowDialog(); this.Close(); } else { MessageBox.Show("Este empleado no posee ningún registro pendiente de pago.", "SIGEEA", MessageBoxButton.OK, MessageBoxImage.Error); } } } else { MessageBox.Show("Los datos ingresados no coinciden con los registros", "SIGEEA", MessageBoxButton.OK); } }
private void btnValidar_Click(object sender, RoutedEventArgs e) { if (tipoSolicitud == "Contacto") { PersonaMantenimiento persona = new PersonaMantenimiento(); int pk_persona = persona.AutenticaPersona(txbCedula.Text); if (pk_persona != 0) { wnwContactos ventana = new wnwContactos(pk_persona); ventana.ShowDialog(); this.Close(); } } else if (tipoSolicitud == "Direccion") { EmpleadoMantenimiento empleado = new EmpleadoMantenimiento(); AsociadoMantenimiento asociado = new AsociadoMantenimiento(); if (empleado.AutenticaEmpleado(txbCedula.Text) != null) //Es un empleado { wnwDirecciones ventana = new wnwDirecciones(txbCedula.Text, "Empleado", pkFinca:0); ventana.ShowDialog(); this.Close(); } else if (asociado.AutenticaAsociado(txbCedula.Text) != null) //Es un asociado { wnwDirecciones ventana = new wnwDirecciones(txbCedula.Text, "Asociado", pkFinca: 0); ventana.ShowDialog(); this.Close(); } else { MessageBox.Show("Error: el número de cédula digitado no se encuentra registrado.", "SIGEEA", MessageBoxButton.OK); } } }
/// <summary> /// Carga la dirección del asociado a la interfaz gráfica /// </summary> /// <param name="pCedula"></param> /// <param name="pCodigo"></param> public void CargaInformacion(string tipoPersona, string pCedula, string pCodigo, string pIdFinca) { if (tipoPersona == "Asociado") { AsociadoMantenimiento asociado = new AsociadoMantenimiento(); if (pCedula != null && pCodigo == null) { SIGEEA_spObtenerDireccionAsociadoResult direccion = asociado.ObtenerDireccionAsociado(pCedula: pCedula, pCodigo: null); CargaCantones(direccion.Nombre_Provincia); CargaDistritos(direccion.Nombre_Canton); pk_persona = direccion.PK_Id_Persona; cmbProvincia.SelectedItem = direccion.Nombre_Provincia; cmbCanton.SelectedItem = direccion.Nombre_Canton; cmbDistrito.SelectedItem = direccion.Nombre_Distrito; txbDetalles.Text = direccion.Detalles_Direccion; } else { SIGEEA_spObtenerDireccionAsociadoResult direccion = asociado.ObtenerDireccionAsociado(pCedula: null, pCodigo: pCodigo); CargaCantones(direccion.Nombre_Provincia); CargaDistritos(direccion.Nombre_Canton); pk_persona = direccion.PK_Id_Persona; cmbProvincia.SelectedItem = direccion.Nombre_Provincia; cmbCanton.SelectedItem = direccion.Nombre_Canton; cmbDistrito.SelectedItem = direccion.Nombre_Distrito; txbDetalles.Text = direccion.Detalles_Direccion; } } else if (tipoPersona == "Empleado") { EmpleadoMantenimiento empleado = new EmpleadoMantenimiento(); if (pCedula != null && pCodigo == null) { SIGEEA_spObtenerDireccionEmpleadoResult direccion = empleado.ObtenerDireccionEmpleado(pCedula); CargaCantones(direccion.Nombre_Provincia); CargaDistritos(direccion.Nombre_Canton); pk_persona = direccion.PK_Id_Persona; cmbProvincia.SelectedItem = direccion.Nombre_Provincia; cmbCanton.SelectedItem = direccion.Nombre_Canton; cmbDistrito.SelectedItem = direccion.Nombre_Distrito; txbDetalles.Text = direccion.Detalles_Direccion; } } else if (tipoPersona == "Finca") { FincaMantenimiento Finca = new FincaMantenimiento(); if (pIdFinca == null) { SIGEEA_spObtenerDireccionFincaResult direccion = Finca.ObtenerDireccionFinca(Convert.ToInt32(pIdFinca)); CargaCantones(direccion.Nombre_Provincia); CargaDistritos(direccion.Nombre_Canton); cmbProvincia.SelectedItem = direccion.Nombre_Provincia; cmbCanton.SelectedItem = direccion.Nombre_Canton; cmbDistrito.SelectedItem = direccion.Nombre_Distrito; txbDetalles.Text = direccion.Detalles_Direccion; } } }
private void btnCancelar_Click(object sender, RoutedEventArgs e) { try { if (MessageBox.Show("¿Realmente quiere realizar el pago?", "SIGEEA", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { EmpleadoMantenimiento empleado = new EmpleadoMantenimiento(); empleado.CancelarPago(Lista, pk_empleado); MessageBox.Show("Pago realizado exitosamente.", "SIGEEA", MessageBoxButton.OK, MessageBoxImage.Exclamation); PrintDialog printDialog = new PrintDialog(); if (printDialog.ShowDialog() == DialogResult.Equals(true)) { printDialog.PrintDocument((((IDocumentPaginatorSource)txbFactura.Document).DocumentPaginator), "Imprimiendo..."); } this.Close(); } } catch (Exception Ex) { MessageBox.Show("Error al realizar el pago solicitado: " + Ex.Message, "SIGEEA", MessageBoxButton.OK); } }
private void BtnRegistrar_Click(object sender, RoutedEventArgs e) { try { nuevaPersona.PK_Id_Persona = pk_Persona; SIGEEA_Escolaridad nuevaEscolaridad = new SIGEEA_Escolaridad(); nuevaEscolaridad.Leer_Escolaridad = chkLeer.IsChecked.GetValueOrDefault(); nuevaEscolaridad.Escribir_Escolaridad = chkEscribir.IsChecked.GetValueOrDefault(); nuevaEscolaridad.GradoAcad_Escolaridad = cmbGradoAcad.SelectedIndex + 1; nuevaEscolaridad.Observaciones_Escolaridad = txbAdicional.Text; EmpleadoMantenimiento empleadoMant = new EmpleadoMantenimiento(); if (editar == false) { SIGEEA_Empleado nuevoEmpleado = new SIGEEA_Empleado(); empleadoMant.RegistrarEmpleado(nuevaPersona, nuevoEmpleado, nuevaEscolaridad); } else { empleadoMant.EditarEmpleado(nuevaPersona, nuevaEscolaridad); } MessageBox.Show("La solicitud realizada se finalizó con éxito."); this.Close(); } catch { MessageBox.Show("Error al realizar la solicitud."); } }
private void btnRegistrar_Click(object sender, RoutedEventArgs e) { EmpleadoMantenimiento empleado = new EmpleadoMantenimiento(); wnwRegistrarPersona ventana = new wnwRegistrarPersona("Empleado", pAsociado: null, pEmpleado: empleado.AutenticaEmpleado(txbCedula.Text)); ventana.ShowDialog(); }