Exemplo n.º 1
0
    protected void imgBtnCancela_Click(object sender, EventArgs e)
    {
        string mensaje = string.Empty;

        try
        {
            ImageButton         ImgDetalle;
            GridViewRow         gvdCompra;
            Label               lblIdCompra;
            string              idCompra = string.Empty;
            CancelaCompraAction action   = new CancelaCompraAction();
            ImgDetalle  = (ImageButton)sender;
            gvdCompra   = (GridViewRow)ImgDetalle.Parent.Parent;
            lblIdCompra = (Label)gvdCompra.FindControl("lblIdCompra");
            idCompra    = lblIdCompra.Text.Trim();

            mensaje = action.cancelaCompra(idCompra);
            cellmensaje.ForeColor = System.Drawing.Color.DodgerBlue;
            btnAceptar.BackColor  = System.Drawing.Color.DodgerBlue;
            cellmensaje.Text      = mensaje;
            modalMensaje.Show();
            List <CancelaCompraModel> lista = new List <CancelaCompraModel>();
            lista = action.buscaCompra(txtReferencia.Text);
            gvdCompras.DataSource = lista;
            gvdCompras.DataBind();
        }
        catch (Exception ex)
        {
            cellmensaje.ForeColor = System.Drawing.Color.Red;
            btnAceptar.BackColor  = System.Drawing.Color.Red;
            cellmensaje.Text      = "Error:" + ex;
            modalMensaje.Show();
        }
    }
Exemplo n.º 2
0
 protected void btnBuscar_Click(object sender, EventArgs e)
 {
     try
     {
         string mensaje = validaCampos();
         if (mensaje.Length > 0)
         {
             cellmensaje.ForeColor = System.Drawing.Color.Red;
             btnAceptar.BackColor  = System.Drawing.Color.Red;
             cellmensaje.Text      = mensaje;
             modalMensaje.Show();
         }
         else
         {
             CancelaCompraAction       action = new CancelaCompraAction();
             List <CancelaCompraModel> lista  = new List <CancelaCompraModel>();
             lista = action.buscaCompra(txtReferencia.Text);
             gvdCompras.DataSource = lista;
             gvdCompras.DataBind();
         }
     }
     catch (Exception ex)
     {
         cellmensaje.ForeColor = System.Drawing.Color.Red;
         btnAceptar.BackColor  = System.Drawing.Color.Red;
         cellmensaje.Text      = "Error: " + ex;
         modalMensaje.Show();
     }
 }