Esempio n. 1
0
        public ObjConfiguracion TraerPorNombre(string NOMBRE)
        {
            DataTable        dt            = new ConexionMy().EjecutaConsultaDt("SELECT id, NOMBRE, VALOR FROM configuraciones WHERE NOMBRE='" + NOMBRE + "'");
            ObjConfiguracion configuracion = new ObjConfiguracion(dt.Rows[0]);

            return(configuracion);
        }
Esempio n. 2
0
        public int  CrearUsuario(int empresa_id, string usuario, string correo, string clave, string nombre, string apellidos)
        {
            int    id  = 0;
            string sql = "INSERT INTO BASE_USUARIOS(usuario, correo, clave,nombre, apellidos, empresa_id) values('" + usuario + "', '" + correo + "', '" + clave + "', '" + nombre + "', '" + apellidos + "'," + empresa_id + ")";

            id = new ConexionMy().EjecutaConsulta(sql);
            return(id);
        }
Esempio n. 3
0
 public DataTable Login(string nombreusuario, string password)
 {
     try
     {
         DataTable dt = new ConexionMy().EjecutaConsultaDt("select * from usuarios where usuario='" + nombreusuario + "' and clave='" + password + "'");
         return(dt);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 4
0
        public bool CrearPedidoDetalle(int idpedido, int idproducto, int cantidad, int valorunitario, int valortotal)
        {
            string sql = "INSERT INTO PEDIDO_DETALLE(idpedido,idproducto,cantidad, valorunitario, valortotal)values(" + idpedido + "," + idproducto + "," + cantidad + ", " + valorunitario + "," + valortotal + " ) ";
            int    id  = 0;

            id = new ConexionMy().EjecutaConsulta(sql);
            if (id != 0)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 5
0
        public ObjProducto TraerPorCodigo(string codigo)
        {
            ObjProducto producto = new ObjProducto();
            DataTable   dt       = new ConexionMy().EjecutaConsultaDt("SELECT * FROM " + nombretabla + " WHERE CODIGO='" + codigo + "'");

            if (dt.Rows.Count != 0)
            {
                producto = new ObjProducto(dt.Rows[0]);
            }

            return(producto);
        }
Esempio n. 6
0
        public ObjCaja consulta(int idcaja)
        {
            ObjCaja   caja  = new ObjCaja();
            string    query = "select * from  pos_cajas";
            DataTable dt    = new  ConexionMy().EjecutaConsultaDt(query);

            if (dt.Rows.Count != 0)
            {
                caja = new ObjCaja(dt.Rows[1]);
            }

            return(caja);
        }
Esempio n. 7
0
        public bool CambiarEstado(int estado, int idpedido)
        {
            string sql = " UPDATE PEDIDOS SET idestado =" + estado + " WHERE idpedido = " + idpedido + "";

            int id = 0;

            id = new ConexionMy().EjecutaConsulta(sql);
            if (id != 0)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 8
0
        public bool CambiarEstado(int estado, int idmesa)
        {
            string sql = " UPDATE MESAS SET estado =" + estado + " WHERE idmesa = " + idmesa + "";

            int id = 0;

            id = new ConexionMy().EjecutaConsulta(sql);
            if (id != 0)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 9
0
        public bool VerificaExistencia(string email)
        {
            DataTable dt = new ConexionMy().EjecutaConsultaDt("SELECT * FROM USUARIOS WHERE EMAIL ='" + email + "'");

            if (dt.Rows.Count != 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 10
0
 public DataTable ListarUsuarios(int empresa_id)
 {
     try
     {
         string    sql = "SELECT * FROM BASE_USUARIOS WHERE empresa_id = " + empresa_id.ToString();
         DataTable dt  = new ConexionMy().EjecutaConsultaDt(sql);
         return(dt);
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 11
0
        public ObjUsuario Login(string nombreusuario, string password)
        {
            ObjUsuario usuario = new ObjUsuario();
            DataTable  dt      = new  ConexionMy().EjecutaConsultaDt("select * from usuarios where email='" + nombreusuario + "' and password='******'");

            if (dt.Rows.Count != 0)
            {
                DataRow dr = dt.Rows[0];
                usuario = new ObjUsuario(dr);
            }

            return(usuario);
        }
Esempio n. 12
0
 public DataTable ReporteMovimientos(string fecha, string fecha2)
 {
     try
     {
         string    query = "SELECT * FROM  vista_movimientos where fechahora between '" + fecha + "'  and '" + fecha2 + "' ";
         DataTable dt    = new ConexionMy().EjecutaConsultaDt(query);
         return(dt);
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 13
0
        public ObjTipoMovimiento TraerPorCodigo(string codigo)
        {
            ObjTipoMovimiento tipomovimiento = new ObjTipoMovimiento();
            string            query          = "SELECT IDTIPOMOVIMIENTO,CODIGO,NOMBRE FROM TBL_TIPOMOVIMIENTOS WHERE CODIGO='" + codigo + "'";
            DataTable         dt             = new ConexionMy().EjecutaConsultaDt(query);

            if (dt.Rows.Count != 0)
            {
                DataRow dr = dt.Rows[0];
                tipomovimiento = new ObjTipoMovimiento(dr);
            }

            return(tipomovimiento);
        }
Esempio n. 14
0
        public bool CrearPedido(int idpersonal, string referencia, int idmesa)
        {
            string fecha = DateTime.Now.ToString("yyyy-MM-dd");
            string sql   = "INSERT INTO PEDIDOS(idpersonal,fecha, referencia, idmesa, idestado)values(" + idpersonal + ",'" + fecha + "','" + referencia + "', '" + idmesa + "', 1) ";
            int    id    = 0;

            id = new ConexionMy().EjecutaConsulta(sql);
            if (id != 0)
            {
                new Mesas().CambiarEstado(2, idmesa);
                return(true);
            }
            return(false);
        }
Esempio n. 15
0
        public DataTable  RolesListar(int idusuario)
        {
            try
            {
                string    sql = "SELECT IDPERFIL, NOMBRE FROM VISTA_USUARIO_PERFILES where idusuario=" + idusuario;
                DataTable dt  = new ConexionMy().EjecutaConsultaDt(sql);

                return(dt);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 16
0
        public List <ObjCategoriaServicio> Listar(long idempresa)
        {
            List <ObjCategoriaServicio> listacategorias = new List <ObjCategoriaServicio>();
            string    query = "SELECT * FROM TBL_CATEGORIAS_SERVICIOS WHERE Activo=1 AND IdEmpresa=" + idempresa.ToString() + "";
            DataTable dt    = new ConexionMy().EjecutaConsultaDt(query);

            foreach (DataRow dr in dt.Rows)
            {
                ObjCategoriaServicio objcategoria = new ObjCategoriaServicio(dr);
                listacategorias.Add(objcategoria);
            }

            return(listacategorias);
        }
Esempio n. 17
0
        public List <ObjBodega> ListadoBodegasporSede(int idsede)
        {
            List <ObjBodega> listadobodegas = new List <ObjBodega>();
            string           query          = "SELECT * FROM  bodegas WHERE IDSEDE=" + idsede.ToString() + "";
            DataTable        dt             = new ConexionMy().EjecutaConsultaDt(query);

            foreach (DataRow dr  in dt.Rows)
            {
                ObjBodega objbodega = new ObjBodega(dr);
                listadobodegas.Add(objbodega);
            }

            return(listadobodegas);
        }
Esempio n. 18
0
        public bool ActualizaPassword(string email, string password)
        {
            int id =
                id = new ConexionMy().EjecutaConsulta("UPDATE  TBL_USUARIOS SET PASSWORD ='******' WHERE EMAIL='" + email + "'");


            if (id != 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 19
0
        public List <ObjPersonal> Listar()
        {
            List <ObjPersonal> listapersonal = new List <ObjPersonal>();
            string             query         = "SELECT * FROM TBL_PERSONAL";
            DataTable          dt            = new ConexionMy().EjecutaConsultaDt(query);

            if (dt.Rows.Count != 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    ObjPersonal personal = new ObjPersonal(dr);
                    listapersonal.Add(personal);
                }
            }

            return(listapersonal);
        }
Esempio n. 20
0
        public List <ObjRol> GetPorUsuario(int idusuario)
        {
            List <ObjRol> roles = new List <ObjRol>();
            string        sql   = "SELECT * FROM VIW_USUARIOS_ROL WHERE idusuario =" + idusuario;
            DataTable     dt    = new ConexionMy().EjecutaConsultaDt(sql);

            if (dt.Rows.Count != 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    ObjRol rol = new ObjRol(dr);
                    roles.Add(rol);
                }
            }

            return(roles);
        }
Esempio n. 21
0
        public List <ObjServicio> Listar()
        {
            List <ObjServicio> listaservicios = new List <ObjServicio>();
            string             query          = "SELECT * FROM TBL_SERVICIOS";
            DataTable          dt             = new ConexionMy().EjecutaConsultaDt(query);

            if (dt.Rows.Count != 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    ObjServicio servicio = new ObjServicio(dr);
                    listaservicios.Add(servicio);
                }
            }

            return(listaservicios);
        }
Esempio n. 22
0
        public List <ObjProducto> Listar()
        {
            List <ObjProducto> productos = new List <ObjProducto>();
            string             query     = "SELECT * FROM pos_productos";
            DataTable          dt        = new ConexionMy().EjecutaConsultaDt(query);

            if (dt.Rows.Count != 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    ObjProducto producto = new ObjProducto(dr);
                    productos.Add(producto);
                }
            }

            return(productos);
        }
Esempio n. 23
0
        public List <ObjProducto> ListarPorCategoria(int idcategoria)
        {
            List <ObjProducto> productos = new List <ObjProducto>();
            string             query     = "SELECT * FROM " + nombretabla + " where categoria_id='" + idcategoria + "'";
            DataTable          dt        = new ConexionMy().EjecutaConsultaDt(query);

            if (dt.Rows.Count != 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    ObjProducto producto = new ObjProducto(dr);
                    productos.Add(producto);
                }
            }

            return(productos);
        }
Esempio n. 24
0
        public List <ObjProducto> Buscar(string descripcion, string codigo)
        {
            List <ObjProducto> productos = new List <ObjProducto>();
            string             query     = "SELECT * FROM " + nombretabla + " WHERE NOMBRE LIKE'%" + descripcion + " %'";
            DataTable          dt        = new ConexionMy().EjecutaConsultaDt(query);

            if (dt.Rows.Count != 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    ObjProducto producto = new ObjProducto(dr);
                    productos.Add(producto);
                }
            }

            return(productos);
        }
Esempio n. 25
0
        public bool AsociaCategorias(string codigoproducto, List <ObjCategoria> categorias)
        {
            int  idproducto = TraerPorCodigo(codigoproducto).Id;
            bool retorno    = false;

            foreach (ObjCategoria categoria in categorias)
            {
                int id = 0;
                id = new ConexionMy().EjecutaConsulta("INSERT INTO NAV_CATEGORIAPRODUCTOS(Idcategoria, IdProducto) values('" + categoria.Id + "','" + idproducto + "')");

                if (id != 0)
                {
                    retorno = true;
                }
            }


            return(retorno);
        }
Esempio n. 26
0
        public bool GeneraMovimiento(long productoId, long tipoMovimientoId, int cantidad, string numeroDocumento, int ubicacionOrigen, int ubicacionDestino)
        {
            try
            {
                DateTime fecha   = DateTime.Now;
                bool     retorno = false;
                int      id      = 0;
                string   query   = "INSERT INTO movimientos(productoId,tipoMovimientoId,cantidad, nroDocumento, fecha,hora, ubicacionOrigen, ubicacionDestino )" +
                                   "VALUES(" + productoId + "," + tipoMovimientoId + ", " + cantidad + ", '" + numeroDocumento + "','" + fecha.ToString("yyyy-MM-dd") + "','" + fecha.ToString("HH:mm:ss") + "', " + ubicacionOrigen + ", " + ubicacionDestino + ")";
                id = new ConexionMy().EjecutaConsulta(query);
                if (id != 0)
                {
                    retorno = true;
                }

                return(retorno);
            }
            catch (Exception)
            {
                throw;
            }
        }