Beispiel #1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (hdInsert.Value == "insert")
     {
         if (!string.IsNullOrEmpty(txtProductName.Text.Trim()))
         {
             bool active = chkActive.Checked ? true : false;
             _product.Insert(txtProductName.Text.Trim(), int.Parse(txtOrder.Text.Trim()), active);
             Response.Redirect(Request.Url.ToString());
         }
     }
     else //update
     {
         if (!string.IsNullOrEmpty(txtProductName.Text.Trim()))
         {
             bool active = chkActive.Checked ? true : false;
             _product.Update(int.Parse(hdProID.Value), txtProductName.Text.Trim(), int.Parse(txtOrder.Text.Trim()), active);
             Response.Redirect(Request.Url.ToString());
         }
     }
 }