Update 20260123

This commit is contained in:
Stefan Hutter
2026-01-23 08:09:23 +01:00
parent 49155d898f
commit 2d1525575b
358 changed files with 123777 additions and 73 deletions

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Newtonsoft.Json;
namespace API_DocGen_Tester
{
public partial class Default : System.Web.UI.Page
{
private string ConnectionString =>
ConfigurationManager.ConnectionStrings["DbConnection"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSave_Click(object sender, EventArgs e)
{
string content = hfContent.Value;
using (SqlConnection con = new SqlConnection(ConnectionString))
{
string sql = @"INSERT INTO FileStorage (FileName, Content)
VALUES (@FileName, @Content)";
SqlCommand cmd = new SqlCommand(sql, con);
cmd.Parameters.AddWithValue("@FileName", txtFileName.Text);
cmd.Parameters.AddWithValue("@Content", content);
con.Open();
cmd.ExecuteNonQuery();
}
lblStatus.Text = "Datei gespeichert.";
}
protected void btnLoad_Click(object sender, EventArgs e)
{
string content = "";
using (SqlConnection con = new SqlConnection(ConnectionString))
{
string sql = @"SELECT TOP 1 Content
FROM FileStorage
WHERE FileName = @FileName
ORDER BY CreatedAt DESC";
SqlCommand cmd = new SqlCommand(sql, con);
cmd.Parameters.AddWithValue("@FileName", txtFileName.Text);
con.Open();
object result = cmd.ExecuteScalar();
if (result != null)
content = result.ToString();
}
// Inhalt nach JS zurückgeben
ScriptManager.RegisterStartupScript(
this,
GetType(),
"setEditor",
$"setEditorContent({content});",
true);
lblStatus.Text = "Datei geladen.";
}
}
}