コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && label9.Text != "")
            {
                string resp = "";

                ClassVenta venta    = new ClassVenta();
                int        cantidad = Convert.ToInt32(textBox3.Text);
                decimal    total    = Convert.ToDecimal(label9.Text);
                int        cliente  = Convert.ToInt32(label10.Text);
                int        producto = Convert.ToInt32(label6.Text);

                resp = venta.IngresarVenta(dateTimePicker1.Value, cantidad, total, producto, cliente);
                MessageBox.Show(resp);


                if (resp == "La Venta se Registró con éxito.")

                {
                    //limpiar textbox
                    textBox1.Text = "";
                    textBox2.Text = "";
                    textBox3.Text = "";
                    label7.Text   = "";
                    textBox1.Focus();
                }
            }
            else
            {
                MessageBox.Show("Complete los campos.");
            }
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 0)
            {
                if (MessageBox.Show("¿Eliminar?", "Confirmación", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    string     resp   = "";
                    ClassVenta lgTipo = new ClassVenta();
                    resp = lgTipo.EliminarVenta(Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value.ToString()));
                    MessageBox.Show(resp);

                    ClassVistas lg = new ClassVistas();
                    {
                        this.dataGridView1.DataSource = lg.ListarVistaVenta();
                        this.dataGridView1.Refresh();
                    }
                }
                else
                {
                    //tus codigos
                }
            }
            else
            {
                MessageBox.Show("Debe seleccionar una fila");
            }
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string     resp  = "";
            ClassVenta venta = new ClassVenta();

            int     codigo   = Convert.ToInt32(textBox4.Text);
            int     cliente  = Convert.ToInt32(label10.Text);
            int     producto = Convert.ToInt32(label6.Text);
            int     cantidad = Convert.ToInt32(textBox3.Text);
            decimal total    = Convert.ToDecimal(label9.Text);

            resp = venta.ActualizarVenta(codigo, dateTimePicker1.Value, cantidad, total, producto, cliente);
            MessageBox.Show(resp);
        }