예제 #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        validar();
        TextClave.Text.ToUpper();

        if (completado == true)
        {
            String Editar = "UPDATE dbo.product SET descripcion='" + TextDescripcion.Text + "', precio =" + precio + ", rentabilidad = " + rentabilidad + " where id='" + TextClave.Text + "'";
            ServiceE.IIEditarClient WD = new ServiceE.IIEditarClient();
            DataSet data = WD.EditDataProduct(Editar);

            string ESPECIFICO         = "select * from dbo.product where id='" + TextClave.Text + "'";
            ServiceB.IBuscarClient WS = new ServiceB.IBuscarClient();
            DataSet data1             = WS.GetEspecifico(ESPECIFICO);
            TextMostrar.DataSource = data1.Tables[0];
            TextMostrar.DataBind();

            ResultadoOperacion.Text = "Actualizado \n exitosamente";
            vaciarDatos();
        }
        else
        {
            ResultadoOperacion.Text = negativo;
        }
    }
예제 #2
0
    protected void VerTodos_Click(object sender, EventArgs e)
    {
        ServiceB.IBuscarClient WS = new ServiceB.IBuscarClient();
        DataSet data1             = WS.GetAll();

        TextMostrar.DataSource = data1.Tables[0];
        TextMostrar.DataBind();

        ResultadoOperacion.Text = "Todos los \nproductos mostrados";
    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ServiceB.IBuscarClient WS = new ServiceB.IBuscarClient();
        DataSet data1             = WS.GetAll();
        int     mayor             = TextMostrar.Rows.Count;

        if (mayor >= 0)
        {
            TextMostrar.DataSource = data1.Tables[0];
            TextMostrar.DataBind();
            ResultadoOperacion.Text = "Mostrando todos \n los productos";
        }
        else
        {
            ResultadoOperacion.Text = "Base de datos \n vacia";
        }
    }
예제 #4
0
    protected void Button1_Click1(object sender, EventArgs e)
    {
        VerTodos.Enabled = false;

        try
        {
            string ESPECIFICO         = "select * from dbo.product where id='" + TextClave.Text + "'";
            ServiceB.IBuscarClient WS = new ServiceB.IBuscarClient();
            DataSet data1             = WS.GetEspecifico(ESPECIFICO);
            TextMostrar.DataSource = data1.Tables[0];
            TextMostrar.DataBind();
            TextDescripcion.Text = TextMostrar.Rows[0].Cells[1].Text;
            TextPrecio.Text      = TextMostrar.Rows[0].Cells[2].Text;
            DropProvincia.Text   = TextMostrar.Rows[0].Cells[3].Text;

            ResultadoOperacion.Text += "-Producto encontrado \n -Puede editar datos en espacios luego pinche boton 'EDITAR'";
        }
        catch (Exception r)
        {
            ResultadoOperacion.Text = "No existe ID";
        };
    }
예제 #5
0
    protected void ButtonRegistra_Click1(object sender, EventArgs e)
    {
        validar();

        if (completado == true)
        {
            Boolean terminar = true;
            do
            {
                try
                {
                    String LLENAR = "INSERT INTO dbo.product(descripcion,precio, rentabilidad)values('" + descripcion + "'," + precio + "," + rentabilidad + ")";
                    ServiceA.IAgregarClient WD = new ServiceA.IAgregarClient();
                    DataSet data = WD.FillDataProduct(LLENAR);

                    string ESPECIFICO         = "select * from dbo.product where descripcion='" + descripcion + "' and precio=" + precio + "and rentabilidad=" + rentabilidad;
                    ServiceB.IBuscarClient WS = new ServiceB.IBuscarClient();
                    DataSet data1             = WS.GetEspecifico(ESPECIFICO);
                    TextMostrar.DataSource = data1.Tables[0];
                    TextMostrar.DataBind();

                    terminar = true;
                }
                catch (Exception h)
                {
                    terminar = false;
                    throw new Exception(h.ToString());
                }
            } while (terminar == false);

            ResultadoOperacion.Text = "Agregado exitosamente";
            vaciarDatos();
        }
        else
        {
            ResultadoOperacion.Text  = "Datos erroneos";
            ResultadoOperacion.Text += negativo;
        }
    }