/// <summary> /// Verify if MH is in use for any entity /// </summary> /// <param name="assetId">assetId</param> /// <param name="companyId">companyId</param> /// <returns></returns> public bool InUse(int assetId, int companyId) { AssetSewerMH assetSewerMh = new AssetSewerMH(null); return assetSewerMh.InUse(assetId, companyId); }
private void Delete() { Page.Validate(); if (Page.IsValid) { // Delete int workId = Int32.Parse(hdfWorkId.Value); int companyId = Int32.Parse(hdfCompanyId.Value); int assetId = Int32.Parse(hdfAssetId.Value); AssetSewerMH assetSewerMh = new AssetSewerMH(null); bool usedBySection = assetSewerMh.InUse(assetId, companyId); if (usedBySection) { lblDelete.Text = "The Manhole could not be deleted, it is used by sections"; } else { // Update databse UpdateDatabase(); // Redirect string url = ""; url = "./mr_navigator2.aspx?source_page=mr_delete.aspx&client_id=" + hdfCurrentClientId.Value + "&project_id=" + hdfCurrentProjectId.Value + "&in_project=" + hdfInProject.Value + GetNavigatorState() + "&update=yes"; Response.Redirect(url); } } }