internal bool CambioPass(UsuarioBC usuario) { bool exito = false; // usuario.PASSWORD = funcion.Encriptar(usuario.PASSWORD, usuario.USERNAME.ToLower()); accesoDatos.CargarSqlComando("[dbo].[CAMBIO_PASS]"); accesoDatos.AgregarSqlParametro("@USU_ID", usuario.ID); accesoDatos.AgregarSqlParametro("@NEW_PASS", usuario.PASSWORD2); usuario.PASSWORD = usuario.PASSWORD2; try { accesoDatos.EjecutarSqlEscritura(); exito = true; } catch (Exception ex) { exito = false; throw (ex); } return(exito); }
internal bool cuadra_yardtag(string YATA_COD, int YAHI_ID, int YAPE_ID, int LUGA_ID, int TRAI_ID, int usua_id, out string mensaje) //Solicitud Carga { bool exito = false; mensaje = ""; SqlAccesoDatos accesoDatos = new SqlAccesoDatos("CsString"); accesoDatos.CargarSqlComando("[dbo].[prcYARDTAG_EVENTOS_CUADRATURA_MANUAL_CUADRAR]"); accesoDatos.AgregarSqlParametro("@YATA_COD", YATA_COD); accesoDatos.AgregarSqlParametro("@YAHI_ID", YAHI_ID); accesoDatos.AgregarSqlParametro("@YAPE_ID", YAPE_ID); accesoDatos.AgregarSqlParametro("@LUGA_ID", LUGA_ID); accesoDatos.AgregarSqlParametro("@TRAI_ID", TRAI_ID); accesoDatos.AgregarSqlParametro("@usua_id", usua_id); //accesoDatos.AgregarSqlParametro("@RUTA", d.SOLICITUD_CARGA.RUTA); //accesoDatos.AgregarSqlParametro("@OBSERVACION", d.SOLICITUD_CARGA.OBSERVACION); //accesoDatos.AgregarSqlParametro("@ANDENES", ds.Tables["ANDENES"]); //accesoDatos.AgregarSqlParametro("@LOCALES", ds.Tables["LOCALES"]); //accesoDatos.AgregarSqlParametro("@USUA_ID", d.USUA_ID_CARGA); //if (d.SOLICITUD_CARGA.ID_SHORTECK != "0" && d.SOLICITUD_CARGA.ID_SHORTECK != "") // accesoDatos.AgregarSqlParametro("@SHOR_ID", d.SOLICITUD_CARGA.ID_SHORTECK); accesoDatos.AgregarSqlParametroOUT("@ERROR", exito); SqlParameter param = accesoDatos.AgregarSqlParametro("@ERROR_MSG", mensaje); param.Direction = ParameterDirection.Output; param.Size = 1000; try { accesoDatos.EjecutarSqlEscritura(); mensaje = param.Value.ToString(); exito = true; } catch (Exception ex) { exito = false; mensaje = ex.Message; // throw (ex); } finally { accesoDatos.LimpiarSqlParametros(); accesoDatos.CerrarSqlConeccion(); } return(exito); }
internal bool EliminarUsuario(int id) { bool esExitosa = false; SqlAccesoDatos accesoDatos = new SqlAccesoDatos(SqlTransaccion.STRING_CONEXION); try { accesoDatos.CargarSqlComando("[dbo].[ELIMINA_USUARIO]"); accesoDatos.AgregarSqlParametro("@ID", id); accesoDatos.EjecutarSqlEscritura(); esExitosa = true; } catch (Exception ex) { esExitosa = false; throw ex; } return(esExitosa); }
internal bool UsuarioCrear(UsuarioBC usuario) { bool exito = false; // usuario.PASSWORD = funcion.Encriptar(usuario.PASSWORD, usuario.USERNAME.ToLower()); SqlAccesoDatos accesoDatos = new SqlAccesoDatos(SqlTransaccion.STRING_CONEXION); accesoDatos.CargarSqlComando("[dbo].[AGREGA_USUARIO]"); accesoDatos.AgregarSqlParametro("@CODIGO", usuario.CODIGO); accesoDatos.AgregarSqlParametro("@DESCRIPCION", usuario.DESCRIPCION); accesoDatos.AgregarSqlParametro("@NOMBRE", usuario.NOMBRE); accesoDatos.AgregarSqlParametro("@APELLIDO", usuario.APELLIDO); accesoDatos.AgregarSqlParametro("@RUT", usuario.RUT); accesoDatos.AgregarSqlParametro("@EMAIL", usuario.EMAIL); accesoDatos.AgregarSqlParametro("@USERNAME", usuario.USERNAME); accesoDatos.AgregarSqlParametro("@PASSWORD", usuario.PASSWORD); if (usuario.ESTADO) { accesoDatos.AgregarSqlParametro("@ESTADO", "Activo"); } else { accesoDatos.AgregarSqlParametro("@ESTADO", "Inactivo"); } accesoDatos.AgregarSqlParametro("@OBSERVACION", usuario.OBSERVACION); accesoDatos.AgregarSqlParametro("@ID_EMPRESA", usuario.ID_EMPRESA); accesoDatos.AgregarSqlParametro("@ID_TIPO", usuario.ID_TIPO); accesoDatos.AgregarSqlParametro("@ID_SITE", usuario.SITE); if (usuario.ID_PROVEEDOR != 0 && usuario.ID_PROVEEDOR != null) { accesoDatos.AgregarSqlParametro("@ID_PROV", usuario.ID_PROVEEDOR); } try { accesoDatos.EjecutarSqlEscritura(); exito = true; } catch (Exception ex) { exito = false; // throw (ex); } return(exito); }
internal bool UsuarioModificarPass(UsuarioBC usuario) { bool esExitosa = false; SqlAccesoDatos accesoDatos = new SqlAccesoDatos(SqlTransaccion.STRING_CONEXION); try { accesoDatos.CargarSqlComando("[dbo].[ACTUALIZA_PASS_USUARIO]"); accesoDatos.AgregarSqlParametro("@ID", usuario.ID); accesoDatos.AgregarSqlParametro("@PASS", usuario.PASSWORD); accesoDatos.EjecutarSqlEscritura(); esExitosa = true; } catch (Exception ex) { esExitosa = false; throw ex; } return(esExitosa); }
internal bool UsuarioAsignarLugares(int usua_id, string luga_id) { bool esExitosa = false; SqlAccesoDatos accesoDatos; accesoDatos = null; accesoDatos = new SqlAccesoDatos(SqlTransaccion.STRING_CONEXION); try { accesoDatos.CargarSqlComando("[dbo].[AGREGA_LUGARES_ESPECIALES_USUARIO]"); accesoDatos.AgregarSqlParametro("@USUA_ID", usua_id); accesoDatos.AgregarSqlParametro("@LUGA_ID", luga_id); accesoDatos.EjecutarSqlEscritura(); esExitosa = true; } catch (Exception ex) { esExitosa = false; throw ex; } return(esExitosa); }