Пример #1
0
        public void agregarCategoriasP(String nombre)
        {
            Conectar con = new Conectar();

            if (nombre != String.Empty)
            {
                dr = con.getSqlQuery("Select * From Categoria_Productos where nombreCategoria ='" + nombre + "'");

                if (dr.Read())
                {
                    MessageBox.Show("El nombre de la categoria ya existe!.");
                }
                else
                {
                    String cadena = "Insert Into Categoria_Productos(nombreCategoria)";
                    cadena += "Values('" + nombre + "')";
                    con.Query(cadena);
                    con.Desconectar();
                }
            }
            else
            {
                MessageBox.Show("Por favor rellene el campo Nombre!.");
            }
        }
Пример #2
0
 private void CargarCategoriasCombo()
 {
     rows = cn.getSqlQuery("Select * from Categoria_Productos");
     cbxCategoria.Text = "--Seleccione--";
     while (rows.Read())
     {
         cbxCategoria.Items.Add(rows["nombreCategoria"]);
     }
 }
Пример #3
0
        private void CargarCategoriasCombo()
        {
            cn.Conectarx();
            String cadena = "Select * from Categoria_Productos where id_CatProducto not in (" + id + ")";

            rows       = cn.getSqlQuery(cadena);
            cbxCP.Text = "--Seleccione--";
            while (rows.Read())
            {
                cbxCP.Items.Add(rows["id_CatProducto"] + " - " + rows["nombreCategoria"]);
            }
        }
Пример #4
0
        public int capturarIdCategoria(String nombre)
        {
            Conectar cn = new Conectar();

            id = cn.getSqlQuery("Select id_CatProducto from Categoria_Productos where nombreCategoria ='" + nombre + "'");

            if (id.Read())
            {
                idCategoria = Convert.ToInt32(id["id_CatProducto"]);
            }

            return(this.idCategoria);
        }
        private void CargarDatosClientes()
        {
            // Consultamos si existe el rut del cliente
            datos = cn.getSqlQuery("Select * From Clientes WHERE Rut ='" + mskRut.Text + "'");

            if (datos.Read())
            {
                // Cargamos datos del cliente en los txtbox en el caso que existe
                id_cliente       = Convert.ToInt32(datos["id_cliente"]);
                txtNombre.Text   = Convert.ToString(datos["NombreCliente"]);
                txtTelefono.Text = Convert.ToString(datos["Telefono"]);
                txtFecha.Text    = Convert.ToString(datos["fecha_ingreso"]);

                // Habilitamos paso 2, buscar producto
                this.HabilitarBusqueda();
            }
            else
            {
                MessageBox.Show("El rut ingresado no existe en la base de datos! ");
            }
        }