protected void btnYes_Click(object sender, EventArgs e) { try { dsGeneralTableAdapters.PIP_TEST_CARDS_DETAILTableAdapter test = new PIP_TEST_CARDS_DETAILTableAdapter(); test.DeleteQuery(decimal.Parse(tcDetailsGridView.SelectedValue.ToString())); Master.ShowMessage("Item Deleted."); tcDetailsGridView.Rebind(); } catch (Exception ex) { Master.ShowWarn(ex.Message); } }
protected void btnSubmit_Click(object sender, EventArgs e) { decimal mat_id = db_lookup.MAT_ID(txtItemCode.Text, Decimal.Parse(Session["PROJECT_ID"].ToString())); if (mat_id == -1) { Master.ShowWarn("There are more than materials with the same code! try to use the unique one."); return; } else if (mat_id == 0) { Master.ShowWarn("Material Code not found!"); return; } PIP_TEST_CARDS_DETAILTableAdapter tc_detail = new PIP_TEST_CARDS_DETAILTableAdapter(); try { tc_detail.InsertQuery(Decimal.Parse(Request.QueryString["TC_ID"]), mat_id, txtHeatNo.Text, decimal.Parse(txtQty.Text), txtRemarks.Text, txtMrItem.Text, txtPoItem.Text); tcDetailsGridView.DataBind(); Master.ShowMessage(txtItemCode.Text + " Saved!"); } catch (Exception ex) { Master.ShowWarn(ex.Message); tc_detail.Dispose(); } finally { tc_detail.Dispose(); } }