protected void btnInsert_Click(object sender, EventArgs e)
        {
            int    prodID    = 1;
            int    PTID      = int.Parse(txtPTID.Text);
            string prodName  = txtName.Text;
            int    prodPrice = int.Parse(txtPrice.Text);
            int    prodStock = int.Parse(txtStock.Text);

            if (PTRepository.getID(int.Parse(txtPTID.Text)) != null)
            {
                if (int.Parse(txtPrice.Text) < 1000)
                {
                    price.Visible = true;
                }
                else if (int.Parse(txtStock.Text) < 1)
                {
                    stock.Visible = true;
                }
                else
                {
                    productRepository.updateProduct(prodID, PTID, prodName, prodPrice, prodStock);
                }
            }
            else
            {
                notFound.Visible = true;
            }
        }
Exemplo n.º 2
0
        protected void btnDeletePT_Click1(object sender, EventArgs e)
        {
            if (PTRepository.getID(int.Parse(txtID.Text)) != null)
            {
                PTRepository.deleteProductType(int.Parse(txtID.Text));

                Response.Redirect("View PT.aspx");
            }
            else
            {
                notFound.Visible = true;
            }
        }