update 20260220
This commit is contained in:
@@ -21,6 +21,7 @@ using Syncfusion.Windows.Forms.Edit.Interfaces;
|
||||
using Syncfusion.Windows.Forms.Edit.Enums;
|
||||
using Syncfusion.Windows.Forms.Edit.Implementation.Config;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
using System.Windows.Forms.Design;
|
||||
|
||||
|
||||
namespace API_DocTest
|
||||
@@ -41,10 +42,25 @@ namespace API_DocTest
|
||||
|
||||
LoadJSON();
|
||||
Form1_Resize(sender, e);
|
||||
|
||||
Refresh_Filelist();
|
||||
|
||||
}
|
||||
|
||||
private void Refresh_Filelist()
|
||||
{
|
||||
listBox1.Items.Clear();
|
||||
DirectoryInfo d = new DirectoryInfo(Properties.Settings.Default.tempdir); //Assuming Test is your Folder
|
||||
|
||||
FileInfo[] Files = d.GetFiles("*.json"); //Getting Text files
|
||||
string str = "";
|
||||
|
||||
foreach (FileInfo file in Files)
|
||||
{
|
||||
listBox1.Items.Add(file.Name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void toolStripButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -115,13 +131,11 @@ ELSE
|
||||
|
||||
private string GetKey()
|
||||
{
|
||||
foreach (Control c in Controls)
|
||||
if (c is ToolStrip ts)
|
||||
foreach (ToolStripItem i in ts.Items)
|
||||
if (i.Name == "txtKey")
|
||||
return ((ToolStripTextBox)i).Text;
|
||||
|
||||
return null;
|
||||
return txtdbkey.Text;
|
||||
}
|
||||
private string GetKey1()
|
||||
{
|
||||
return txtfilekey.Text;
|
||||
}
|
||||
|
||||
static readonly string ApiUrl = Properties.Settings.Default.DogGenURI;
|
||||
@@ -222,11 +236,11 @@ ELSE
|
||||
conn.Open();
|
||||
using (SqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
toolStripComboBox1.Items.Clear();
|
||||
comboBox1.Items.Clear();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
toolStripComboBox1.Items.Add(reader.GetString(0));
|
||||
comboBox1.Items.Add(reader.GetString(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,6 +251,138 @@ ELSE
|
||||
this.txtKey.Text= toolStripComboBox1.Text.ToString();
|
||||
toolStripButton1_Click(sender, e);
|
||||
}
|
||||
|
||||
private void toolStripButton4_Click(object sender, EventArgs e)
|
||||
{
|
||||
string key = GetKey();
|
||||
string json = null;
|
||||
using (SqlConnection con = new SqlConnection(connectionstring))
|
||||
using (SqlCommand cmd = new SqlCommand(
|
||||
"SELECT JavaScriptObject FROM ProvDokuments WHERE ProvDokumentid = @key", con))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@key", key);
|
||||
con.Open();
|
||||
json = cmd.ExecuteScalar()?.ToString();
|
||||
}
|
||||
|
||||
if (json == null)
|
||||
{
|
||||
using (SqlConnection con = new SqlConnection(connectionstring))
|
||||
using (SqlCommand cmd = new SqlCommand(
|
||||
"SELECT JsonObjekt FROM _OnDoc_API_TestScripts WHERE id = @key", con))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@key", key);
|
||||
con.Open();
|
||||
json = cmd.ExecuteScalar()?.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
System.IO.File.WriteAllText(Properties.Settings.Default.tempdir + DateTime.Now.ToString("yyyymmddhhMMss") + ".json",json);
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
var key = GetKey();
|
||||
if (string.IsNullOrEmpty(key)) return;
|
||||
|
||||
string json = LoadJsonFromDb(key);
|
||||
editControl1.Text = json ?? "{}";
|
||||
|
||||
editControl1.MoveToBeginning();
|
||||
pdfViewerControl1.Unload(); // PDF zurücksetzen
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
var key = GetKey();
|
||||
if (string.IsNullOrEmpty(key)) return;
|
||||
SaveJsonToDb(key, editControl1.Text);
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
string key = GetKey1();
|
||||
string json = null;
|
||||
using (SqlConnection con = new SqlConnection(connectionstring))
|
||||
using (SqlCommand cmd = new SqlCommand(
|
||||
"SELECT JavaScriptObject FROM ProvDokuments WHERE ProvDokumentid = @key", con))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@key", key);
|
||||
con.Open();
|
||||
json = cmd.ExecuteScalar()?.ToString();
|
||||
}
|
||||
|
||||
if (json == null)
|
||||
{
|
||||
using (SqlConnection con = new SqlConnection(connectionstring))
|
||||
using (SqlCommand cmd = new SqlCommand(
|
||||
"SELECT JsonObjekt FROM _OnDoc_API_TestScripts WHERE id = @key", con))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@key", key);
|
||||
con.Open();
|
||||
json = cmd.ExecuteScalar()?.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
System.IO.File.WriteAllText(Properties.Settings.Default.tempdir + txtfilename.Text + ".json", json);
|
||||
Refresh_Filelist();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] byteArray = Generate(editControl1.Text);
|
||||
string temp_inBase64 = Convert.ToBase64String(byteArray);
|
||||
var stream = new MemoryStream(Convert.FromBase64String(temp_inBase64));
|
||||
if (stream.Length > 0)
|
||||
{
|
||||
this.pdfViewerControl1.Load(stream);
|
||||
this.pdfViewerControl1.Visible = true;
|
||||
pdfViewerControl1.ZoomMode = ZoomMode.FitWidth;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { MessageBox.Show(ex.Message); }
|
||||
}
|
||||
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
string filename=Properties.Settings.Default.tempdir+listBox1.SelectedItem.ToString();
|
||||
|
||||
try
|
||||
{
|
||||
byte[] byteArray = Generate(System.IO.File.ReadAllText(filename));
|
||||
string temp_inBase64 = Convert.ToBase64String(byteArray);
|
||||
var stream = new MemoryStream(Convert.FromBase64String(temp_inBase64));
|
||||
if (stream.Length > 0)
|
||||
{
|
||||
this.pdfViewerControl1.Load(stream);
|
||||
this.pdfViewerControl1.Visible = true;
|
||||
pdfViewerControl1.ZoomMode = ZoomMode.FitWidth;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { MessageBox.Show(ex.Message); }
|
||||
}
|
||||
|
||||
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.txtdbkey.Text = comboBox1.SelectedItem.ToString();
|
||||
button1_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user