You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
4.7 KiB

using OnDoc.Diverses;
using OnDoc.DocMgmt;
using OnDoc.Klassen;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using Syncfusion.Windows.Forms.Spreadsheet.Commands;
using OnDoc.UICintrols;
using OnDoc.UIControls;
using System.Linq.Expressions;
namespace OnDoc
{
internal static class Program
{
/// Args
/// shodoc:?partnernr=1000210&vorlagenr=125&interaktion=NO&showdoc=YES&funktion=Createdoc
/// E:\Software-Projekte\OnDoc\EDK_Dateien\3bv.edk
/// <summary>
/// Der Haupteinstiegspunkt für die Anwendung.
/// </summary>
private static Mutex mutex = null;
const string AppId = "OnDoc5094533C-A613-4889-A0E3-8C28C130C6AA)";
//static Start MyForm = new Start();
///
[STAThread]
static void Main(string[] args)
{
ExternalCall.sourceparam = "";
try
{
MessageBox.Show(args[0]);
}
catch { }
if (args.Length > 0)
{
string debugstring;
if (args[0].ToString().ToUpper().Substring(args[0].ToString().Length - 4, 4) == ".EDK")
{
AppParams.init();
Database.DB db = new Database.DB(AppParams.connectionstring);
string mitarbeiter = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
mitarbeiter = mitarbeiter.Replace("i", "");
mitarbeiter = mitarbeiter.Replace("I", "");
mitarbeiter = mitarbeiter.Substring(mitarbeiter.IndexOf("\\") + 1);
Logging.Logging.Debug("EDK-Umleitung", args[0], "");
AppParams.currenttgnummer = mitarbeiter;
db.Get_Tabledata("Select count(*) from ondoc_edk_routing where aktiv=1 and tgnummer='" + AppParams.currenttgnummer + "'", false, true);
if (Convert.ToInt32(db.dsdaten.Tables[0].Rows[0][0]) > 0)
{
System.Diagnostics.Process.Start(AppParams.EDOKAPath, args[0]);
db = null;
System.Environment.Exit(0);
return;
}
string destfile = AppParams.tempdir + DateTime.Now.ToString("yyyyMMddHHmmss") + "_tmpfile.edk";
System.IO.File.Copy(args[0],destfile);
System.IO.File.Delete(args[0]);
//EDK_Data.Load_EDK_File(args[0]);
}
else
{
if (args[0].ToString().ToUpper().IndexOf("PARTNERNR") > 0 || args[0].ToString().ToUpper().IndexOf("UCHECK") > 0)
{
AppParams.init();
//MessageBox.Show(AppParams.tempdir);
string destfile = AppParams.tempdir + DateTime.Now.ToString("yyyyMMddHHmmss")+ "_tmpfile.uri";
using (StreamWriter outputfile = new StreamWriter(destfile))
{
outputfile.WriteLine(Uri.UnescapeDataString(args[0]));
outputfile.Close();
}
}
else
{
MessageBox.Show("Die Übergabeparemeter '" + args[0].ToString()+"' sind ungültig","Aufruffehler",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
const string appName = "OnDoc";
bool createdNew;
mutex = new Mutex(true, appName, out createdNew);
if (!createdNew)
{
//MyForm.runparams();
return;
}
Application.EnableVisualStyles();
SplashScreen sp = new SplashScreen();
sp.Show();
Application.DoEvents();
//Application.SetCompatibleTextRenderingDefault(false);
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MzYzODg2NkAzMjM4MmUzMDJlMzBTOWljRmxNelA1d1VGOHpGR0lxQzB6UTAwKzIxK2VBNEhBZFp5alcxb1NVPQ==");
AppParams.init();
// // MyForm = new Start();
// Application.Run(MyForm);
AppParams.StartApp = true;
Application.Run(new Start());
AppParams.StartApp = false;
//Application.Run(new Dummy());
}
}
}