示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Connection.OpenConnection();
            MySqlDataReader reader = Class_.Producto.BuscarProducto(Connection.myConnection, textBox1.Text);

            if (reader.Read())
            {
                if (reader.GetBoolean(9))
                {
                    Class_.Producto   nProducto         = new Class_.Producto(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5), reader.GetFloat(6), reader.GetInt32(7), reader.GetString(8), reader.GetBoolean(9));
                    Consulta_Producto consulta_producto = new Consulta_Producto(nProducto, Connection);
                    Connection.CloseConnection();
                    this.Close();
                    consulta_producto.ShowDialog();
                }
                else
                {
                    MessageBox.Show("ID no existe");
                }
            }
            else
            {
                MessageBox.Show("ID no existe");
            }
            Connection.CloseConnection();
        }
示例#2
0
        private void buttonAgregarC_Click(object sender, EventArgs e)
        {
            if (textBoxNombreC.Text == "" || textBoxApellidosC.Text == "" || textBoxDireccionC.Text == "" || textBoxEmailC.Text == "" || textBoxTel.Text == "")
            {
                MessageBox.Show("Favor de llenar\nlos campos requeridos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (!email_bien_escrito(textBoxEmailC.Text) && textBoxRFC.Text.Length < 10)
                {
                    MessageBox.Show("Verifique que los campos esten escritos\ncorrectamente!");
                }
                else
                {
                    CConnection.OpenConnection();
                    Class_.Cliente nCliente = new Class_.Cliente(1, textBoxNombreC.Text, textBoxApellidosC.Text, textBoxDireccionC.Text, dateTimePickerFechaNac.Text, textBoxEmailC.Text, textBoxTel.Text
                                                                 , textBoxRFC.Text, textBoxDomFisc.Text, textBoxRazSoc.Text, textBoxCP.Text, textBoxPais.Text, textBoxEstado.Text, textBoxMunicipio.Text, 0, true);
                    Class_.Cliente.AgregarCliente(CConnection.myConnection, nCliente);

                    CConnection.CloseConnection();

                    MessageBox.Show("Captura Exitosa");

                    this.Close();
                }
            }
        }
示例#3
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Seguro que desea dar de baja\na este empleado?", "Confirmacion", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (result == DialogResult.Yes)
            {
                CConnection.OpenConnection();
                Class_.Empleado.BajaEmpleado(CConnection.myConnection, Nempleado.ID);
                CConnection.CloseConnection();
                this.Close();
            }
        }
