private void listBox1_DoubleClick(object sender, EventArgs e) { /* if (this.listBox1.SelectedIndex >= 0) { * this.listBox1.Items.RemoveAt(this.listBox1.SelectedIndex); * * * total -= precio; * }*/ string aux; aux = string.Concat(listBox1.SelectedItem); String[] separado; separado = aux.Split(':'); string[] resu = separado[1].Split(','); n_producto prod = new n_producto(); string resup2 = prod.obtenerproductoid(resu[0]); String[] separad; separad = resup2.Split(','); precio = Convert.ToUInt16(separad[1]); total = total - (precio * Convert.ToSingle(resu[2])); listBox1.Items.Remove(listBox1.SelectedItem); tbx_preciototal.Text = total.ToString(); }
private void busXnombre_KeyDown(object sender, KeyEventArgs e) { // tbx_id_producto.ReadOnly = true; dataGridView1.Visible = true; n_producto producto = new n_producto(); dataGridView1.DataSource = producto.getTablalike(busXnombre.Text); }
private void Transaccion_Load(object sender, EventArgs e) { dataGridView1.Visible = false; n_cliente cliente = new n_cliente(); data_Cliente.DataSource = cliente.getTabla(); n_producto producto = new n_producto(); dataProductos.DataSource = producto.getTabla(); }
private void btnEliminar_Click(object sender, EventArgs e) { ///MODIFICACIONES JOSE AL 2 DE FEBRERO n_detalle_de_venta reg2 = new n_detalle_de_venta(); reg2.eliminarDetalle(global); ///MODIFICACIONES JOSE AL 2 DE FEBRERO n_producto reg = new n_producto(); reg.eliminarProducto(global); MessageBox.Show("Eliminado correctamente"); dataProductos.DataSource = reg.getTabla(); }
private void btnModificar_Click(object sender, EventArgs e) { n_producto producto = new n_producto(); producto.actualizarProducto2(globalActualizar); ///System.IO.File.Move(nombreViejo + ".jpg", "newfilename"); MessageBox.Show("Modificado correctamente"); n_producto producto2 = new n_producto(); dataProductos.DataSource = producto2.getTabla(); }
private void Agregar_Proveedor_Load(object sender, EventArgs e) { timer1.Enabled = true; n_proveedor reg = new n_proveedor(); dgv_proveedor.DataSource = reg.getTabla(); n_producto pro = new n_producto(); dgv_productos.DataSource = pro.getTabla(); int resu; resu = reg.obtenerregistroproveedor(); resu = resu + 1; textBox_id.Text = resu.ToString(); }
private void tbx_id_producto_KeyDown(object sender, KeyEventArgs e) { dataGridView1.Visible = false; if (e.KeyCode == Keys.Enter) { n_producto prod = new n_producto(); string resup2 = prod.obtenerproductoid(tbx_id_producto.Text); String[] separado; separado = resup2.Split(','); precio = Convert.ToUInt16(separado[1]); tbx_nombre_producto.Text = separado[0]; int resu = prod.obtenerStock(Convert.ToInt16(tbx_id_producto.Text)); textBox1.Text = resu.ToString(); } }
private void btnLimpiar_Click(object sender, EventArgs e) { tbxAuxiliar.Text = String.Empty; tbxId.Text = String.Empty; tbxNombre.Text = String.Empty; //cbxMarca.Text = String.Empty; //cbxGenero.Text = String.Empty; //cbxPEGI.Text = String.Empty; tbx_genero.Text = String.Empty; tbx_Marca.Text = String.Empty; tbx_Pegi.Text = string.Empty; n_producto reg = new n_producto(); dataProductos.DataSource = reg.getTabla(); }
private void Lista_productos_Load(object sender, EventArgs e) { timer2.Enabled = true; n_producto n_prod = new n_producto(); dataProducto.DataSource = n_prod.getTablaInner(); n_marca marc = new n_marca(); n_pegi peg = new n_pegi(); foreach (DataGridViewRow row in dataProducto.Rows) { var stock = Convert.ToInt32(row.Cells[5].Value); /// MODIFICACIÓN JOSE AL 8/2/2019 if (stock <= 4 && stock > 0) { row.DefaultCellStyle.BackColor = Color.Red; } if (stock >= 5 && stock <= 19) { row.DefaultCellStyle.BackColor = Color.LightSalmon; } if (stock >= 20 && stock <= 999) { row.DefaultCellStyle.BackColor = Color.LightGreen; } /// MODIFICACIÓN JOSE AL 8/2/2019 //if (stock <= 4 && stock != 0) //{ // row.DefaultCellStyle.BackColor = Color.Red; //} //if (stock >= 5 && stock <= 15) //{ // row.DefaultCellStyle.BackColor = Color.LightSalmon; //} //if (stock >= 20 && stock <= 49) //{ // row.DefaultCellStyle.BackColor = Color.LightGreen; //} } }
private void Filtrar_Generos_Load(object sender, EventArgs e) { n_producto pro = new n_producto(); dgv_productos.DataSource = pro.getTabla(); n_genero generos = new n_genero(); groupBox1.Visible = false; groupBox2.Visible = false; groupBox3.Visible = false; dataGeneros.DataSource = generos.getTabla(); timer1.Enabled = true; }
private void Agregar_Producto_Load(object sender, EventArgs e) { n_genero gen = new n_genero(); dataGenero.DataSource = gen.getTabla(); //int cantFilasGeneros = dataGenero.Rows.Count-1; n_marca marc = new n_marca(); dataMarca.DataSource = marc.getTabla(); //int cantFilasMarcas = dataMarca.Rows.Count-1; n_pegi peg = new n_pegi(); dataPEGI.DataSource = peg.getTabla(); //int cantFilasPegis = dataPEGI.Rows.Count - 1; n_producto reg = new n_producto(); int resu; resu = reg.obtenercantidadderegistros(); resu = resu + 1; tbx_id.Text = resu.ToString(); //for (int i = 1; i <= cantFilasMarcas; i++) //{ // clx_marca.Items.Add(marc.get(i).getnombre()); //} //for (int i = 1; i <= cantFilasGeneros; i++) //{ // clx_genero.Items.Add(gen.get(i).getnombre()); //} //for (int i = 1; i <= cantFilasPegis; i++) //{ // clx_pegi.Items.Add(peg.get(i).getnombre()); //} }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex]; global = row.Cells["id_producto"].Value.ToString(); tbx_id_producto.Text = global; //globalModificar /*= global*/ = row.Cells["id_genero"].Value.ToString() + "," + row.Cells["descripcion"].Value.ToString(); n_producto prod = new n_producto(); string resup2 = prod.obtenerproductoid(global); String[] separado; separado = resup2.Split(','); precio = Convert.ToUInt16(separado[1]); tbx_nombre_producto.Text = separado[0]; int resu = prod.obtenerStock(Convert.ToInt16(global)); textBox1.Text = resu.ToString(); } }
private void Filtrar_Marcas_Load(object sender, EventArgs e) { groupBox1.Visible = false; groupBox2.Visible = false; groupBox3.Visible = false; n_producto pro = new n_producto(); dgv_prodcutos.DataSource = pro.getTabla(); timer1.Enabled = true; n_marca marc = new n_marca(); dataMarcas.DataSource = marc.getTabla(); /// OJO!!! MODIFICACION DEL DIA 9/02 ///tbx_id.Text = marc.get(posicion).getid_marca().ToString(); ///tbx_nombre.Text = marc.get(posicion).getnombre(); /// /// OJO!!! MODIFICACION DEL DIA 9/02 }
private void Filtrar_Productos_Load(object sender, EventArgs e) { timer1.Enabled = true; n_producto producto = new n_producto(); dataProductos.DataSource = producto.getTabla(); ////////////////////////////// /// ///// n_genero gen = new n_genero(); dataGenero.DataSource = gen.getTabla(); int cantFilasGeneros = dataGenero.Rows.Count - 1; ///dataGenero.Columns["id_genero"].Visible = false; n_marca marc = new n_marca(); dataMarca.DataSource = marc.getTabla(); int cantFilasMarcas = dataMarca.Rows.Count - 1; n_pegi peg = new n_pegi(); dataPegi.DataSource = peg.getTabla(); int cantFilasPegis = dataPegi.Rows.Count - 1; //for (int i = 1; i <= cantFilasMarcas; i++) //{ // cbxMarca.Items.Add(marc.get(i).getid_marca()); //} //for (int i = 1; i <= cantFilasGeneros; i++) //{ // cbxGenero.Items.Add(gen.get(i).getid_genero()); //} //for (int i = 1; i <= cantFilasGeneros; i++) //{ // cbxPEGI.Items.Add(peg.get(i).getid_pegi()); //} if (VariablesGlobales.tipoUsuario == "False") { btnModificar.Enabled = false; } if (VariablesGlobales.tipoUsuario == "False") { btnEliminar.Enabled = false; } if (VariablesGlobales.tipoUsuario == "False") { aviso.Visible = true; } if (VariablesGlobales.tipoUsuario == "True") { aviso.Visible = false; } ////////////////////////////// }
private void btnFiltrar_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(tbxId.Text) && string.IsNullOrEmpty(tbxNombre.Text) && string.IsNullOrEmpty(cbxGenero.Text) && string.IsNullOrEmpty(cbxMarca.Text) && string.IsNullOrEmpty(cbxPEGI.Text) && string.IsNullOrEmpty(tbxNombre.Text)) { n_producto reg = new n_producto(); dataProductos.DataSource = reg.getTabla(); } if (!string.IsNullOrEmpty(tbxId.Text)) { ((DataTable)dataProductos.DataSource).DefaultView.RowFilter = "id_producto=" + tbxId.Text; } if (!string.IsNullOrEmpty(tbx_Marca.Text)) { ((DataTable)dataProductos.DataSource).DefaultView.RowFilter = "id_marca=" + tbx_Marca.Text; } if (!string.IsNullOrEmpty(tbx_genero.Text)) { ((DataTable)dataProductos.DataSource).DefaultView.RowFilter = "id_genero=" + tbx_genero.Text; } if (!string.IsNullOrEmpty(tbx_Pegi.Text)) { ((DataTable)dataProductos.DataSource).DefaultView.RowFilter = "id_pegi=" + tbx_Pegi.Text; } if (!string.IsNullOrEmpty(tbxNombre.Text)) { ((DataTable)dataProductos.DataSource).DefaultView.RowFilter = "nombre=" + "'" + tbxNombre.Text + "'"; } //resumen.Text = tbxId.Text + tbxNombre.Text + cbxGenero.Text + cbxMarca.Text + cbxPEGI.Text; //((DataTable)dataProductos.DataSource).DefaultView.RowFilter = "id_marca=" + cbxMarca.Text // + " AND " + " id_genero=" + cbxGenero.Text; ///**************************************************************************************** //if (!string.IsNullOrEmpty(tbxId.Text) && !string.IsNullOrEmpty(tbxNombre.Text)) //{ // ((DataTable)dataProductos.DataSource).DefaultView.RowFilter = "id_producto=" + tbxId.Text + "AND nombre =" + "'" + tbxNombre.Text + "'"; //} if (!string.IsNullOrEmpty(tbx_genero.Text) && !string.IsNullOrEmpty(tbx_Marca.Text)) { ((DataTable)dataProductos.DataSource).DefaultView.RowFilter = "id_genero=" + tbx_genero.Text + "AND id_marca =" + "'" + tbx_Marca.Text + "'"; } if (!string.IsNullOrEmpty(tbx_genero.Text) && !string.IsNullOrEmpty(tbx_Pegi.Text)) { ((DataTable)dataProductos.DataSource).DefaultView.RowFilter = "id_genero=" + tbx_genero.Text + "AND id_pegi =" + "'" + tbx_Pegi.Text + "'"; } if (!string.IsNullOrEmpty(tbx_Marca.Text) && !string.IsNullOrEmpty(tbx_Pegi.Text)) { ((DataTable)dataProductos.DataSource).DefaultView.RowFilter = "id_marca=" + tbx_Marca.Text + "AND id_pegi =" + "'" + tbx_Pegi.Text + "'"; } if (!string.IsNullOrEmpty(tbx_genero.Text) && !string.IsNullOrEmpty(tbx_Marca.Text) && !string.IsNullOrEmpty(tbx_Pegi.Text)) { ((DataTable)dataProductos.DataSource).DefaultView.RowFilter = "id_genero=" + tbx_genero.Text + "AND id_marca =" + "'" + tbx_Marca.Text + "'" + "AND id_pegi =" + "'" + tbx_Pegi.Text + "'"; } //dv.RowFilter = "id > 0 AND index = 4"; }
private void btn_aceptar_Click(object sender, EventArgs e) { foreach (var item in listBox1.Items) { ListaProductos.Text += item.ToString() + "\n"; } n_venta reg = new n_venta(); int cont = 0; if (string.IsNullOrEmpty(tbx_cliente_id.Text)) { tbx_cliente_id.BackColor = Color.Red; cont++; } if (cont > 0) { MessageBox.Show("Falta ingresar campos"); } if (cont == 0) { if (printPreviewDialog1.ShowDialog() == DialogResult.OK) { printDocument1.Print(); } //////////////////////////////// n_producto prodd = new n_producto(); prodd.cargarVenta(tbx_cliente_id.Text, tbx_cliente_telefono.Text, tbx_preciototal.Text); foreach (String item in listBox1.Items) { string aux = item.ToString(); ///// String[] separado; separado = aux.Split(':'); string[] resu = separado[1].Split(','); //string resup2 = prod.obtenerproductoid(resu[0]); int id = Convert.ToInt16(resu[0]), sto = Convert.ToInt16(resu[2]); n_producto prod = new n_producto(); prod.actualizarStock(id, sto); int resuu = prodd.cargarDetalleVentas(id, sto); prodd.cargarDETALLECOMPLETO(id, sto, resuu); //MessageBox.Show(id.ToString()+" " + sto.ToString()); //MessageBox.Show(resuu.ToString()); } tbx_id_producto.Text = ""; textBox1.Text = ""; tbx_nombre_producto.Text = ""; tbx_cantidad_producto.Text = ""; tbx_preciototal.Text = ""; tbx_cliente_id.Text = ""; tbx_cliente_nombre.Text = ""; tbx_cliente_direccion.Text = ""; tbx_cliente_telefono.Text = ""; busXnombre.Text = ""; dataGridView1.Visible = false; listBox1.Items.Clear(); } }
private void button1_Click(object sender, EventArgs e) { int cont = 0; if (string.IsNullOrEmpty(tbx_nombre.Text)) { tbx_nombre.BackColor = Color.Red; cont++; } if (string.IsNullOrEmpty(tbx_precio.Text)) { tbx_precio.BackColor = Color.Red; cont++; } if (string.IsNullOrEmpty(tbx_desc.Text)) { tbx_desc.BackColor = Color.Red; cont++; } ///------------------------------------------------------ if (string.IsNullOrEmpty(tbx_Marca.Text)) { tbx_Marca.BackColor = Color.Red; cont++; } if (string.IsNullOrEmpty(tbx_Pegi.Text)) { tbx_Pegi.BackColor = Color.Red; cont++; } if (string.IsNullOrEmpty(tbx_Genero.Text)) { tbx_Genero.BackColor = Color.Red; cont++; } if (string.IsNullOrEmpty(tbx_Cant.Text)) { tbx_Cant.BackColor = Color.Red; cont++; } if (pictureBox1.Image == null) { error_portada.Visible = true; } ///--------------------------------------------------------- if (cont > 0) { MessageBox.Show("Falta ingresar campos"); } else { n_producto reg = new n_producto(); direccion = pictureBox1.ToString(); reg.AgregarProducto(tbx_id.Text, tbx_nombre.Text, tbx_Marca.Text, tbx_Genero.Text, tbx_Pegi.Text,tbx_Cant.Text, tbx_desc.Text, tbx_desc.Text, tbx_precio.Text); ///MessageBox.Show(direccion); File.Copy(nombre, Path.Combine(@"" + directory + "\\Portadas\\", Path.GetFileName(tbx_nombre.Text + ".jpg")), true); MessageBox.Show("Producto Agregado correctamente"); tbx_id.Text = "";tbx_nombre.Text = "";tbx_Marca.Text = "";tbx_Genero.Text = "";tbx_Pegi.Text = "";tbx_Cant.Text = "";tbx_desc.Text = "";tbx_desc.Text = "";tbx_precio.Text = ""; pictureBox1.Image = null; int resu; resu = reg.obtenercantidadderegistros(); resu = resu + 1; tbx_id.Text = resu.ToString(); } }