Exemplo n.º 1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas();
            if (!validar())
            {
                pro = new conexiones_BD.clases.productos(
                    txtCodigo.Text,
                    txtnombreP.Text.ToUpper(),
                    fe.fechaMysql(fecha),
                    "60",
                    "53");

                sp = new conexiones_BD.clases.sucursales_productos(
                    sesion.DatosRegistro[1],
                    "0",
                    "2",
                    "4",
                    "1",
                    "1000",
                    precio.Value.ToString(),
                    "0.0",
                    "0.0",
                    "0.0",
                    "1");

                op = new conexiones_BD.operaciones();
                if (op.transaccionProductos_Presentaciones_Proveedores(generaProveedores(), generaPresentaciones(), pro, sp) > 0)
                {
                    MessageBox.Show("El producto se ingreso", "Exíto", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ingresado = true;

                    xm._AñadirProductos(txtCodigo.Text, txtnombreP.Text.ToUpper(), fe.fechaMysql(fecha), "60", "53", Convert.ToInt16(sesion.DatosRegistro[0]));
                    xm._AñadirSucursal_productos(sesion.DatosRegistro[1],
                                                 "0",
                                                 "2",
                                                 "4",
                                                 "1",
                                                 "1000",
                                                 precio.Value.ToString(),
                                                 "0.0",
                                                 "0.0",
                                                 "0.0",
                                                 "1",
                                                 txtCodigo.Text, Convert.ToInt16(sesion.DatosRegistro[0]));
                    xm._AñadirProvedores_productos("2", "0", txtCodigo.Text, Convert.ToInt16(sesion.DatosRegistro[0]));
                    xm._AñadirPrese_prod("0", "1", "1", precio.Value.ToString(), "2", "2", txtCodigo.Text, Convert.ToInt16(sesion.DatosRegistro[0]));


                    this.Close();
                }
                else
                {
                    MessageBox.Show("El producto no se pudo ingresar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 2
0
        private void guarda()
        {
            utilitarios.maneja_fechas fe = new utilitarios.maneja_fechas();
            string kar = "2";

            if (!validar())
            {
                if (!validarExistencias())
                {
                    pro = new conexiones_BD.clases.productos(
                        txtCodigo.Text,
                        txtnombreP.Text.ToUpper(),
                        fe.fechaMysql(fecha),
                        listaCategoria.SelectedValue.ToString(),
                        listaMarca.SelectedValue.ToString());

                    if (chkKardex.Checked)
                    {
                        kar = "1";
                    }
                    sp = new conexiones_BD.clases.sucursales_productos(
                        listaSucursal.SelectedValue.ToString(),
                        "0",
                        listaMayoreo.SelectedValue.ToString(),
                        listaUtilidadDetalle.SelectedValue.ToString(),
                        listaEstante.SelectedValue.ToString(),
                        existencias.Value.ToString(),
                        precioVD.Value.ToString(),
                        precioCD.Value.ToString(),
                        precioVM.Value.ToString(),
                        precioCM.Value.ToString(),
                        kar);

                    op = new conexiones_BD.operaciones();
                    if (op.transaccionProductos_Presentaciones_Proveedores(generaProveedores(), generaPresentaciones(), pro, sp) > 0)
                    {
                        MessageBox.Show("Los productos se ingresarón", "Exíto", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        xm._AñadirProductos(txtCodigo.Text,
                                            txtnombreP.Text.ToUpper(),
                                            fe.fechaMysql(fecha),
                                            listaCategoria.SelectedValue.ToString(),
                                            listaMarca.SelectedValue.ToString(), Convert.ToInt16(sesion.DatosRegistro[0]));

                        xm._AñadirSucursal_productos(
                            listaSucursal.SelectedValue.ToString(),
                            "0",
                            listaMayoreo.SelectedValue.ToString(),
                            listaUtilidadDetalle.SelectedValue.ToString(),
                            listaEstante.SelectedValue.ToString(),
                            existencias.Value.ToString(),
                            precioVD.Value.ToString(),
                            precioCD.Value.ToString(),
                            precioVM.Value.ToString(),
                            precioCM.Value.ToString(),
                            kar, txtCodigo.Text, Convert.ToInt16(sesion.DatosRegistro[0]));

                        this.generarProveedoresBase_datos();
                        this.generaPresentancionesBase();

                        vaciar();
                    }
                    else
                    {
                        MessageBox.Show("Los productos no se pudierón ingresar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }