Exemple #1
0
        public int iuCodigoVenta(CodigoVenta codigoVenta)
        {
            sp_Pedidos spRequestPedidos = new sp_Pedidos();
            DataDB     data             = new DataDB("SIVEDIBDEntities");

            StoreProcedure SP = spRequestPedidos.iuCodigoVenta("SPR_IU_CODIGO_VENTA", codigoVenta);
            int            codigoProductoLista = data.ExecuteInsert(SP, "PO_NRESULT");

            return(codigoProductoLista);
        }
Exemple #2
0
        public StoreProcedure iuCodigoVenta(string spName, CodigoVenta codigoVenta)
        {
            StoreProcedure storeProcedure = new StoreProcedure();

            storeProcedure.Nombre     = spName;
            storeProcedure.Parametros = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@PI_CCODIGO_PRODUCTO",
                    SqlDbType     = System.Data.SqlDbType.VarChar,
                    Value         = codigoVenta.REFERENCIA
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_CCODIGO_VENTA",
                    SqlDbType     = System.Data.SqlDbType.VarChar,
                    Value         = codigoVenta.CODIGO_VENTA
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_OESTADO",
                    SqlDbType     = System.Data.SqlDbType.Bit,
                    Value         = codigoVenta.ESTADO
                },
                new SqlParameter()
                {
                    ParameterName = "@PI_OES_PRINCIPAL",
                    SqlDbType     = System.Data.SqlDbType.Bit,
                    Value         = codigoVenta.ES_PRINCIPAL
                },
                new SqlParameter()
                {
                    ParameterName = "@PO_NRESULT",
                    SqlDbType     = System.Data.SqlDbType.Int,
                    Direction     = System.Data.ParameterDirection.Output,
                    Value         = codigoVenta.CODIGO
                }
            };

            return(storeProcedure);
        }
Exemple #3
0
        private void btnAsignar_Click(object sender, EventArgs e)
        {
            if (validaCampos())
            {
                CodigoVenta codigoVenta = new CodigoVenta();
                bool        blnEstado, blnEsprincipal;
                string      strResultado;
                if (rdbActivo.Checked)
                {
                    codigoVenta.ESTADO = true;
                }
                else
                {
                    codigoVenta.ESTADO = false;
                }

                if (rdbEsPrincipal.Checked)
                {
                    codigoVenta.ES_PRINCIPAL = true;
                }
                else
                {
                    codigoVenta.ES_PRINCIPAL = false;
                }
                codigoVenta.CODIGO_PRODUCTO = intCodigoProducto;
                codigoVenta.CODIGO_VENTA    = txtCodigoVenta.Text.ToUpper();


                strResultado = Convert.ToString(ServicePedidos.iuCodigoVenta(codigoVenta));
                if (Information.IsNumeric(strResultado))
                {
                    llenaGrilla();
                    limpiaCampos();
                    txtCodigoVenta.Focus();
                }
                else
                {
                    MessageBox.Show(strResultado, "Error al grabar en BD", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
        }
Exemple #4
0
        private void CargaInformacion()
        {
            try
            {
                if (dtgCodigoVenta.Rows.Count > 0)
                {
                    pbrCarga.Value   = 0;
                    pbrCarga.Minimum = 0;
                    this.Cursor      = Cursors.Default;
                    pbrCarga.Maximum = dt.Rows.Count;
                    for (var i = 0; i <= dtgCodigoVenta.Rows.Count - 1; i++)
                    {
                        CodigoVenta codigoVenta = new CodigoVenta();
                        pbrCarga.Refresh();
                        pbrCarga.Value          = pbrCarga.Value + 1;
                        lblPorcentajeCarga.Text = Convert.ToInt32(pbrCarga.Value * 100 / (double)pbrCarga.Maximum) + "%";

                        codigoVenta.REFERENCIA   = dtgCodigoVenta.Rows[i].Cells[0].Value.ToString();
                        codigoVenta.CODIGO_VENTA = Convert.ToString(dtgCodigoVenta.Rows[i].Cells[1].Value);
                        codigoVenta.ESTADO       = Convert.ToInt32(dtgCodigoVenta.Rows[i].Cells[3].Value) == 1 ? true : false;
                        codigoVenta.ES_PRINCIPAL = Convert.ToInt32(dtgCodigoVenta.Rows[i].Cells[2].Value) == 1 ? true : false;
                        ServicePedidos.iuCodigoVenta(codigoVenta);
                    }
                    limpiaCampos();
                    MessageBox.Show("Archivo cargado exitosamente", "Carga Exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    lblPorcentajeCarga.Text = null;
                    pbrCarga.Value          = 0;
                    pbrCarga.Minimum        = 0;
                    pbrCarga.Refresh();
                }
                else
                {
                    MessageBox.Show("Seleccione un arhcivo para realizar la carga", "Validación", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }