private void _vista_UsuarioDeseaCrearPiloto(object sender, PilotoArgumento e) { try { var op = PilotoServicio.CrearPiloto(e); if (op.Resultado == ResultadoOperacionTipo.Error) { throw new Exception(op.Mensaje); } _vista.Piloto.PILOT_CODE = int.Parse(op.DbData); _vista.Piloto.LAST_UPDATE = DateTime.Now; e.Piloto.PILOT_CODE = _vista.Piloto.PILOT_CODE; e.UsuarioPorPiloto.PILOT_CODE = _vista.Piloto.PILOT_CODE; if (VieneUsuarioParaAsociarAlPiloto(e.UsuarioPorPiloto)) { _vista_UsuarioDeseaAsociarPilotoAUsuarioDelSistema(sender, e); } _vista.Pilotos = PilotoServicio.ObtenerPilotos(new PilotoArgumento { Piloto = new Piloto() }); } catch (Exception exception) { InteraccionConUsuarioServicio.MensajeErrorDialogo(exception.Message); } }
private void _vista_UsuarioDeseaActualizarPiloto(object sender, PilotoArgumento e) { try { var op = PilotoServicio.ActualizarPiloto(e); if (op.Resultado == ResultadoOperacionTipo.Error) { throw new Exception(op.Mensaje); } if (VieneUsuarioParaAsociarAlPiloto(e.UsuarioPorPiloto)) { op = PilotoServicio.DesasociarPilotoDeUsuarioDelSistema(e); if (op.Resultado == ResultadoOperacionTipo.Error) { throw new Exception(op.Mensaje); } _vista_UsuarioDeseaAsociarPilotoAUsuarioDelSistema(sender, e); } _vista.Pilotos = PilotoServicio.ObtenerPilotos(new PilotoArgumento { Piloto = new Piloto() }); } catch (Exception exception) { InteraccionConUsuarioServicio.MensajeErrorDialogo(exception.Message); } }
public Operacion AsociarPilotoAUsuarioDelSistema(PilotoArgumento pilotoArgumento) { try { DbParameter[] parameters = { new OAParameter { ParameterName = "@PILOT_CODE", Value = pilotoArgumento.UsuarioPorPiloto.PILOT_CODE }, new OAParameter { ParameterName = "@USER_CODE", Value = pilotoArgumento.UsuarioPorPiloto.USER_CODE }, new OAParameter { ParameterName = "@LAST_UPDATE_BY", Value = DateTime.Now } }; var op = BaseDeDatosServicio.ExecuteQuery <Operacion>( BaseDeDatosServicio.Esquema + ".OP_WMS_ASSOCIATE_USER_TO_PILOT", CommandType.StoredProcedure, false, parameters)[0]; if (op.Resultado == ResultadoOperacionTipo.Exito) { BaseDeDatosServicio.Commit(); } else { BaseDeDatosServicio.Rollback(); } return(op); } catch (DbException e) { BaseDeDatosServicio.Rollback(); return(new Operacion { Codigo = e.ErrorCode, Mensaje = e.Message, Resultado = ResultadoOperacionTipo.Error }); } catch (Exception ex) { BaseDeDatosServicio.Rollback(); return(new Operacion { Codigo = -1, Mensaje = ex.Message, Resultado = ResultadoOperacionTipo.Error }); } }
private void _vista_UsuarioDeseaObtenerPilotos(object sender, PilotoArgumento e) { try { _vista.Pilotos = PilotoServicio.ObtenerPilotos(e); } catch (Exception exception) { InteraccionConUsuarioServicio.MensajeErrorDialogo(exception.Message); } }
private void _vista_UsuarioDeseaObtenerPilotoPorVehiculo(object sender, PilotoArgumento e) { try { _vista.Piloto = PilotoServicio.ObtenerPilotoPorVehiculo(e); } catch (Exception ex) { InteraccionConUsuarioServicio.Mensaje(ex.Message + ex.StackTrace); } }
private void _vista_UsuarioDeseaObtenerUsuariosPorRol(object sender, PilotoArgumento e) { try { //_vista.UsuariosPorRol = UsuarioServicio.ObtenerUsuariosPorRol(e.RolDeUsuario); _vista.UsuariosExternos = UsuarioServicio.ObtenerUsuariosSonda(); } catch (Exception exception) { InteraccionConUsuarioServicio.MensajeErrorDialogo(exception.Message); } }
public Piloto ObtenerPilotoPorVehiculo(PilotoArgumento pilotoArgumento) { DbParameter[] parameters = { new OAParameter { ParameterName = "@VEHICLE_CODE", Value = pilotoArgumento.Piloto.VEHICLE_CODE } }; return (BaseDeDatosServicio.ExecuteQuery <Piloto>(BaseDeDatosServicio.Esquema + ".OP_WMS_SP_GET_DRIVER_BY_VEHICLE", CommandType.StoredProcedure, parameters)[0]); }
public IList <Piloto> ObtenerPilotosNoAsociadosAVehiculos(PilotoArgumento pilotoArgumento) { DbParameter[] parameters = { new OAParameter { ParameterName = "@PILOT_CODE", Value = pilotoArgumento.Piloto.PILOT_CODE } }; return (BaseDeDatosServicio.ExecuteQuery <Piloto>(BaseDeDatosServicio.Esquema + ".OP_WMS_GET_PILOT_UNASSOCIATED_TO_VEHICLE", CommandType.StoredProcedure, parameters).ToList()); }
public Operacion EliminarPiloto(PilotoArgumento pilotoArgumento) { try { DbParameter[] parameters = { new OAParameter { ParameterName = "@PILOT_CODE", Value = pilotoArgumento.Piloto.PILOT_CODE } }; var op = BaseDeDatosServicio.ExecuteQuery <Operacion>( BaseDeDatosServicio.Esquema + ".OP_WMS_SP_DELETE_PILOT", CommandType.StoredProcedure, false, parameters)[0]; if (op.Resultado == ResultadoOperacionTipo.Exito) { BaseDeDatosServicio.Commit(); } else { BaseDeDatosServicio.Rollback(); } return(op); } catch (DbException e) { BaseDeDatosServicio.Rollback(); return(new Operacion { Codigo = e.ErrorCode, Mensaje = e.Message, Resultado = ResultadoOperacionTipo.Error }); } catch (Exception ex) { BaseDeDatosServicio.Rollback(); return(new Operacion { Codigo = -1, Mensaje = ex.Message, Resultado = ResultadoOperacionTipo.Error }); } }
private void _vista_UsuarioDeseaEliminarPiloto(object sender, PilotoArgumento e) { try { var op = PilotoServicio.EliminarPiloto(e); if (op.Resultado == ResultadoOperacionTipo.Error) { throw new Exception(op.Mensaje); } _vista_VistaCargandosePorPrimeraVez(sender, e); } catch (Exception exception) { InteraccionConUsuarioServicio.MensajeErrorDialogo(exception.Message); } }
public Operacion CrearPiloto(PilotoArgumento pilotoArgumento) { try { DbParameter[] parameters = { new OAParameter { ParameterName = "@NAME", Value = pilotoArgumento.Piloto.NAME }, new OAParameter { ParameterName = "@LAST_NAME", Value = pilotoArgumento.Piloto.LAST_NAME }, new OAParameter { ParameterName = "@IDENTIFICATION_DOCUMENT_NUMBER", Value = pilotoArgumento.Piloto.IDENTIFICATION_DOCUMENT_NUMBER }, new OAParameter { ParameterName = "@LICENSE_NUMBER", Value = pilotoArgumento.Piloto.LICENSE_NUMBER }, new OAParameter { ParameterName = "@LICESE_TYPE", Value = pilotoArgumento.Piloto.LICESE_TYPE }, new OAParameter { ParameterName = "@LICENSE_EXPIRATION_DATE", Value = pilotoArgumento.Piloto.LICENSE_EXPIRATION_DATE }, new OAParameter { ParameterName = "@ADDRESS", Value = pilotoArgumento.Piloto.ADDRESS }, new OAParameter { ParameterName = "@TELEPHONE", Value = pilotoArgumento.Piloto.TELEPHONE }, new OAParameter { ParameterName = "@MAIL", Value = pilotoArgumento.Piloto.MAIL }, new OAParameter { ParameterName = "@COMMENT", Value = pilotoArgumento.Piloto.COMMENT }, new OAParameter { ParameterName = "@LAST_UPDATE_BY", Value = pilotoArgumento.Piloto.LAST_UPDATE_BY } }; var op = BaseDeDatosServicio.ExecuteQuery <Operacion>(BaseDeDatosServicio.Esquema + ".OP_WMS_SP_ADD_PILOT", CommandType.StoredProcedure, false, parameters)[0]; if (op.Resultado == ResultadoOperacionTipo.Exito) { BaseDeDatosServicio.Commit(); } else { BaseDeDatosServicio.Rollback(); } return(op); } catch (DbException e) { BaseDeDatosServicio.Rollback(); return(new Operacion { Codigo = e.ErrorCode, Mensaje = e.Message, Resultado = ResultadoOperacionTipo.Error }); } catch (Exception ex) { BaseDeDatosServicio.Rollback(); return(new Operacion { Codigo = -1, Mensaje = ex.Message, Resultado = ResultadoOperacionTipo.Error }); } }