private void Delete() { if (!base.ValidateIfCommandAllowed(Request.Url.AbsoluteUri, ENums.PageCommand.Delete)) { return; } bool bActionCompleted; string sMessage = ""; AccomodationSeasonDTO accomodationSeason = MapControlsToObject(); AccomodationMaster oAccomMaster = new AccomodationMaster(); int Id = 0; int.TryParse(hfId.Value, out Id); if (Id == 0) { lblStatus.Text = "Please click on edit again."; return; } GF.HasRecords(Convert.ToString(Id), "accomodation", out sMessage); if (sMessage != "") { base.DisplayAlert(sMessage); btnDelete.Enabled = true; } else { bActionCompleted = oAccomMaster.DeleteAccomodationSeason(accomodationSeason); if (bActionCompleted == true) { base.DisplayAlert("The record has been deleted successfully."); ClearControls(); } else { base.DisplayAlert("Error Occured while deletion: Please refer to the error log."); } } oAccomMaster = null; accomodationSeason = null; }