protected void btGravar_Click(object sender, EventArgs e) { if (!drpCategoria.SelectedIndex.Equals(0)) { Inventory iv = new Inventory(); iv.Categoria = drpCategoria.SelectedItem.Text; iv.NomeFornecedor = txtFornecedor.Text; iv.NumeroDoc = txtDocumento.Text; iv.NomeProduto = drpItem.SelectedItem.Text; iv.Valor = double.Parse(txtValor.Text, CultureInfo.InvariantCulture); iv.Observacao = txtObs.Text; for (int i = 0; i < Int32.Parse(txtQuantidade.Text); i++) iv.AddIventoryItem(); //Reset screen iv.PopulateDropDown(drpCategoria); lblCategoria.Text = ""; txtFornecedor.Text = ""; txtDocumento.Text = ""; txtValor.Text = ""; txtQuantidade.Text = ""; txtObs.Text = ""; lblStatus.Text = "Item cadastrado com sucesso !"; } else { lblCategoria.Text = "Selecione uma categoria"; } }
protected void btPesquisa_Click(object sender, EventArgs e) { GridView1.Visible = true; Inventory inv = new Inventory(); GridView1.DataSource = inv.GetItemByName(drpCategoria.SelectedItem.Text, txtPesquisa.Text); GridView1.DataBind(); }
protected void btGravar_Click(object sender, EventArgs e) { Inventory iv = new Inventory(); if (lblNf.Text != "" && lblNd.Text != "" && lblNp.Text != "" && lblQt.Text != "") for (int i = 0; i < Int32.Parse(txtQt.Text); i++) iv.RemoveItem(lblNf.Text, lblNd.Text, lblNp.Text); Page.ClientScript.RegisterStartupScript(GetType(), "pop", "window.close();", true); }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserIsValid"] != null) { if (!(bool)Session["UserIsValid"]) { Response.Redirect("Login.aspx"); } else { txtDocumento.Attributes.Add("onKeypress", "return validaTecla(this, event)"); txtQuantidade.Attributes.Add("onKeypress", "return validaTecla(this, event)"); txtValor.Attributes.Add("onKeypress", "return validaTecla(this, event)"); if (!IsPostBack) { Inventory iv = new Inventory(); iv.PopulateDropDown(drpCategoria); } if (Session["FoundCustomerHandler"] != null) { string param = Session["FoundCustomerHandler"].ToString(); Session["FoundCustomerHandler"] = null; Thread.Sleep(500); Response.Redirect("Order.aspx?id=" + param); } if (Session["NewCustomerHandler"] != null) { string param = Session["NewCustomerHandler"].ToString(); Session["NewCustomerHandler"] = null; Thread.Sleep(500); Response.Redirect("Order.aspx?id=" + param); } } } else Response.Redirect("Login.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserIsValid"] != null) { if (!(bool)Session["UserIsValid"]) { Response.Redirect("Login.aspx"); } else { if (!IsPostBack) { Inventory iv = new Inventory(); iv.PopulateDropDown(drpCategoria); } if (Session["FoundCustomerHandler"] != null) { string param = Session["FoundCustomerHandler"].ToString(); Session["FoundCustomerHandler"] = null; Thread.Sleep(500); Response.Redirect("Order.aspx?id=" + param); } if (Session["NewCustomerHandler"] != null) { string param = Session["NewCustomerHandler"].ToString(); Session["NewCustomerHandler"] = null; Thread.Sleep(500); Response.Redirect("Order.aspx?id=" + param); } } } else Response.Redirect("Login.aspx"); }