public void modifica_cliente() { conexion = cls_DAL.trae_conexion("H-Mandiola", ref mensaje_error, ref numero_error); if (conexion == null) { //insertar en la table de errores HttpContext.Current.Response.Redirect("Error.aspx?error=" + numero_error.ToString() + "&men=" + mensaje_error); } else { sql = "usp_modifica_consecutivo"; ParamStruct[] parametros = new ParamStruct[8]; cls_DAL.agregar_datos_estructura_parametros(ref parametros, 0, "@ID_Consecutivo", SqlDbType.VarChar, _id_consecutivo); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 1, "@Nombre", SqlDbType.VarChar, _nombre); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 2, "@Apellido1", SqlDbType.VarChar, _apellido1); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 3, "@Apellido2", SqlDbType.VarChar, _apellido2); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 4, "@Correo", SqlDbType.VarChar, _correo); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 5, "@Password", SqlDbType.VarChar, _password); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 6, "@Telefono", SqlDbType.VarChar, _telefono); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 7, "@Activo", SqlDbType.VarChar, _activo); cls_DAL.conectar(conexion, ref mensaje_error, ref numero_error); cls_DAL.ejecuta_sqlcommand(conexion, sql, true, parametros, ref mensaje_error, ref numero_error); if (numero_error != 0) { //insertar en la table de errores HttpContext.Current.Response.Redirect("Error.aspx?error=" + numero_error.ToString() + "&men=" + mensaje_error); cls_DAL.desconectar(conexion, ref mensaje_error, ref numero_error); } else { Bitacora bitacora = new Bitacora(); bitacora.usuario = System.Web.HttpContext.Current.User.Identity.Name; bitacora.codigo_registro = 1; bitacora.tipo = "Modificar"; bitacora.descripcion = "Se actualizó un elemento en la tabla Consecutivo con ID: " + _id_consecutivo; bitacora.detalle = "Datos insertados, Consecutivo: "; bitacora.agregar_bitacora(); cls_DAL.desconectar(conexion, ref mensaje_error, ref numero_error); } } }
public void modifica_habitacion() { conexion = cls_DAL.trae_conexion("H-Mandiola", ref mensaje_error, ref numero_error); if (conexion == null) { //insertar en la table de errores HttpContext.Current.Response.Redirect("Error.aspx?error=" + numero_error.ToString() + "&men=" + mensaje_error); } else { sql = "usp_modifica_habitacion"; ParamStruct[] parametros = new ParamStruct[7]; cls_DAL.agregar_datos_estructura_parametros(ref parametros, 0, "@ID_Consecutivo", SqlDbType.VarChar, _id_consecutivo); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 1, "@Nombre", SqlDbType.VarChar, _nombre); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 2, "@Numero", SqlDbType.Int, _numero); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 3, "@Descripcion", SqlDbType.VarChar, _descripcion); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 4, "@Imagen", SqlDbType.VarChar, _imagen); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 5, "@Disponibilidad", SqlDbType.VarChar, _disponibilidad); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 6, "@ID_Precio", SqlDbType.VarChar, _id_precio); cls_DAL.conectar(conexion, ref mensaje_error, ref numero_error); cls_DAL.ejecuta_sqlcommand(conexion, sql, true, parametros, ref mensaje_error, ref numero_error); if (numero_error != 0) { //insertar en la table de errores HttpContext.Current.Response.Redirect("Error.aspx?error=" + numero_error.ToString() + "&men=" + mensaje_error); cls_DAL.desconectar(conexion, ref mensaje_error, ref numero_error); } else { Bitacora bitacora = new Bitacora(); bitacora.usuario = System.Web.HttpContext.Current.User.Identity.Name; bitacora.codigo_registro = 1; bitacora.tipo = "Modificar"; bitacora.descripcion = "Se actualizó un elemento en la tabla Habitacion con ID: " + _id_consecutivo; bitacora.detalle = "Datos insertados, ID Consecutivo: " + id_consecutivo + ", Nombre: " + nombre + ", Número: " + numero + ", Descripción: " + descripcion + ", Imagen: " + imagen + ", Disponibilidad: " + disponibilidad + ", ID Precio: " + id_precio; bitacora.agregar_bitacora(); cls_DAL.desconectar(conexion, ref mensaje_error, ref numero_error); } } }
public void modifica_consecutivo() { conexion = cls_DAL.trae_conexion("H-Mandiola", ref mensaje_error, ref numero_error); if (conexion == null) { //insertar en la table de errores HttpContext.Current.Response.Redirect("Error.aspx?error=" + numero_error.ToString() + "&men=" + mensaje_error); } else { sql = "usp_modifica_consecutivo"; ParamStruct[] parametros = new ParamStruct[6]; cls_DAL.agregar_datos_estructura_parametros(ref parametros, 0, "@Codigo", SqlDbType.Int, _codigo); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 1, "@ID_Consecutivo", SqlDbType.VarChar, _id_consecutivo); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 2, "@Descripcion", SqlDbType.VarChar, _descripcion); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 3, "@Prefijo", SqlDbType.VarChar, _prefijo); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 4, "@Rango_inicial", SqlDbType.Int, _rango_inicial); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 5, "@Rango_final", SqlDbType.Int, _rango_final); cls_DAL.conectar(conexion, ref mensaje_error, ref numero_error); cls_DAL.ejecuta_sqlcommand(conexion, sql, true, parametros, ref mensaje_error, ref numero_error); if (numero_error != 0) { //insertar en la table de errores HttpContext.Current.Response.Redirect("Error.aspx?error=" + numero_error.ToString() + "&men=" + mensaje_error); cls_DAL.desconectar(conexion, ref mensaje_error, ref numero_error); } else { Bitacora bitacora = new Bitacora(); bitacora.usuario = System.Web.HttpContext.Current.User.Identity.Name; bitacora.codigo_registro = 1; bitacora.tipo = "Modificar"; bitacora.descripcion = "Se actualizó un elemento en la tabla Consecutivo con ID: " + _codigo; bitacora.detalle = "Datos insertados, Consecutivo: " + id_consecutivo + ", Prefijo: " + prefijo + ", Rango inicial: " + rango_inicial + ", Rango final: " + rango_final; bitacora.agregar_bitacora(); cls_DAL.desconectar(conexion, ref mensaje_error, ref numero_error); } } }
public void modifica_reservacion() { conexion = cls_DAL.trae_conexion("V-Vuelos", ref mensaje_error, ref numero_error); if (conexion == null) { //insertar en la table de errores HttpContext.Current.Response.Redirect("Error.aspx?error=" + numero_error.ToString() + "&men=" + mensaje_error); } else { sql = "usp_modifica_reservacion"; ParamStruct[] parametros = new ParamStruct[6]; cls_DAL.agregar_datos_estructura_parametros(ref parametros, 0, "@ID", SqlDbType.Int, _id); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 1, "@ID_Consecutivo", SqlDbType.Int, _id_consecutivo); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 2, "@Usuario", SqlDbType.VarChar, _usuario); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 3, "@Booking_id", SqlDbType.Int, _booking_id); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 4, "@Vuelo", SqlDbType.Int, _vuelo); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 5, "@Cantidad_boletos", SqlDbType.Int, _cantidad_boletos); cls_DAL.conectar(conexion, ref mensaje_error, ref numero_error); cls_DAL.ejecuta_sqlcommand(conexion, sql, true, parametros, ref mensaje_error, ref numero_error); if (numero_error != 0) { //insertar en la table de errores HttpContext.Current.Response.Redirect("Error.aspx?error=" + numero_error.ToString() + "&men=" + mensaje_error); cls_DAL.desconectar(conexion, ref mensaje_error, ref numero_error); } else { Bitacora bitacora = new Bitacora(); bitacora.usuario = System.Web.HttpContext.Current.User.Identity.Name; bitacora.codigo_registro = 2; bitacora.tipo = "Modificar"; bitacora.descripcion = "Se modificó un elemento en la tabla Reservacion_Boletos"; bitacora.detalle = "Consecutivo: " + id_consecutivo + ", Usuario: " + usuario + ", Booking ID: " + booking_id + ", Vuelo: " + vuelo + ", Cantidad de Boletos: " + cantidad_boletos; bitacora.agregar_bitacora(); cls_DAL.desconectar(conexion, ref mensaje_error, ref numero_error); } } }
public void agregar_historial() { conexion = cls_DAL.trae_conexion("V-Vuelos", ref mensaje_error, ref numero_error); if (conexion == null) { //insertar en la table de errores HttpContext.Current.Response.Redirect("Error.aspx?error=" + numero_error.ToString() + "&men=" + mensaje_error); } else { sql = "usp_inserta_historial"; ParamStruct[] parametros = new ParamStruct[5]; cls_DAL.agregar_datos_estructura_parametros(ref parametros, 0, "@ID_consecutivo", SqlDbType.Int, _id_consecutivo); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 1, "@Usuario", SqlDbType.VarChar, _usuario); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 2, "@Metodo_pago", SqlDbType.Int, _metodo_pago); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 3, "@Monto", SqlDbType.Decimal, _monto); cls_DAL.agregar_datos_estructura_parametros(ref parametros, 4, "@Numero_vuelo", SqlDbType.Int, _numero_vuelo); cls_DAL.conectar(conexion, ref mensaje_error, ref numero_error); cls_DAL.ejecuta_sqlcommand(conexion, sql, true, parametros, ref mensaje_error, ref numero_error); if (numero_error != 0) { //insertar en la table de errores HttpContext.Current.Response.Redirect("Error.aspx?error=" + numero_error.ToString() + "&men=" + mensaje_error); cls_DAL.desconectar(conexion, ref mensaje_error, ref numero_error); } else { Bitacora bitacora = new Bitacora(); bitacora.usuario = System.Web.HttpContext.Current.User.Identity.Name; bitacora.codigo_registro = 1; bitacora.tipo = "Agregar"; bitacora.descripcion = "Se insertó un nuevo elemento en la tabla Historial_Transacciones"; bitacora.detalle = "Datos insertados, Consecutivo: " + id_consecutivo + ", Usuario: " + usuario + ", Método de Pago: " + metodo_pago + ", Monto: " + monto + ", Número de vuelo"; bitacora.agregar_bitacora(); cls_DAL.desconectar(conexion, ref mensaje_error, ref numero_error); } } }
public bool eliminar_reservacion(int ID) { conexion = cls_DAL.trae_conexion("V-Vuelos", ref mensaje_error, ref numero_error); if (conexion == null) { //insertar en la table de errores HttpContext.Current.Response.Redirect("Error.aspx?error=" + numero_error.ToString() + "&men=" + mensaje_error); return(false); } else { sql = "usp_eliminar_reservacion"; ParamStruct[] parametros = new ParamStruct[1]; cls_DAL.agregar_datos_estructura_parametros(ref parametros, 0, "@ID", SqlDbType.Int, ID); cls_DAL.conectar(conexion, ref mensaje_error, ref numero_error); cls_DAL.ejecuta_sqlcommand(conexion, sql, true, parametros, ref mensaje_error, ref numero_error); if (numero_error != 0) { //insertar en la table de errores HttpContext.Current.Response.Redirect("Error.aspx?error=" + numero_error.ToString() + "&men=" + mensaje_error); cls_DAL.desconectar(conexion, ref mensaje_error, ref numero_error); return(false); } else { Bitacora bitacora = new Bitacora(); bitacora.usuario = System.Web.HttpContext.Current.User.Identity.Name; bitacora.codigo_registro = 3; bitacora.tipo = "Eliminar"; bitacora.descripcion = "Se eliminó un elemento en la tabla Reservacion_Boletos"; bitacora.detalle = "ID eliminado: " + id; bitacora.agregar_bitacora(); cls_DAL.desconectar(conexion, ref mensaje_error, ref numero_error); return(true); } } }