示例#4
0
        private void buttonAccept_Click(object sender, EventArgs e)
        {
            imagen = imagen.Replace(@"\", @"\\");

            Connection.OpenConnection();
            Class_.Producto nProducto = new Class_.Producto(Producto.ID, textBoxNom.Text, comboBoxTipo.Text, comboBoxConsola.Text, comboBoxGenero.Text, comboBoxStatus.Text, float.Parse(textBoxPrec.Text), int.Parse(textBoxStock.Text), imagen, true);
            Class_.Producto.ModificarProducto(Connection.myConnection, nProducto);
            Connection.CloseConnection();

            MessageBox.Show("Datos Modificados");
            this.Close();
        }
示例#5
0
        private void LoadDataBuy()
        {
            Connection.OpenConnection();
            dataGridViewCompra.DataSource = Class_.Venta.MostrarCompras(Connection.myConnection);
            Connection.CloseConnection();

            dataGridViewCompra.Columns[2].Visible = false;
            dataGridViewCompra.Columns[3].Visible = false;
            dataGridViewCompra.Columns[4].Visible = false;
            dataGridViewCompra.Columns[5].Visible = false;
            dataGridViewCompra.Columns[6].Visible = false;
            dataGridViewCompra.Columns[7].Visible = false;
            dataGridViewCompra.Columns[1].Width   = 153;
        }
示例#6
0
        private int MaxId()
        {
            int max = 1;

            CConnection.OpenConnection();
            MySqlDataReader reader = Class_.Empleado.BuscarMaxId(CConnection.myConnection);

            if (reader.Read())
            {
                if (!reader.IsDBNull(0))
                {
                    max = reader.GetInt32(0); max++;
                }
            }
            CConnection.CloseConnection();
            return(max);
        }
示例#7
0
        private void LoadForm()
        {
            Connection.OpenConnection();
            MySqlDataReader readerVenta = Class_.Venta.BuscarVenta(Connection.myConnection, idSale);

            if (readerVenta.Read())
            {
                Class_.Venta venta = new Class_.Venta(readerVenta.GetInt32(0), readerVenta.GetString(1), readerVenta.GetString(2), readerVenta.GetString(3), readerVenta.GetBoolean(4), readerVenta.GetString(5), readerVenta.GetInt32(6), readerVenta.GetInt32(7));

                string[] fecha = venta.Fecha_y_Hora.Split(' ');
                labelFecha.Text = fecha[0] + "\n" + fecha[1];

                labelIDcliente.Text   = venta.ID_Cliente.ToString();
                labelPaymentType.Text = venta.TipoPago;
                labelSaldo.Text       = venta.Balance;
                if (!venta.Disponible)
                {
                    labelCancelada.Text = "CANCELADA";
                }

                Connection.CloseConnection();
                Connection.OpenConnection();

                MySqlDataReader readerCliente = Class_.Cliente.BuscarCliente(Connection.myConnection, venta.ID_Cliente.ToString());

                if (readerCliente.Read())
                {
                    labelNombreCliente.Text = readerCliente.GetString(1) + " " + readerCliente.GetString(2);
                    labelAdress.Text        = readerCliente.GetString(3);
                    labelTel.Text           = readerCliente.GetString(6);
                    labelEmail.Text         = readerCliente.GetString(5);
                    Connection.CloseConnection();
                }

                Connection.OpenConnection();

                MySqlDataReader readerEmpleado = Class_.Empleado.BuscarEmpleado(Connection.myConnection, venta.ID_Empleado.ToString());

                if (readerEmpleado.Read())
                {
                    labelNombreEmpleado.Text = readerEmpleado.GetString(1) + " " + readerEmpleado.GetString(2);
                }
            }
            Connection.CloseConnection();
        }
示例#8
0
        private void buttonListo_Click(object sender, EventArgs e)
        {
            if (email_bien_escrito(textBoxEmail.Text) && textBoxRFC.Text.Length > 9)
            {
                Connection.OpenConnection();
                Class_.Cliente nCliente = new Class_.Cliente(Cliente.ID, textBoxNombre.Text, textBoxApellidos.Text, textBoxDireccion.Text,
                                                             dateTimePicker1.Text, textBoxEmail.Text, textBoxTel.Text, textBoxRFC.Text, textBoxDomFiscal.Text, textBoxRazonSocial.Text, textBoxCP.Text,
                                                             textBoxPais.Text, textBoxEstado.Text, textBoxMunicipio.Text, float.Parse(textBoxSaldo.Text), true);
                Class_.Cliente.ModificarCliente(Connection.myConnection, nCliente);
                Connection.CloseConnection();

                MessageBox.Show("Datos Modificados");
                this.Close();
            }
            else
            {
                MessageBox.Show("Verifique que los datos esten bien escritos");
            }
        }
示例#9
0
        private void buttonEntrar_Click(object sender, EventArgs e)
        {
            CConnection.OpenConnection();
            MySqlCommand    command = new MySqlCommand("SELECT * FROM empleado WHERE idEmpleado = '" + textBoxNombre.Text + "' AND eContrasena = '" + textBoxContraseña.Text + "'", CConnection.myConnection);
            MySqlDataReader Reader  = command.ExecuteReader();

            if (Reader.Read())
            {
                Class_.Empleado nEmpleado = new Class_.Empleado(Reader.GetInt32(0), Reader.GetString(1), Reader.GetString(2), Reader.GetString(3), Reader.GetString(4), Reader.GetBoolean(5));

                if (nEmpleado.Status)
                {
                    if (nEmpleado.Puesto == "Gerente")
                    {
                        Menu_Principal_Administrador menu_principal_adm = new Menu_Principal_Administrador(nEmpleado, CConnection);
                        CConnection.CloseConnection();

                        this.Hide();
                        menu_principal_adm.ShowDialog();
                        this.Show();
                    }
                    else if (nEmpleado.Puesto == "Cajero")
                    {
                        Menu_Principal_Empleado menu_principal_emp = new Menu_Principal_Empleado(CConnection, nEmpleado);
                        CConnection.CloseConnection();

                        menu_principal_emp.ShowDialog();
                    }
                }
                else
                {
                    MessageBox.Show("ID ó Contraseña incorrectos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("ID ó Contraseña incorrectos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            CConnection.CloseConnection();
            textBoxNombre.Clear();
            textBoxContraseña.Clear();
        }
示例#10
0
        private void buttonCancelar_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Seguro que desea cancelar\nesta venta?", "Confirmacion", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (result == DialogResult.Yes)
            {
                IncreaseStock();
                Connection.OpenConnection();
                Class_.Venta.CancelarVenta(Connection.myConnection, idSale);
                Connection.CloseConnection();
                this.Close();
            }
        }
示例#11
0
 private void LoadData()
 {
     Connection.OpenConnection();
     dataGridView1.DataSource         = Class_.Producto.MostrarProductos(Connection.myConnection);
     dataGridView1.Columns[0].Width   = 40;
     dataGridView1.Columns[9].Visible = false;
     dataGridView1.Columns[8].Visible = false;
     Connection.CloseConnection();
     if (dataGridView1.RowCount > 0)
     {
         try
         {
             string imagen = dataGridView1.CurrentRow.Cells[9].Value.ToString();
             pictureBoxRimage.Image = Image.FromFile(imagen);
         }
         catch (Exception)
         {
             if (dataGridView1.CurrentRow.Cells[9].Value.ToString() != "")
             {
                 MessageBox.Show("Carátulas de videojuegos almacenadas en otro PC\nNo se mostraran las imagenes");
             }
         }
     }
 }
示例#12
0
        private void buttonCancelar_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Seguro que desea eliminar\neste producto?", "Confirmacion", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (result == DialogResult.Yes)
            {
                Connection.OpenConnection();
                Class_.Factura.CancelarFactura(Connection.myConnection, labelFolioD.Text);
                Connection.CloseConnection();
                this.Close();
            }
        }
示例#13
0
        private int MaxId()
        {
            int max = 1;

            Connection.OpenConnection();
            MySqlCommand    command = new MySqlCommand(String.Format("SELECT MAX(idFactura) AS idFactura FROM factura"), Connection.myConnection);
            MySqlDataReader reader  = command.ExecuteReader();

            if (reader.Read())
            {
                if (!reader.IsDBNull(0))
                {
                    max = reader.GetInt32(0); max++;
                }
            }
            Connection.CloseConnection();
            return(max);
        }
示例#14
0
        private int MaxId()
        {
            int max = 1;

            try
            {
                Connection.OpenConnection();
                MySqlDataReader reader = Class_.Venta.BuscarMaxId(Connection.myConnection);
                if (reader.Read())
                {
                    if (!reader.IsDBNull(0))
                    {
                        max = reader.GetInt32(0); max++;
                    }
                }
                Connection.CloseConnection();
            }
            catch (Exception)
            {
            }
            return(max);
        }