protected void deleteproducttype_Click(object sender, EventArgs e) { Int32 deletebyID = 0; Int32.TryParse(id.Text.ToString(), out deletebyID); bool cekKedua = RepositoryProduct.CekProductTypeID(deletebyID); bool cekPertama = RepositoryProductType.CekID(deletebyID); if (cekPertama) { if (cekKedua) { Response.Write("<script>alert('Deleted product type can not have reference to other table.')</script>"); } else { RepositoryProductType.DeleteProductType(deletebyID); Response.Write("<script>alert('Delete product type successfully.')</script>"); refresh(); } } else { Response.Write("<script>alert('ID does not exists.')</script>"); } }