protected void DeleteFarmButton_Click(object sender, EventArgs e) { bool isError = false; try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); int farmId = 0; int.TryParse(FarmIdHiddenField.Value.ToString(), out farmId); farmService.DeleteFarmPlot(farmId, LoginUserId); } catch (Exception exception) { log.Error("UNKNOWN ERROR WHILE DELETING FARM:", exception); isError = true; if (exception.Message.Contains("Farm is Firmed Up. Cannot Delete this Farm")) { ErrorLiteral.Text = "Error: " + FarmNameLabel.Text + " farm is currently Firmed Up. It is not possible to delete any Firmed Up mailing plan or Farm. If you still want to delete it, please speak to Customer Service 1-800-Mailing"; } else { ErrorLiteral.Text = "Unknown Error Deleting Farm. Please Contact Administrator"; } } if (!isError) { Response.Redirect("~/Members/FarmManagement.aspx"); } }