Exemplo n.º 1
0
 protected void btnUpdateP_Click(object sender, EventArgs e)
 {
     LabelPr.Visible = true;
     try
     {
         string name     = UpdatePName.Text.ToString();
         int    stock    = Int32.Parse(UpdateStock.Text.ToString());
         int    price    = Int32.Parse(UpdatePrice.Text.ToString());
         string errorMsg = "";
         bool   success  = UpdateProductController.validateUpdate(name, stock, price, out errorMsg);
         if (!success)
         {
             LabelPr.Text = errorMsg;
         }
         else
         {
             if (success)
             {
                 LabelPr.Text = newID.ToString();
                 UpdateProductController.updateProduct(newID, name, price, stock);
                 Response.Redirect("UpdateProduct.aspx");
             }
             else
             {
                 LabelPr.Text = errorMsg;
             }
         }
     }
     catch
     {
         LabelPr.Text = "Cannot be empty!";
     }
 }
Exemplo n.º 2
0
 private void update_button_Click(object sender, EventArgs e)
 {
     UpdateProductController.updateProduct(updatedProductValueLabels, bindingNavigator_Products, this, productId);
 }