private void AsociarODesasociarUsarioAPiloto(bool asociar) { try { UiVistasPrincipal.Focus(); if (!ExistePiloto(Piloto.PILOT_CODE)) { return; } var usuarioPorPiloto = new UsuarioPorPiloto { PILOT_CODE = Piloto.PILOT_CODE, USER_CODE = Piloto.USER_CODE , LAST_UPDATE_BY = InteraccionConUsuarioServicio.ObtenerUsuario() }; if (asociar) { UsuarioDeseaAsociarPilotoAUsuarioDelSistema?.Invoke(null, new PilotoArgumento { UsuarioPorPiloto = usuarioPorPiloto }); } else { UsuarioDeseaDesasociarPilotoDeUsuarioDelSistema?.Invoke(null, new PilotoArgumento { UsuarioPorPiloto = usuarioPorPiloto }); } } catch (Exception ex) { InteraccionConUsuarioServicio.Alerta(ex.Message); } }
private void EstabacerPilotoSeleccionado() { try { if (!TieneSeleccionadoUnaFilaEnLaVista(UiVistaPilotos)) { return; } Piloto = ((Piloto)ObtenerFilaSelecciondaDeLaVista(UiVistaPilotos)).ShallowCopy(); if (string.IsNullOrEmpty(Piloto.ROLE_ID)) { if (RolesDeUsuario == null || RolesDeUsuario.Count <= 0) { return; } Piloto.ROLE_ID = RolesDeUsuario[0].ROLE_ID; } UsuarioDeseaObtenerUsuariosPorRol?.Invoke(null, new PilotoArgumento { RolDeUsuario = new RolDeUsuario { ROLE_ID = Piloto.ROLE_ID, USER_CODE = Piloto.USER_CODE } }); UiGridDePropiedadesPilotos.Refresh(); } catch (Exception ex) { InteraccionConUsuarioServicio.Alerta(ex.Message); } }
private void GrabarPiloto() { try { if (!ValidarDatosGenerales()) { return; } UiVistasPrincipal.Focus(); var usuarioPorPiloto = new UsuarioPorPiloto { PILOT_CODE = Piloto.PILOT_CODE, USER_CODE = Piloto.USER_CODE }; Piloto.LAST_UPDATE_BY = InteraccionConUsuarioServicio.ObtenerUsuario(); if (!ExistePiloto(Piloto.PILOT_CODE)) { UsuarioDeseaCrearPiloto?.Invoke(null, new PilotoArgumento { Piloto = Piloto, UsuarioPorPiloto = usuarioPorPiloto }); } else { UsuarioDeseaActualizarPiloto?.Invoke(null, new PilotoArgumento { Piloto = Piloto, UsuarioPorPiloto = usuarioPorPiloto }); } } catch (Exception ex) { InteraccionConUsuarioServicio.Alerta(ex.Message); } }
//private void ObtenerUsuariosPorRol() //{ // try // { // if (!SeleccionoRolId(Piloto.ROLE_ID)) return; // var codigoUsuario = string.Empty; // if (ExistePiloto(Piloto.PILOT_CODE)) // { // var firstOrDefault = Pilotos.ToList().FirstOrDefault(p => p.PILOT_CODE == Piloto.PILOT_CODE); // if (firstOrDefault != null) // { // codigoUsuario = firstOrDefault.USER_CODE; // } // } // UsuarioDeseaObtenerUsuariosPorRol?.Invoke(null, new PilotoArgumento { RolDeUsuario = new RolDeUsuario { ROLE_ID = Piloto.ROLE_ID, USER_CODE = codigoUsuario } }); // } // catch (Exception ex) // { // InteraccionConUsuarioServicio.Alerta(ex.Message); // } //} private void ObtenerUsuariosPorRol() { try { //if (!SeleccionoRolId(Piloto.ROLE_ID)) return; var codigoUsuario = string.Empty; if (ExistePiloto(Piloto.PILOT_CODE)) { var firstOrDefault = Pilotos.ToList().FirstOrDefault(p => p.PILOT_CODE == Piloto.PILOT_CODE); if (firstOrDefault != null) { codigoUsuario = firstOrDefault.USER_CODE; } } UsuarioDeseaObtenerUsuariosPorRol?.Invoke(null, new PilotoArgumento { RolDeUsuario = new RolDeUsuario { ROLE_ID = Piloto.ROLE_ID, USER_CODE = codigoUsuario } }); } catch (Exception ex) { InteraccionConUsuarioServicio.Alerta(ex.Message); } }
private void UiBotonContraer_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { UiVistaPilotos.CollapseAllGroups(); } catch (Exception ex) { InteraccionConUsuarioServicio.Alerta(ex.Message); } }
private void UiBotonNuevo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { VistaCargandosePorPrimeraVez?.Invoke(sender, e); } catch (Exception ex) { InteraccionConUsuarioServicio.Alerta(ex.Message); } }
private void UiListaRol_EditValueChanged(object sender, EventArgs e) { try { UiVistasPrincipal.Focus(); ObtenerUsuariosPorRol(); } catch (Exception ex) { InteraccionConUsuarioServicio.Alerta(ex.Message); } }
private void UiBotonRefrescar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { UsuarioDeseaObtenerPilotos?.Invoke(null, new PilotoArgumento { Piloto = new Piloto() }); } catch (Exception ex) { InteraccionConUsuarioServicio.Alerta(ex.Message); } }
private void BorrarPiloto() { try { if (ExistePiloto(Piloto.PILOT_CODE)) { UsuarioDeseaEliminarPiloto?.Invoke(null, new PilotoArgumento { Piloto = Piloto }); } } catch (Exception ex) { InteraccionConUsuarioServicio.Alerta(ex.Message); } }
private void UiBtnExportarVistaAExcel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { UiDialogoExportarExcel.DefaultExt = "xlsx"; UiDialogoExportarExcel.Filter = @"Archivos de excel (*.xlsx)|*.xlsx"; UiDialogoExportarExcel.FilterIndex = 2; UiDialogoExportarExcel.RestoreDirectory = true; UiDialogoExportarExcel.Title = @"Guardar Cumplimiento De Entrega"; if (UiDialogoExportarExcel.ShowDialog() == DialogResult.OK) { UiGridVistaCumpimientoDeEntrega.ExportToXlsx(UiDialogoExportarExcel.FileName); } } catch (Exception ex) { InteraccionConUsuarioServicio.Alerta(ex.Message); } }
private void UiBotonExportarAExcel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { UiDialogoParaGuardar.DefaultExt = "xlsx"; UiDialogoParaGuardar.Filter = @"Archivos de excel (*.xlsx)|*.xlsx"; UiDialogoParaGuardar.FilterIndex = 2; UiDialogoParaGuardar.RestoreDirectory = true; UiDialogoParaGuardar.Title = @"Guardar Clases"; if (UiDialogoParaGuardar.ShowDialog() == DialogResult.OK) { UiVistaPilotos.ExportToXlsx(UiDialogoParaGuardar.FileName); } } catch (Exception ex) { InteraccionConUsuarioServicio.Alerta(ex.Message); } }
private void UiListaRol_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { if (BotonSeleccionadoNoTieneEtiqueta(e)) { return; } switch (e.Button.Tag.ToString()) { case "UiBotonRrefrescarListaRol": UsuarioDeseaObtenerRoles?.Invoke(sender, e); break; case "UiBotonRrefrescarListaUsuario": ObtenerUsuariosPorRol(); break; } } catch (Exception ex) { InteraccionConUsuarioServicio.Alerta(ex.Message); } }
private bool ValidarDatosGenerales() { try { UiVistasPrincipal.Focus(); if (string.IsNullOrEmpty(Piloto.NAME)) { InteraccionConUsuarioServicio.Alerta("Ingrese el nombre."); UiGridDePropiedadesPilotos.Focus(); return(false); } if (string.IsNullOrEmpty(Piloto.LAST_NAME)) { InteraccionConUsuarioServicio.Alerta("Ingrese el apellido."); UiGridDePropiedadesPilotos.Focus(); return(false); } if (string.IsNullOrEmpty(Piloto.IDENTIFICATION_DOCUMENT_NUMBER)) { InteraccionConUsuarioServicio.Alerta("Ingrese el numero de identificacón."); UiGridDePropiedadesPilotos.Focus(); return(false); } if (string.IsNullOrEmpty(Piloto.LICENSE_NUMBER)) { InteraccionConUsuarioServicio.Alerta("Ingrese el numero de licencia."); UiGridDePropiedadesPilotos.Focus(); return(false); } if (string.IsNullOrEmpty(Piloto.LICESE_TYPE)) { InteraccionConUsuarioServicio.Alerta("Ingrese el tipo de licencia."); UiGridDePropiedadesPilotos.Focus(); return(false); } if (Piloto.LICENSE_EXPIRATION_DATE == null) { InteraccionConUsuarioServicio.Alerta("Ingrese la fecha de vencimiento."); UiGridDePropiedadesPilotos.Focus(); return(false); } else { if (Piloto.LICENSE_EXPIRATION_DATE <= DateTime.Now) { InteraccionConUsuarioServicio.Alerta("La fecha tiene que ser mayor a la fecha actual."); UiGridDePropiedadesPilotos.Focus(); return(false); } } if (string.IsNullOrEmpty(Piloto.ADDRESS)) { InteraccionConUsuarioServicio.Alerta("Ingrese la dirección."); UiGridDePropiedadesPilotos.Focus(); return(false); } if (string.IsNullOrEmpty(Piloto.TELEPHONE)) { InteraccionConUsuarioServicio.Alerta("Ingrese el telefono."); UiGridDePropiedadesPilotos.Focus(); return(false); } return(true); } catch (Exception ex) { InteraccionConUsuarioServicio.Alerta(ex.Message); return(false); } }