Ejemplo n.º 1
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            if (txtCod.Text == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>alert('No se Introdujo ningun Codigo');</script>", false);
            }
            try
            {
                int verif = obj.ConsultaExistencia(Convert.ToInt64(txtCod.Text));
                if (verif > 0)
                {
                    obj.consultaCodigo(tbConsulta, Convert.ToInt64(txtCod.Text));
                    string producto = tbConsulta.Rows[0].Cells[1].Text;
                    // string cantidad = tbConsulta.Rows[0].Cells[3].Text;

                    bool resp = obj.AddTran(Convert.ToInt64(txtCod.Text), txtFecha.Text, txtPersona.SelectedItem.ToString(), producto, "1");
                    ListBox1.Items.Add(producto);

                    if (resp)
                    {
                        //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>alert('Se guardo correctamente la transaccion');</script>", false);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>alert('Upss problemas en la transaccion');</script>", false);
                    }
                    //txtPersona.Items.Clear();
                    //FillCombo();

                    txtCod.Text     = null;
                    Button1.Visible = false;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>alert('Producto Agotado');</script>", false);
                }
                txtCod.Text = "";

                Button1.Visible = true;
                //txtPersona.Items.Clear();
                //FillCombo();
            }
            catch (Exception ex) {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>alert('No se Introdujo ningun Codigo');</script>", false);
            }
        }
Ejemplo n.º 2
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     obj.consultaCodigo(Tabla1, Convert.ToInt64(txtConCod.Text));
     Tabla1.Visible = true;
     txtConCod.Text = "";
 }