public DataTable Login(string usuario, string password) { string passworDesencriptada = HCSoft.Util.Seguridad.Encriptar(password); DataTable dt = new HCSoft.Util.ConexionMy().EjecutaConsultaDt("SELECT * FROM base_usuarios WHERE usuario='" + usuario + "' and clave='" + passworDesencriptada + "' "); return(dt); }
public DataTable ListarTodo() { try { string sql = "SELECT IDPERFIL, NOMBRE FROM PERFILES"; DataTable dt = new HCSoft.Util.ConexionMy().EjecutaConsultaDt(sql); return(dt); } catch (Exception) { throw; } }
public DataTable GetPorUsuario(int idusuario) { try { string sql = "SELECT IDPERFIL, NOMBRE FROM VISTA_USUARIO_PERFILES where idusuario=" + idusuario; DataTable dt = new HCSoft.Util.ConexionMy().EjecutaConsultaDt(sql); return(dt); } catch (Exception) { throw; } }
public bool Ingresar(string nombre, int categoriaId) { try { int id = 0; id = new HCSoft.Util.ConexionMy().EjecutaConsulta("INSERT agencia_servicios(nombre, categoriaId) VALUES('" + nombre + "', '" + categoriaId + "') "); if (id != 0) { return(true); } return(false); } catch (Exception) { throw; } }
public bool Registrar(string nombre, string email, int negocio_id) { try { int resultado = new HCSoft.Util.ConexionMy().EjecutaConsulta("INSERT INTO negocios_contacto(nombre, email,negocio_id) values('" + nombre + "', '" + email + "', " + negocio_id + ")"); if (resultado != 0) { return(true); } return(false); } catch (Exception) { throw; } }
public bool Actualizar(string nombre, int servicioId, int categoriaId) { try { int id = 0; id = new HCSoft.Util.ConexionMy().EjecutaConsulta("UPDATE agencia_servicios SET nombre='" + nombre + "', categoriaId=" + categoriaId + " WHERE id =" + servicioId); if (id != 0) { return(true); } return(false); } catch (Exception) { throw; } }
public bool Eliminar(int usuarioId) { try { int id = 0; id = new HCSoft.Util.ConexionMy().EjecutaConsulta(" UPDATE base_usuarios SET eliminado=1 WHERE id =" + usuarioId); if (id != 0) { return(true); } return(false); } catch (Exception) { throw; } }
public bool Actualizar(string nombre, string email, string password, string usuario, bool estado, int usuarioId, string imagen) { try { int id = 0; id = new HCSoft.Util.ConexionMy().EjecutaConsulta("UPDATE base_usuarios SET nombre ='" + nombre + "', email='" + email + "',clave='" + password + "', usuario='" + usuario + "', estado=" + estado + ", imagen ='" + imagen + "' where id=" + usuarioId + ""); if (id != 0) { return(true); } return(false); } catch (Exception) { throw; } }
public bool Guardar(int usuarioId, int cajaId, int clienteId) { try { DateTime fecha = DateTime.Now; //Guarda Cabecera Documento int idventa = 0; idventa = new HCSoft.Util.ConexionMy().EjecutaConsulta("INSERT INTO ventas(cajaId,usuarioId, clienteId, fecha, hora) VALUES(" + cajaId + "," + usuarioId + ", " + clienteId + ", '" + fecha.ToString("yyyy-MM-dd") + "', '" + fecha.ToString("HH:mm:ss") + "' )"); return(false); } catch (Exception) { throw; } }
public bool Eliminar(int servicioId) { try { int id = 0; id = new HCSoft.Util.ConexionMy().EjecutaConsulta("UPDATE agencia_servicios SET estado=0 WHERE id =" + servicioId); if (id != 0) { return(true); } return(false); } catch (Exception) { throw; } }
public bool Actualizar(string nombre, int idcategoria) { try { int id = 0; id = new HCSoft.Util.ConexionMy().EjecutaConsulta("UPDATE agenda_categorias SET nombre ='" + nombre + "' where id=" + idcategoria.ToString()); if (id != 0) { return(true); } return(false); } catch (Exception) { throw; } }
public bool Insertar(string nombre, string email, string password, string usuario, string imagen) { try { DateTime fechahora = DateTime.Now; int id = 0; id = new HCSoft.Util.ConexionMy().EjecutaConsulta("insert into base_usuarios(nombre, email, clave,usuario, imagen, creado) values('" + nombre + "','" + email + "','" + password + "', '" + usuario + "','" + imagen + "','" + fechahora.ToString("yyyy-MM-dd H:mm:ss") + "')"); if (id != 0) { return(true); } return(false); } catch (Exception) { throw; } }
public bool Registrar(string nombre, int tipo_id) { try { int idrespuesta = new HCSoft.Util.ConexionMy().EjecutaConsultaId("INSERT INTO NEGOCIO(nombre) VALUES('" + nombre + "')"); if (idrespuesta != 0) { return(true); } else { return(false); } } catch (Exception) { throw; } }
public bool Insert(ObjComercio comercio) { try { int resultado = 0; DateTime fecha = DateTime.Now; resultado = new HCSoft.Util.ConexionMy().EjecutaConsulta("INSERT INTO base_comercios(email,password,base_tipo_comercio_id,fecha_registro) VALUES('" + comercio.Email + "','" + comercio.Password + "'," + comercio.TipoComercioId + ", '" + fecha.ToString("yyyy-MM-dd H:mm:ss") + "')"); if (resultado != 0) { return(true); } return(false); } catch (Exception) { throw; } }
public bool Guardar(int venta_id, int producto_id, int cantidad, int valor_unitario, int valor_total) { try { int id = 0; id = new HCSoft.Util.ConexionMy().EjecutaConsulta("INSERT INTO detalleventas(venta_id,producto_id,cantidad, valor_unitario, valor_total) VALUES(" + venta_id + "," + producto_id + ", " + cantidad + ", " + valor_unitario + ", " + valor_total + " )"); if (id != 0) { return(true); } return(false); } catch (Exception) { throw; } }
public bool Registrar(string nombre) { try { int id = 0; id = new HCSoft.Util.ConexionMy().EjecutaConsulta("INSERT INTO agenda_categorias(nombre) VALUES('" + nombre + "')"); if (id > 0) { return(true); } else { return(false); } } catch (Exception) { throw; } }
public int Get(int productoId) { try { int stock = 0; DataTable dt = new HCSoft.Util.ConexionMy().EjecutaConsultaDt("SELECT * FROM movimientos WHERE productoId=" + productoId); if (dt.Rows.Count > 0) { stock = Int32.Parse(dt.Rows[0]["cantidad"].ToString()); } return(stock); } catch (Exception) { throw; } }
public List <Objetos.Usuario> Lista() { try { List <Objetos.Usuario> listaRetorno = new List <Objetos.Usuario>(); DataTable dtUsuarios = new HCSoft.Util.ConexionMy().EjecutaConsultaDt("SELECT * FROM base_usuarios"); if (dtUsuarios.Rows.Count > 0) { string usuarios = new HCSoft.Util.Cache().Actualizar("usuarios", dtUsuarios); listaRetorno = JsonConvert.DeserializeObject <List <Objetos.Usuario> >(usuarios); } return(listaRetorno); } catch (Exception) { string usuarios = new HCSoft.Util.Cache().Lee("usuarios"); List <Objetos.Usuario> lista = JsonConvert.DeserializeObject <List <Objetos.Usuario> >(usuarios); return(lista); } }
public bool Registrar(string usuario, string nombre, string email, string password, int paisId) { try { int id = 0; string codigoActivacion = GeneraCodigo(15); id = new HCSoft.Util.ConexionMy().EjecutaConsulta("INSERT INTO usuarios(usuario,nombre, email, clave, paisId, codigoActivacion) VALUES('" + usuario + "', '" + nombre + "', '" + email + "','" + password + "', " + paisId + ", '" + codigoActivacion + "')"); if (id != 0) { if (new HCSoft.Base.Usuario().EnviarEmailRegistro(email, codigoActivacion)) { return(true); } } return(false); } catch (Exception) { throw; } }
public bool ActivarCuenta(string email, string codigo) { try { DataTable dtCuenta = new HCSoft.Util.ConexionMy().EjecutaConsultaDt("SELECT * FROM usuarios where email = '" + email + "' and alta = 0 and codigoActivacion='" + codigo + "' "); if (dtCuenta.Rows.Count > 0) { int id = 0; id = new HCSoft.Util.ConexionMy().EjecutaConsulta("UPDATE usuarios set alta =1 where email='" + email + "' and codigoActivacion ='" + codigo + "'"); if (id != 0) { return(true); } return(false); } return(false); } catch (Exception) { throw; } }