示例#1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Conectarse conexion = new Conectarse();

            conexion.abrir();
            mostrarlogo();
        }
示例#2
0
        private void btnSacarVenta_Click(object sender, EventArgs e)
        {
            Conectarse n = new Conectarse();


            if (dataGridViewVenta.SelectedRows.Count > 0)
            {
                idCodigo = dataGridViewVenta.CurrentRow.Cells["Codigo"].Value.ToString();

                if (MessageBox.Show("Desea quitar este articulo?", "Alerta!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    dataGridViewVenta.Rows.Remove(dataGridViewVenta.CurrentRow);


                    int suma = 0;
                    foreach (DataGridViewRow row in dataGridViewVenta.Rows)
                    {
                        suma += Convert.ToInt32(row.Cells["Total"].Value);
                    }

                    lPrecio.Text   = suma.ToString();
                    lblVuelto.Text = "0";
                }
            }
        }
        private void verProductos_Load(object sender, EventArgs e)
        {
            Conectarse conexion = new Conectarse();

            conexion.abrir();
            conexion.llenarComboBox(cbxListarCategoria);
            listarAutomatico();
        }
示例#4
0
        private void nuevoProduct_Load(object sender, EventArgs e)
        {
            Conectarse conexion = new Conectarse();

            conexion.abrir();
            mostrarDatos();
            conexion.autoCompletar(txtCategoria);
        }
示例#5
0
        private void button1_Click(object sender, EventArgs e)
        {
            Conectarse n = new Conectarse();



            if (txtCodigo.Text == "")
            {
                MessageBox.Show("No se puede actualizar ", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            if (txtNombreArticulo.Text == "")
            {
                MessageBox.Show("Campo Vacio ", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            if (txtStock.Text == "")
            {
                MessageBox.Show("Campo Vacio ", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            if (txtPrecio.Text == "")
            {
                MessageBox.Show("Campo Vacio ", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            if (txtCategoria.Text == "")
            {
                MessageBox.Show("Campo Vacio ", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else

            if (n.Existe(Convert.ToInt32(txtCodigo.Text)))
            {
                int    Codigo         = int.Parse(txtCodigo.Text);
                String nombreArticulo = txtNombreArticulo.Text;
                int    Stock          = int.Parse(txtStock.Text) + Convert.ToInt32(txtSumarStock.Text);
                int    precioCompra   = int.Parse(txtPrecio.Text);
                String categoria      = txtCategoria.Text;

                n.actualizarArticulo(Codigo, nombreArticulo, Stock, precioCompra, categoria);

                MessageBox.Show("Datos actualizado");

                txtCodigo.Text         = "";
                txtNombreArticulo.Text = "";
                txtStock.Text          = "";
                txtPrecio.Text         = "";
                txtCategoria.Text      = "";
                txtSumarStock.Text     = "";

                mostrarDatos();
            }
            else
            {
                MessageBox.Show("Este registro no existe", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        private void btnListarTodo_Click(object sender, EventArgs e)
        {
            Conectarse n = new Conectarse();

            n.listarTodo(dataGridView2);
            dataGridView2.Columns[0].HeaderText = "Codigo";
            dataGridView2.Columns[1].HeaderText = "Nombre Articulo";
            dataGridView2.Columns[2].HeaderText = "Stock";
            dataGridView2.Columns[3].HeaderText = "Precio";
            dataGridView2.Columns[4].HeaderText = "Fecha de Registro";
            dataGridView2.Columns[5].HeaderText = "Categoria";

            this.dataGridView2.Columns[3].DefaultCellStyle.Format = "c";
        }
        private void btnListarNombre_Click(object sender, EventArgs e)
        {
            if (cbxListarCategoria.Text == "Categorias")
            {
                MessageBox.Show("Seleccione una categoria", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                Conectarse n = new Conectarse();
                //  int Codigo = int.Parse(txtBuscador.Text);
                String Categoria = cbxListarCategoria.Text;

                n.listarNombre(dataGridView2, Categoria);
                dataGridView2.EnableHeadersVisualStyles = false;
            }
        }
        private void listarAutomatico()
        {
            Conectarse n = new Conectarse();

            n.listarTodo(dataGridView2);
            dataGridView2.Columns[0].HeaderText = "Codigo";
            dataGridView2.Columns[1].HeaderText = "Nombre Articulo";
            dataGridView2.Columns[2].HeaderText = "Stock";
            dataGridView2.Columns[3].HeaderText = "Precio";
            dataGridView2.Columns[4].HeaderText = "Fecha de Registro";
            dataGridView2.Columns[5].HeaderText = "Categoria";

            this.dataGridView2.Columns[3].DefaultCellStyle.Format = "c";

            dataGridView2.EnableHeadersVisualStyles = false;
        }
示例#9
0
        private void mostrarDatos()
        {
            Conectarse n = new Conectarse();

            n.listarTodo(dataGridViewAgregar);
            dataGridViewAgregar.Columns[0].HeaderText = "Codigo";
            dataGridViewAgregar.Columns[1].HeaderText = "Nombre ";
            dataGridViewAgregar.Columns[2].HeaderText = "Stock";
            dataGridViewAgregar.Columns[3].HeaderText = "Precio";
            dataGridViewAgregar.Columns[4].HeaderText = "Fecha ";
            dataGridViewAgregar.Columns[5].HeaderText = "Categoria";

            this.dataGridViewAgregar.Columns[3].DefaultCellStyle.Format = "c";

            dataGridViewAgregar.EnableHeadersVisualStyles = false;
        }
示例#10
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            Conectarse n = new Conectarse();


            if (dataGridViewAgregar.SelectedRows.Count > 0)
            {
                idCodigo = dataGridViewAgregar.CurrentRow.Cells["Codigo"].Value.ToString();

                if (MessageBox.Show("Seguro desea borrar este dato?", "Alerta!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    n.eliminarArticulo(Convert.ToInt32(idCodigo));


                    mostrarDatos();
                }
                else
                {
                    MessageBox.Show("Dato no eliminado", "Advertencia!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
        //exportar a excel
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            Conectarse n = new Conectarse();

            n.ExportarExcel(dataGridView2);
        }
示例#12
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            Conectarse n = new Conectarse();

            //if para validar que ningun campoeste vacio
            if (txtCodigo.Text == "")
            {
                MessageBox.Show("Ingrese un Registro", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            else

            {
                if (txtNombreArticulo.Text == "")
                {
                    MessageBox.Show("Hace falta el nombre del articulo", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

                else

                {
                    if (txtCategoria.Text == "")
                    {
                        MessageBox.Show("Hace falta la cetegoria del producto", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                    else

                    {
                        if (txtStock.Text == "")
                        {
                            MessageBox.Show("Hace falta el stock del producto", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }

                        else
                        {
                            if (txtPrecio.Text == "")
                            {
                                MessageBox.Show("Porfavor ingrese el precio del producto", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }

                            else
                            {
                                //if para validar si existe el registro

                                if (n.Existe(Convert.ToInt32(txtCodigo.Text)))
                                {
                                    MessageBox.Show("Este registro ya existe", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                }

                                else
                                {
                                    //guardar el articulo
                                    int    Codigo         = int.Parse(txtCodigo.Text);
                                    String nombreArticulo = txtNombreArticulo.Text;
                                    int    Stock          = int.Parse(txtStock.Text);
                                    int    precioCompra   = int.Parse(txtPrecio.Text);
                                    String Categoria      = txtCategoria.Text;
                                    n.GuardarArticulos(Codigo, nombreArticulo, Stock, precioCompra, Categoria);

                                    MessageBox.Show("Registro completado");

                                    txtCodigo.Text         = "";
                                    txtNombreArticulo.Text = "";
                                    txtStock.Text          = "";
                                    txtPrecio.Text         = "";
                                    txtCategoria.Text      = "";

                                    mostrarDatos();
                                }
                            }
                        }
                    }
                }
            }
        }