public string GetRouteUrl(bool editMode) { string routeFolderPath = PathFunctions.GetRoutePathFromName(Name); string url = editMode ? PathFunctions.GetUrlFromPath(PathFunctions.EditRoutePage, false).Replace("'", "\\'") + "?Route=" + Name : (string.IsNullOrEmpty(Page) ? PathFunctions.GetUrlFromPath(PathFunctions.RoutesPage, false).Replace("'", "\\'") + "?Route=" + Name : PathFunctions.GetUrlFromPath(Path.Combine(routeFolderPath, Page), false).Replace("'", "\\'")); return(url); }
protected void ButtonDelete_Click(object sender, EventArgs e) { string routeName = RouteName.Value; try { if (string.IsNullOrEmpty(routeName)) { return; } //non posso eliminare una traccia che appartiene ad un alro utente //(se mai riesco a editarla) if (route != null && route.OwnerId != LoginState.User.Id) { return; } string path = PathFunctions.GetRoutePathFromName(routeName); TryDeleting(path); path = PathFunctions.GetWorkingPath(path); TryDeleting(path); if (route != null) { DBHelper.DeleteRoute(route); } GpxParser.RemoveFromSession(routeName); UploadedImages.RemoveFromSession(routeName); //forza il ricaricamento della pagina Response.Redirect(Request.Url.ToString(), true); } catch (Exception ex) { Log.Add("Error deleting route '{0}': '{1}'", routeName, ex.ToString()); ScriptManager.RegisterStartupScript(this, GetType(), "ErrorDeleting", string.Format("alert('Errore durante l'eliminazione: {0}.');", ex.Message), true); } }