public ExportBonLivraison() { // Init database && tables this.db = new Database.Database(); this.settings = this.db.settingsManager.get(this.db.connectionString, 1); this.pathExport = this.settings.EDI_Folder + @"\Export\BL"; this.logDirectoryName_export = this.settings.EXE_Folder + @"\" + "LOG" + @"\" + "LOG_Export" + @"\" + "BON_LIVRAISON"; }
///////////////////////////////////////////////////////////////////////////////////////////////////////// /// private bool getEDI_CSV_Folder() { Database.Model.Settings settings = db.settingsManager.get(db.connectionString, 1); if (settings != null) { directoryName_EDI = settings.EDI_Folder; return(true); } return(false); }
public ReprocessErrorFiles() { // Init database && tables db = new Database.Database(); Database.Model.Settings settings = db.settingsManager.get(db.connectionString, 1); directoryName_tmp = settings.EXE_Folder + @"\tmp"; directoryName_ErrorFile = settings.EXE_Folder + @"\LOG\LOG_Import"; directoryName_ErrorFile = settings.EXE_Folder + @"\Error File"; }
public ExportStocks() { // Init database && tables this.db = new Database.Database(); this.settings = this.db.settingsManager.get(this.db.connectionString, 1); this.pathExport = this.settings.EDI_Folder + @"\Export\Stock"; logDirectoryName_export = this.settings.EXE_Folder + @"\" + "LOG" + @"\" + "LOG_Export" + @"\" + "STOCK"; }
private void button18_Click(object sender, EventArgs e) { Forms.ProgressDialog progressDialog = new Forms.ProgressDialog(); Thread backgroundThread = new Thread(new ThreadStart(() => { })); try { // Initialize the thread that will handle the background process backgroundThread = new Thread( new ThreadStart(() => { //Loading General Settings if (progressDialog.InvokeRequired) { progressDialog.BeginInvoke(new System.Action(() => progressDialog.Text = "Connecteur Automatique en cours d'execution....")); } for (int n = 0; n < 50; n++) { Thread.Sleep(1); progressDialog.UpdateProgress(n); } Database.Database db = new Database.Database(); db.initTables(); Database.Model.Settings db_settings = db.settingsManager.get(db.connectionString, 1); if (File.Exists(db_settings.EXE_Folder + @"\ConnecteurAuto.exe")) { System.Diagnostics.Process process = Process.Start(db_settings.EXE_Folder + @"\ConnecteurAuto.exe"); process.WaitForExit(); } for (int n = 50; n < 100; n++) { Thread.Sleep(1); progressDialog.UpdateProgress(n); } } )); // Start the background process thread backgroundThread.Start(); // Open the dialog progressDialog.ShowDialog(); } catch (Exception ex) { backgroundThread.Abort(); progressDialog.Close(); MessageBox.Show("Une erreur survenu lors de l'execution du connecteur automatique. Veuillez touver l'erreur ci-dessous : \n" + ex.Message, "Execution ConnecteurAuto", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private bool getEDI_CSV_Folder(StreamWriter writer) { writer.WriteLine(""); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => getEDI_CSV_Folder()"); Database.Model.Settings settings = db.settingsManager.get(db.connectionString, 1); if (settings != null) { directoryName_EDI = settings.EDI_Folder; writer.WriteLine(DateTime.Now + " :: Reprocess.dll => getEDI_CSV_Folder() | dossier EDI CSV trouvé."); return(true); } writer.WriteLine(DateTime.Now + " :: Reprocess.dll => getEDI_CSV_Folder() | dossier EDI CSV non trouvé!"); return(false); }
// Reprocess all file from Error File public void reprocessManually() { Database.Model.Settings settings = db.settingsManager.get(db.connectionString, 1); if (settings != null) { if (settings.reprocess_active == 1 ? true : false) { if (!getEDI_CSV_Folder()) { return; } if (checkFiles()) { DirectoryInfo fileListing = new DirectoryInfo(directoryName_ErrorFile); FileInfo[] allFiles = fileListing.GetFiles("*.csv"); if (settings.reprocess_hour == 0) { Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Aucunne heure de retraitement saisi"); } else { for (int x = 0; x < allFiles.Length; x++) { FileInfo file = allFiles[x]; DateTime today = DateTime.Now; DateTime fileDateTime = File.GetCreationTime(file.FullName); TimeSpan ts = today - fileDateTime; string[] fileNamePieces = file.Name.Split(new String[] { "__" }, StringSplitOptions.None); string newFileName = fileNamePieces[(fileNamePieces.Length - 1)]; File.Copy(file.FullName, directoryName_EDI + @"\" + newFileName); if (File.Exists(directoryName_EDI + @"\" + newFileName)) { File.Delete(file.FullName); } } } } } } }
static void Main(string[] args) { const int SW_SHOWMINIMIZED = 2; var handle = GetConsoleWindow(); ShowWindow(handle, SW_SHOWMINIMIZED); // Hide or not the screen Database.Database db = new Database.Database(); db.initTables(); Database.Model.Settings _settings_ = db.settingsManager.get(db.connectionString, 1); int SW_HIDE_SHOW = _settings_.showWindow; // SW_HIDE = 0 // SW_SHOW = 5 if (SW_HIDE_SHOW == 5) { // Show ShowWindow(handle, 9); ShowWindow(handle, SW_HIDE_SHOW); int Height = Console.LargestWindowHeight - 20; int Width = Console.LargestWindowWidth - 20; Console.SetWindowSize(Width, Height); Console.SetWindowPosition(0, 0); } else if (SW_HIDE_SHOW == 0) { // Hide Console.SetWindowSize(1, 1); Console.SetWindowPosition(0, 0); ShowWindow(handle, SW_HIDE_SHOW); } // Some biolerplate to react to close window event, CTRL-C, kill, etc _handler += new EventHandler(Handler); SetConsoleCtrlHandler(_handler, true); //start your multi threaded program here Program p = new Program(); p.Start(); }
public FichierDeNettoyage() { Database.Database db = new Database.Database(); this.fileName = db.settingsManager.get(db.connectionString, 1).EXE_Folder + @"\SettingBackup.xml"; Database.Model.Settings db_settings_ = db.settingsManager.get(db.connectionString, 1); this.paths = new string[12, 2] { { "general_logs", db_settings_.EXE_Folder + @"\LOG" }, //log files { "general_logs", db_settings_.EXE_Folder + @"\LOG\LOG_AlertMail" }, //log files { "import_logs", db_settings_.EXE_Folder + @"\LOG\LOG_Import" }, //log files { "export_Logs", db_settings_.EXE_Folder + @"\LOG\LOG_Export\FACTURE" }, //log files { "export_Logs", db_settings_.EXE_Folder + @"\LOG\LOG_Export\BON_LIVRAISON" }, //log files { "export_Logs", db_settings_.EXE_Folder + @"\LOG\LOG_Export\COMMANDE" }, //log files { "export_Logs", db_settings_.EXE_Folder + @"\LOG\LOG_Export\STOCK" }, //log files { "import_files_success", db_settings_.EXE_Folder + @"\Success File" }, //fichier import success { "import_files_error", db_settings_.EXE_Folder + @"\Error File" }, //fichier import erreur { "backup_files", db_settings_.EDI_Folder + @"\BackUp\Export\Orders" }, //backup files { "backup_files", db_settings_.EDI_Folder + @"\BackUp\Export\Article" }, //backup files { "backup_files", db_settings_.EDI_Folder + @"\BackUp\Export\Client" }, //backup files }; }
public void reprocessTmpManually() { Database.Model.Settings settings = db.settingsManager.get(db.connectionString, 1); if (settings != null) { // check if tmp and EDI/CSV folders existe getEDI_CSV_Folder(); if (Directory.Exists(directoryName_tmp) && Directory.Exists(directoryName_EDI)) { if (settings.reprocess_active == 1 ? true : false) { // tmp dossier DirectoryInfo fileListing = new DirectoryInfo(directoryName_tmp); FileInfo[] allFiles = fileListing.GetFiles("*.csv"); if (allFiles.Length == 0) { return; } for (int x = 0; x < allFiles.Length; x++) { FileInfo file = allFiles[x]; string[] fileNamePieces = file.Name.Split(new String[] { "__" }, StringSplitOptions.None); string newFileName = fileNamePieces[(fileNamePieces.Length - 1)]; File.Copy(file.FullName, directoryName_EDI + @"\" + newFileName); if (File.Exists(directoryName_EDI + @"\" + newFileName)) { File.Delete(file.FullName); } } } } } }
// Reprocess all file after 1h public void reprocess(StreamWriter writer) { writer.Flush(); writer.WriteLine(""); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess()"); Console.WriteLine(""); Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess()"); Database.Model.Settings settings = db.settingsManager.get(db.connectionString, 1); if (settings != null) { if (settings.reprocess_active == 1 ? true : false) { if (!getEDI_CSV_Folder(writer)) { writer.WriteLine(""); writer.Flush(); return; } if (checkFiles(writer)) { DirectoryInfo fileListing = new DirectoryInfo(directoryName_ErrorFile); FileInfo[] allFiles = fileListing.GetFiles("*.csv"); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Les fichier EDI dans " + directoryName_ErrorFile); writer.Flush(); Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Les fichier EDI dans " + directoryName_ErrorFile); if (settings.reprocess_hour == 0) { writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Aucunne heure de retraitement saisi, HR = 0"); Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Aucunne heure de retraitement saisi"); writer.Flush(); } else { List <ReprocessFiles> reprocessFilesList = new List <ReprocessFiles>(); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Heure de retraitement trouve."); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Fichier total en erreur => " + allFiles.Length); Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Heure de retraitement trouve."); for (int x = 0; x < allFiles.Length; x++) { FileInfo file = allFiles[x]; DateTime today = DateTime.Now; DateTime fileDateTime = File.GetCreationTime(file.FullName); TimeSpan ts = today - fileDateTime; Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Index : " + (x + 1)); writer.WriteLine(""); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Index : " + (x + 1)); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Date aujourd'hui : " + string.Format("{0:dd-MM-yyyy HH:mm}", fileDateTime) + ", Date de création : " + string.Format("{0:dd-MM-yyyy HH:mm}", fileDateTime) + ", TimeSpan : " + string.Format("{0}", ts.TotalHours)); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Temps d'existence du fichier : " + ts.TotalHours + " hrs >= Heure de retraitement : " + settings.reprocess_hour + " hrs"); writer.Flush(); // if file hour > X hours if (ts.TotalHours >= Convert.ToDouble(settings.reprocess_hour)) { string[] fileNamePieces = file.Name.Split(new String[] { "__" }, StringSplitOptions.None); string newFileName = fileNamePieces[(fileNamePieces.Length - 1)]; Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Ancien nom du fichier : " + file.Name + ", Nouveau nom : " + newFileName); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Ancien nom du fichier : " + file.Name + ", Nouveau nom : " + newFileName); writer.Flush(); try { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// new feature /// writer.Flush(); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | settings.configurationGeneral.reprocess.countDown => " + settings.reprocess_countDown); if (settings.reprocess_countDown == 0) { writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | La suppression des fichiers de retraitement X fois est désactivée"); File.Copy(file.FullName, directoryName_EDI + @"\" + newFileName); Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Copie : " + file.FullName + " à : " + directoryName_EDI + @"\" + newFileName); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Copie : " + file.FullName + " à : " + directoryName_EDI + @"\" + newFileName); writer.Flush(); if (File.Exists(directoryName_EDI + @"\" + newFileName)) { File.Delete(file.FullName); Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Supprimer le fichier : " + file.FullName); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Le fichier EDI existe dans le dossier \"" + directoryName_EDI + "\".\nSupprimer le fichier : " + file.FullName); writer.Flush(); } } else { Database.Database db = new Database.Database(writer); string ediFileId_str = (newFileName.Contains("EDI_ORDERS") ? newFileName.Split('.')[1] : ((newFileName.Contains("CFP41") || newFileName.Contains("CFP51") || newFileName.Contains("TWP41") || newFileName.Contains("TWP51")) ? newFileName.Split('_')[1].Replace(".csv", "") : "999")); //get reprocess obj Database.Model.Reprocess reprocess_db = db.reprocessManager.getById(db.connectionString, ediFileId_str, writer); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | check obj"); writer.Flush(); if (reprocess_db != null) { writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Reprocess obj != null"); reprocess_db.ediFileID = ediFileId_str; reprocess_db.fileName = newFileName; reprocess_db.filePath = file.FullName; reprocess_db.fileReprocessCount = (reprocess_db.fileReprocessCount + 1); if (reprocess_db.fileReprocessCount >= settings.reprocess_countDown) { // move the file to tmp writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Le Connecteur a tenté d'importer ce document " + reprocess_db.fileReprocessCount + " fois de suite sans succès, il sera déplacé sur dans le dossier => " + directoryName_tmp); File.Copy(file.FullName, directoryName_tmp + @"\" + file.Name, true); Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Copie : " + file.FullName + " à : " + directoryName_tmp + @"\" + file.Name); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Copie : " + file.FullName + " à : " + directoryName_tmp + @"\" + file.Name); writer.Flush(); if (File.Exists(directoryName_tmp + @"\" + file.Name)) { File.Delete(file.FullName); Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Supprimer le fichier : " + file.FullName); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Supprimer le fichier : " + file.FullName); writer.Flush(); } writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | deleting... " + reprocess_db.ediFileID); db.reprocessManager.deleteById(db.connectionString, reprocess_db.ediFileID, writer); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | deleted"); writer.Flush(); } else { //Update Reprocess row writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | updating... " + reprocess_db.ediFileID); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Json :\n" + db.JsonFormat(reprocess_db)); db.reprocessManager.update(db.connectionString, reprocess_db, writer); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | updated"); writer.Flush(); File.Copy(file.FullName, directoryName_EDI + @"\" + newFileName, true); Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Copie : " + file.FullName + " à : " + directoryName_EDI + @"\" + newFileName); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Copie : " + file.FullName + " à : " + directoryName_EDI + @"\" + newFileName); if (File.Exists(directoryName_EDI + @"\" + newFileName)) { File.Delete(file.FullName); Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Supprimer le fichier : " + file.FullName); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Le fichier EDI existe dans le dossier \"" + directoryName_EDI + "\".\nSupprimer le fichier : " + file.FullName); } writer.Flush(); } writer.Flush(); } else { writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | reprocess_db == null"); Database.Model.Reprocess reprocess = new Database.Model.Reprocess(); reprocess.ediFileID = ediFileId_str; reprocess.fileName = newFileName; reprocess.filePath = file.FullName; reprocess.fileReprocessCount = 1; //Insert Reprocess writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | inserting... " + reprocess.ediFileID); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Json :\n" + db.JsonFormat(reprocess)); db.reprocessManager.insert(db.connectionString, reprocess); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | inserted"); writer.Flush(); File.Copy(file.FullName, directoryName_EDI + @"\" + newFileName, true); Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Copie : " + file.FullName + " à : " + directoryName_EDI + @"\" + newFileName); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Copie : " + file.FullName + " à : " + directoryName_EDI + @"\" + newFileName); if (File.Exists(directoryName_EDI + @"\" + newFileName)) { File.Delete(file.FullName); Console.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Supprimer le fichier : " + file.FullName); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Le fichier EDI existe dans le dossier \"" + directoryName_EDI + "\".\nSupprimer le fichier : " + file.FullName); } writer.Flush(); } } writer.Flush(); } catch (Exception ex) { writer.WriteLine(DateTime.Now + " :: ############################### Erreur Retraitement ###############################"); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Message : " + ex.Message); writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | StackTrace :\n" + ex.StackTrace); writer.WriteLine(""); } } writer.Flush(); } } writer.WriteLine(""); Console.WriteLine(""); Console.WriteLine(""); } } else { writer.WriteLine(DateTime.Now + " :: Reprocess.dll => reprocess() | Le retraitement est désactivé!"); writer.Flush(); } } else { Console.WriteLine(DateTime.Now + " :: Pas de config (init.json) trouve..."); } }
public GeneralConfig() { InitializeComponent(); // Init Connecteur Info, Version and Database path in a file Init.Init init = new Init.Init(); if (init.isSettings()) { init.Load(); init.connecteurInfo.installation_dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); init.saveInfo(); } else { init.connecteurInfo = new Connecteur_Info.ConnecteurInfo(); init.connecteurInfo.installation_dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); init.saveInfo(); } // Init database Database.Database db = new Database.Database(); Database.Model.Settings settings_ = db.settingsManager.get(db.connectionString, 1); if (settings_ != null) { if (settings_.showWindow == 5) { // visible Software while running debugMode_checkBox.Checked = true; } else if (settings_.showWindow == 0) { // Hide Software while running debugMode_checkBox.Checked = false; } /* * if (settings_.isAppOpen) * { * label3.Text = "Planificateur en Cour..."; * } * else * { * label3.Text = "Planificateur est fermet."; * } */ if (settings_.isACP_ComptaCPT_CompteG == 1 ? true : false) { checkBox_activate_compt_g_taxe.Text = "Activer"; checkBox_activate_compt_g_taxe.Checked = true; textBox1.Enabled = true; textBox1.Text = "" + settings_.ACP_ComptaCPT_CompteG; } else { checkBox_activate_compt_g_taxe.Text = "Désactiver"; checkBox_activate_compt_g_taxe.Checked = false; textBox1.Enabled = false; textBox1.Text = "" + settings_.ACP_ComptaCPT_CompteG; } textBox2.Text = settings_.EDI_Folder; //////////////////////////////////////////////////////////////////////////////////// /// Tarifaire /// if (settings_.priceType_active == 1 ? true : false) { checkBox_activer_tarif.Text = "Activer"; checkBox_activer_tarif.Checked = true; radioButton_tarif_cmd_EDI.Enabled = true; radioButton_tarif_cmd_EDI.Checked = settings_.priceType_cmdEDIPrice == 1 ? true : false; radioButton_tarif_produit.Enabled = true; radioButton_tarif_produit.Checked = settings_.priceType_productPrice == 1 ? true : false; radioButton_tarif_categorie.Enabled = true; radioButton_tarif_categorie.Checked = settings_.priceType_categoryPrice == 1 ? true : false; radioButton_tarif_client.Enabled = true; radioButton_tarif_client.Checked = settings_.priceType_clientPrice == 1 ? true : false; } else { checkBox_activer_tarif.Text = "Désactiver"; checkBox_activer_tarif.Checked = false; radioButton_tarif_cmd_EDI.Enabled = false; radioButton_tarif_cmd_EDI.Checked = settings_.priceType_cmdEDIPrice == 1 ? true : false; radioButton_tarif_produit.Enabled = false; radioButton_tarif_produit.Checked = settings_.priceType_productPrice == 1 ? true : false; radioButton_tarif_categorie.Enabled = false; radioButton_tarif_categorie.Checked = settings_.priceType_categoryPrice == 1 ? true : false; radioButton_tarif_client.Enabled = false; radioButton_tarif_client.Checked = settings_.priceType_clientPrice == 1 ? true : false; } //////////////////////////////////////////////////////////////////////////////////// /// Reprocess /// if (settings_.reprocess_active == 1 ? true : false) { checkBox_reprocess_activate.Text = "Activer"; checkBox_reprocess_activate.Checked = true; } else { checkBox_reprocess_activate.Text = "Désactiver"; checkBox_reprocess_activate.Checked = false; } numericUpDown_hour.Value = settings_.reprocess_hour; numericUpDown1_reprocess_cd.Value = settings_.reprocess_countDown; } }
static void Main(string[] args) { const int SW_SHOWMINIMIZED = 2; var handle = GetConsoleWindow(); ShowWindow(handle, SW_SHOWMINIMIZED); // Hide or not the screen Database.Database db = new Database.Database(); db.initTables(); Database.Model.Settings _settings_ = db.settingsManager.get(db.connectionString, 1); int SW_HIDE_SHOW = _settings_.showWindow; // SW_HIDE = 0 // SW_SHOW = 5 if (SW_HIDE_SHOW == 5) { // Show ShowWindow(handle, 9); ShowWindow(handle, SW_HIDE_SHOW); int Height = Console.LargestWindowHeight - 20; int Width = Console.LargestWindowWidth - 20; Console.SetWindowSize(Width, Height); Console.SetWindowPosition(0, 0); } else if (SW_HIDE_SHOW == 0) { // Hide Console.SetWindowSize(1, 1); Console.SetWindowPosition(0, 0); ShowWindow(handle, SW_HIDE_SHOW); } db.alertMailLogManager.createTable(db.connectionString); db.alertMailLogManager.insert(db.connectionString, ""); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Gestion des notifications email /// Alert_Mail.Classes.ConfigurationSaveLoad file = new Alert_Mail.Classes.ConfigurationSaveLoad(); if (file.isSettings()) { db.alertMailLogManager.insert(db.connectionString, DateTime.Now + " : AlertMail :: Fichier SettingMail.json existe."); file.Load(); db.alertMailLogManager.insert(db.connectionString, DateTime.Now + " : AlertMail :: Fichier SettingMail.json chargé."); Alert_Mail.Classes.ConfigurationEmail settings = file.configurationEmail; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Email types /// if (args.Length == 0) { pendingFilesMail(settings, db); //Send a Mail every x time } else if (args.Length > 0 && args[0] == "All_Errors") //Send a Mail after the connecteur execution { errorMail(settings, db); } else if (args.Length > 0 && args[0] == "Error_Summary") //Send a Mail every x time { summaryMail(file, settings, db); } else { Console.WriteLine("Argument inconnue!!!"); db.alertMailLogManager.insert(db.connectionString, DateTime.Now + " : AlertMail :: Argument inconnue!!!"); } } else { Console.WriteLine("Aucune configuration e-mail trouvé!"); db.alertMailLogManager.insert(db.connectionString, DateTime.Now + " : AlertMail :: Aucune configuration e-mail trouvé!"); } db.alertMailLogManager.insert(db.connectionString, ""); //Console.ReadLine(); }
public Main() { InitializeComponent(); string version = new Connecteur_Info.ConnecteurInfo().Version; label3.Text = "Connecteur Sage v" + version + " \nImport et export de documents commerciaux."; labelVersion.Text = "Version : " + version; labelCopyright.Text = "Copyright © 2013 - 2022"; // Init Connecteur Info, Version and Database path in a file Init.Init init = new Init.Init(); if (init.isSettings()) { init.Load(); init.connecteurInfo.installation_dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); init.saveInfo(); } else { init.connecteurInfo = new Connecteur_Info.ConnecteurInfo(); init.connecteurInfo.installation_dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); init.saveInfo(); } Forms.ProgressDialog progressDialog = new Forms.ProgressDialog(); // Initialize the thread that will handle the background process Thread backgroundThread = new Thread( new ThreadStart(() => { //Loading General Settings if (progressDialog.InvokeRequired) { progressDialog.BeginInvoke(new System.Action(() => progressDialog.Text = "Loading General Settings....")); } for (int n = 0; n < 10; n++) { Thread.Sleep(1); progressDialog.UpdateProgress(n); } // Init database && tables Database.Database db = new Database.Database(); db.initTables(); Database.Model.Settings settings_ = db.settingsManager.get(db.connectionString, 1); if (settings_ != null) { //settings.configurationGeneral.general.showWindow == 5 ---> show software label_debugMode.Text = ((settings_.showWindow == 5) ? "Mode Débugage : Activé" : "Mode Débugage : Désactivé"); label_tarifaire.Text = ((settings_.priceType_active == 1 ? true : false) ? "Configuration Tarifaire : Activé" : "Config Tarifaire : Désactivé"); label_retraitement.Text = ((settings_.reprocess_active == 1 ? true : false) ? "Retraitement : Activé" : "Retraitement : Désactivé"); } else { try { using (Forms.GeneralConfig form = new Forms.GeneralConfig()) { form.ShowDialog(); } } // Récupération d'une possible SDKException catch (SDKException ex) { MessageBox.Show(ex.Message); } } //Loading Connexion Settings if (progressDialog.InvokeRequired) { progressDialog.BeginInvoke(new System.Action(() => progressDialog.Text = "Loading Connexion Settings....")); } for (int n = 10; n < 20; n++) { Thread.Sleep(1); progressDialog.UpdateProgress(n); } Connexion.ConnexionSaveLoad conn_Settings = new ConnexionSaveLoad(); if (conn_Settings.isSettings()) { conn_Settings.Load(); label1.Text = "DSN ODBC : " + conn_Settings.configurationConnexion.ODBC.DNS; label2.Text = "DSN ODBC Nom : " + conn_Settings.configurationConnexion.ODBC.USER; label5.Text = "DSN SQL : " + conn_Settings.configurationConnexion.SQL.DNS; label9.Text = "DSN SQL Nom : " + conn_Settings.configurationConnexion.SQL.USER; } else { try { using (Forms.ConfigConnexion form = new Forms.ConfigConnexion()) { form.ShowDialog(); } } // Récupération d'une possible SDKException catch (SDKException ex) { MessageBox.Show(ex.Message); } } //Loading Import Settings if (progressDialog.InvokeRequired) { progressDialog.BeginInvoke(new System.Action(() => progressDialog.Text = "Loading Import Settings....")); } for (int n = 20; n < 40; n++) { Thread.Sleep(1); progressDialog.UpdateProgress(n); } Config_Import.ConfigurationSaveLoad import_Settings = new Config_Import.ConfigurationSaveLoad(); if (import_Settings.isSettings()) { import_Settings.Load(); int cpt = 0; int count = -1; //Doc Export Achat //no config yet, so show désactivated only cpt = 0; count = 3; cpt += ((import_Settings.configurationImport.Doc_Achat.Commande.Activate == "true") ? 1 : 0); isDocAchatCommande = ((import_Settings.configurationImport.Doc_Achat.Commande.Activate == "true") ? true : false); cpt += ((import_Settings.configurationImport.Doc_Achat.DSADV.Activate == "true") ? 1 : 0); isDocAchatDESADV = ((import_Settings.configurationImport.Doc_Achat.DSADV.Activate == "true") ? true : false); cpt += ((import_Settings.configurationImport.Doc_Achat.Facture.Activate == "true") ? 1 : 0); isDocAchatFacture = ((import_Settings.configurationImport.Doc_Achat.Facture.Activate == "true") ? true : false); label2.Text = ((cpt == 0) ? "Document Achat d'import : désactivé" : "Document Achat d'import : " + cpt + "/" + count + " activé"); //Doc Export Vente cpt = 0; count = 3; cpt += ((import_Settings.configurationImport.Doc_Ventes.Commande.Activate == "true") ? 1 : 0); isDocVenteCommande = ((import_Settings.configurationImport.Doc_Ventes.Commande.Activate == "true") ? true : false); cpt += ((import_Settings.configurationImport.Doc_Ventes.DSADV.Activate == "true") ? 1 : 0); isDocVenteDESADV = ((import_Settings.configurationImport.Doc_Ventes.DSADV.Activate == "true") ? true : false); cpt += ((import_Settings.configurationImport.Doc_Ventes.Facture.Activate == "true") ? 1 : 0); isDocVenteFacture = ((import_Settings.configurationImport.Doc_Ventes.Facture.Activate == "true") ? true : false); label9.Text = ((cpt == 0) ? "Document Vente d'import : désactivé" : "Document Vente d'import : " + cpt + "/" + count + " activé"); // Stock cpt = 0; count = 1; cpt += ((import_Settings.configurationImport.Doc_Stock.Stock.Activate == "true") ? 1 : 0); isDocStock = ((import_Settings.configurationImport.Doc_Stock.Stock.Activate == "true") ? true : false); label11.Text = ((cpt == 0) ? "Document de stock import : désactivé" : "Document de stock import : " + cpt + "/" + count + " activé"); } else { try { using (ConfigImport form = new ConfigImport()) { form.ShowDialog(); } } // Récupération d'une possible SDKException catch (SDKException ex) { MessageBox.Show(ex.Message); } } // Loading Export Settings if (progressDialog.InvokeRequired) { progressDialog.BeginInvoke(new System.Action(() => progressDialog.Text = "Loading Export Settings....")); } for (int n = 40; n < 60; n++) { Thread.Sleep(1); progressDialog.UpdateProgress(n); } Config_Export.ConfigurationSaveLoad export_Settings = new Config_Export.ConfigurationSaveLoad(); if (export_Settings.isSettings()) { export_Settings.Load(); int cpt = 0; int count = -1; //Doc Export Achat //no config yet, so show désactivated only cpt = 0; count = 3; label7.Text = ((cpt == 0) ? "Document Achat d'Export : désactivé" : "Document Achat d'Export : " + cpt + "/" + count + " activé"); groupBox_export_doc_achat.Enabled = ((cpt == 0) ? false : true); label_export_doc_achat.Text = ((cpt == 0) ? "Ces fonctionnalité ne sont pas accessible..." : "....."); //Doc Export Vente cpt = 0; count = 3; cpt += ((export_Settings.configurationExport.Commande.Activate) ? 1 : 0); cpt += ((export_Settings.configurationExport.DSADV.Activate) ? 1 : 0); cpt += ((export_Settings.configurationExport.Facture.Activate) ? 1 : 0); label8.Text = ((cpt == 0) ? "Document Vente d'Export : désactivé" : "Document Vente d'Export : " + cpt + "/" + count + " activé"); groupBox_export_doc_vente.Enabled = ((cpt == 0) ? false : true); label_groupBox_export_doc_vente.Text = ((cpt == 0) ? "la configuration est nécessaire. Veuillez vous rendre dans la configuration d'export et la remplir, merci..." : ""); // Stock cpt = 0; count = 1; cpt += ((export_Settings.configurationExport.Stock.Activate) ? 1 : 0); label10.Text = ((cpt == 0) ? "Document stock d'Export : désactivé" : "Document stock d'Export : " + cpt + "/" + count + " activé"); groupBox_export_doc_stock.Enabled = ((cpt == 0) ? false : true); label_export_doc_stock.Text = ((cpt == 0) ? "Veuillez vous rendre dans la configuration d'export et la remplir, merci..." : ""); } else { try { using (ConfExport form = new ConfExport()) { form.ShowDialog(); } } // Récupération d'une possible SDKException catch (SDKException ex) { MessageBox.Show(ex.Message); } } //Loading Backup Settings if (progressDialog.InvokeRequired) { progressDialog.BeginInvoke(new System.Action(() => progressDialog.Text = "Loading Backup Settings....")); } for (int n = 60; n < 80; n++) { Thread.Sleep(1); progressDialog.UpdateProgress(n); } if (File.Exists(pathModule + @"\SettingBackup.xml")) { ConfigurationBackup backup = new ConfigurationBackup(); backup.Load(); label_backup_activation.Text = ((backup.activate) ? "Activation : Oui" : "Activation : Non"); label_backup_generalLog.Text = ((backup.general_Log != 0) ? "Log général : " + backup.general_Log + " jours" : "Log général : désactiver"); label_backup_importLog.Text = ((backup.import_Log != 0) ? "Log d'import : " + backup.import_Log + " jours" : "Log d'import : désactiver"); label_backup_exportLog.Text = ((backup.export_Log != 0) ? "Log d'export : " + backup.export_Log + " jours" : "Log d'export : désactiver"); label_backup_import_success.Text = ((backup.import_files_success != 0) ? "Fichier EDI import (Success) : " + backup.import_files_success + " jours" : "Fichier EDI import (Success) : désactiver"); label_backup_import_error.Text = ((backup.import_files_error != 0) ? "Fichier EDI import (Erreur) : " + backup.import_files_error + " jours" : "Fichier EDI import (Erreur) : désactiver"); label_fichier_backup.Text = ((backup.backup_files != 0) ? "Fichier EDI backup : " + backup.backup_files + " jours" : "Fichier EDI backup : désactiver"); } else { try { using (Forms.ConfigBackup form = new Forms.ConfigBackup()) { form.ShowDialog(); } } // Récupération d'une possible SDKException catch (SDKException ex) { MessageBox.Show(ex.Message); } } bool ok = false; for (int n = 80; n < 100; n++) { Thread.Sleep(1); progressDialog.UpdateProgress(n); if (n == 99) { ok = true; } ; } // Close the dialog if it hasn't been already if (ok && progressDialog.InvokeRequired) { progressDialog.BeginInvoke(new System.Action(() => progressDialog.Close())); string msg = "Vous pouvez réaliser l'import des documents commerciaux suivantes :\n\n"; msg += "Import des bons de commandes d'achat : " + ((isDocAchatCommande) ? "activé" : "désactivé") + "\n"; msg += "Import des bons de livraison d'achat : " + ((isDocAchatDESADV) ? "activé" : "désactivé") + "\n"; msg += "Import des factures d'achat : " + ((isDocAchatFacture) ? "activé" : "désactivé") + "\n\n"; msg += "Import des bons de commandes vente : " + ((isDocVenteCommande) ? "activé" : "désactivé") + "\n"; msg += "Import des bons de livraison vente : " + ((isDocVenteDESADV) ? "activé" : "désactivé") + "\n"; msg += "Import des factures vente : " + ((isDocVenteFacture) ? "activé" : "désactivé") + "\n\n"; msg += "Import des stock : " + ((isDocStock) ? "activé" : "désactivé") + "\n"; label4.Text = msg; } } )); // Start the background process thread backgroundThread.Start(); // Open the dialog progressDialog.ShowDialog(); }
public void EnregistrerLaTache(string date, string time) { string taskName = ReturnTaskName(); if (taskName == null) { MessageBox.Show("La tache " + taskName + " n'est pas enregistré !", "Tache Planifier", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DailyTrigger dt = null; if (checkBox1.Checked) { Classes.Credentials admin = new Classes.Credentials(string.Concat(Environment.UserDomainName, "\\", Environment.UserName), ""); try { Forms.AdminCredentials adminCredentials = new Forms.AdminCredentials(admin); if (adminCredentials.ShowDialog() == DialogResult.OK) { admin = adminCredentials.admin; //MessageBox.Show("Admin : \n"+new Init.Init().FormatJson(admin), "Info"); } else if (adminCredentials.ShowDialog() == DialogResult.Cancel) { return; } } catch (Exception ex) { MessageBox.Show("Message : " + ex.Message, "Erreur[100]", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { TaskService ts = new TaskService(); TaskDefinition td = ts.NewTask(); td.Principal.UserId = string.Concat(Environment.UserDomainName, "\\", Environment.UserName); // "SYSTEM"; td.RegistrationInfo.Author = string.Concat(Environment.UserDomainName, "\\", Environment.UserName); // "SYSTEM"; td.Principal.LogonType = TaskLogonType.S4U; td.Settings.AllowDemandStart = true; td.Principal.RunLevel = TaskRunLevel.Highest; dt = (DailyTrigger)td.Triggers.Add(new DailyTrigger(1)); string[] times = time.Split(':'); try { //MessageBox.Show("Date: " + date + " | time: " + time + "\nTime 1: " + times[0] + " | Time 2: " + times[1] + " | Time 3: " + times[2].Split(' ')[0], "Test", MessageBoxButtons.OK, MessageBoxIcon.Information); dt.StartBoundary = DateTime.Parse(date) + TimeSpan.FromHours(Convert.ToDouble(times[0])) + TimeSpan.FromMinutes(Convert.ToDouble(times[1])); } catch (Exception ex) { MessageBox.Show("Message : " + ex.Message + "\nDate: " + date + " | time: " + time + "\nTime 1: " + times[0] + " | Time 2: " + times[1] + " | Time 3: " + times[2].Split(' ')[0], "Erreur[101]", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (checkBox2.Checked) { //dt.Repetition.Duration = TimeSpan.FromDays(1); dt.Repetition.Interval = TimeSpan.FromMinutes(int.Parse(comboBox2.Text)); dt.Repetition.StopAtDurationEnd = true; } td.Actions.Add(new ExecAction(pathModule + @"\ConnecteurAuto.exe", null, null)); //ts.RootFolder.RegisterTaskDefinition(taskName, td); ts.RootFolder.RegisterTaskDefinition(taskName, td, TaskCreation.CreateOrUpdate, admin.User, admin.Password, TaskLogonType.Password, null); td.Settings.Enabled = true; int result = -99; Database.Model.Settings settings = db.settingsManager.get(db.connectionString, 1); if (settings != null) { settings.plannerTask_active = td.Settings.Enabled ? 1 : 0; settings.plannerTask_UserId = td.Principal.UserId; settings.plannerTask_name = taskName; result = db.settingsManager.update(db.connectionString, settings); } else { MessageBox.Show("Veuillez d'abord enregistrer les paramètres généraux", "Erreur de création", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (result > 0) { MessageBox.Show("La tache " + taskName + " est enregistré !", "Tache Planifier", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("Message : " + ex.Message, "Erreur de création", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { try { TaskService ts = new TaskService(); ts.RootFolder.DeleteTask(taskName); int result = -99; Database.Model.Settings settings = db.settingsManager.get(db.connectionString, 1); if (settings != null) { settings.plannerTask_active = 0; // is false | desable settings.plannerTask_UserId = ""; settings.plannerTask_name = ""; result = db.settingsManager.update(db.connectionString, settings); } else { MessageBox.Show("Veuillez d'abord enregistrer les paramètres généraux", "Erreur de création", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (result > 0) { MessageBox.Show("La tache " + taskName + " est supprimé !", "Tache Planifier", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("Message : " + ex.Message, "Erreur de suppréssion", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } Close(); }
private void button2_Click(object sender, EventArgs e) { int show; const int SW_HIDE = 0; const int SW_SHOW = 5; Database.Database db = new Database.Database(); Database.Model.Settings settings_ = db.settingsManager.get(db.connectionString, 1); if (settings_ == null) { if (debugMode_checkBox.Checked) { show = SW_SHOW; } else { show = SW_HIDE; } int _; if (!textBox1.Text.Equals("") && !int.TryParse(textBox1.Text.Trim(), out _)) { MessageBox.Show("Seulement les chiffres entre 0 à 9 sont valide!", "Compt. G. Taxe", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (textBox2.Text.Trim().Equals("") || textBox2.Text == null) { MessageBox.Show("Veuillez ajouter le chemin du répertoire CSV.", "Erreur Répertoire", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (checkBox_reprocess_activate.Checked == true && Convert.ToDouble(numericUpDown_hour.Value) == 0.0) { MessageBox.Show("Heure de retraitement n'est pas configuré !", "Retraitement", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string compt_g_taxe = ""; if (textBox1.Enabled) { compt_g_taxe = textBox1.Text.ToString(); } else { compt_g_taxe = "-1"; } try { Database.Model.Settings settings = new Database.Model.Settings( 1, show, checkBox_activate_compt_g_taxe.Checked ? 1 : 0, Convert.ToInt32(compt_g_taxe.Trim()), @"" + Directory.GetCurrentDirectory(), @"" + textBox2.Text.Trim(), "", "", 0, checkBox_activer_tarif.Checked ? 1 : 0, radioButton_tarif_cmd_EDI.Checked ? 1 : 0, radioButton_tarif_produit.Checked ? 1 : 0, radioButton_tarif_categorie.Checked ? 1 : 0, radioButton_tarif_client.Checked ? 1 : 0, checkBox_reprocess_activate.Checked ? 1 : 0, numericUpDown_hour.Value, Convert.ToInt32(numericUpDown1_reprocess_cd.Value)); //MessageBox.Show("Before Json: \n" + db.JsonFormat(settings), "Config Général", MessageBoxButtons.OK, MessageBoxIcon.Information); db.settingsManager.insert(db.connectionString, settings); Database.Model.Settings db_settings_ = db.settingsManager.get(db.connectionString, 1); //MessageBox.Show("After Json: \n" + db.JsonFormat(db_settings_), "Config Général Update", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Config Général ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { // if the config exist, then only get the isAppOpen variable // and re-save it with the new overall config if (debugMode_checkBox.Checked) { show = SW_SHOW; } else { show = SW_HIDE; } int _; if (!textBox1.Text.Equals("") && !int.TryParse(textBox1.Text.Trim(), out _)) { MessageBox.Show("Seulement les chiffres entre 0 à 9 sont valide!", "Compt. G. Taxe", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (checkBox_reprocess_activate.Checked == true && Convert.ToDouble(numericUpDown_hour.Value) == 0.0) { MessageBox.Show("Heure de retraitement n'est pas configuré !", "Retraitement", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string compt_g_taxe = ""; if (textBox1.Enabled) { compt_g_taxe = textBox1.Text.ToString(); } else { compt_g_taxe = "-1"; } try { Database.Model.Settings db_settings = new Database.Model.Settings( 1, show, checkBox_activate_compt_g_taxe.Checked ? 1 : 0, Convert.ToInt32(compt_g_taxe.Trim()), Directory.GetCurrentDirectory(), textBox2.Text.Trim(), "", "", 0, checkBox_activer_tarif.Checked ? 1 : 0, radioButton_tarif_cmd_EDI.Checked ? 1 : 0, radioButton_tarif_produit.Checked ? 1 : 0, radioButton_tarif_categorie.Checked ? 1 : 0, radioButton_tarif_client.Checked ? 1 : 0, checkBox_reprocess_activate.Checked ? 1 : 0, numericUpDown_hour.Value, Convert.ToInt32(numericUpDown1_reprocess_cd.Value)); //MessageBox.Show("Before Json: \n" + db.JsonFormat(db_settings), "Config Général Update", MessageBoxButtons.OK, MessageBoxIcon.Information); db.settingsManager.update(db.connectionString, db_settings); Database.Model.Settings db_settings_ = db.settingsManager.get(db.connectionString, 1); //MessageBox.Show("After Json: \n" + db.JsonFormat(db_settings_), "Config Général Update", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Config Général ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } Close(); }
public void hello() { Database.Database db = new Database.Database(); db.initTables(); Database.Model.Settings settings = db.settingsManager.get(db.connectionString, 1); string path_Dump_File = settings.EXE_Folder + @"\" + "Dump_File"; if (!Directory.Exists(path_Dump_File)) { //Create log directory Directory.CreateDirectory(path_Dump_File); } //string hello = path_Dump_File + @"\" + string.Format("testing_JL_1.txt", DateTime.Now); string hello = path_Dump_File + string.Format(@"\testing_JL_1.txt", DateTime.Now); var logFile_import = File.Create(hello); using (StreamWriter writer = new StreamWriter(logFile_import)) { writer.WriteLine("Hello"); writer.WriteLine("Dir 1 : " + Directory.GetCurrentDirectory()); writer.WriteLine("Dir 2 : " + path_Dump_File); writer.WriteLine("file : " + hello); writer.Flush(); writer.Close(); } try { // Objet mail MailMessage msg = new MailMessage(); // Expéditeur (obligatoire). Notez qu'on peut spécifier le nom msg.From = new MailAddress("*****@*****.**", "J-L CONNECTEUR SAGE CFCI-TW"); msg.To.Add(new MailAddress("*****@*****.**", "*****@*****.**")); msg.Subject = "Testing Connecteur"; msg.Body = "Hello testing"; // Fichier joint si besoin (facultatif) msg.Attachments.Add(new Attachment(hello)); SmtpClient client; // Envoi du message SMTP client = new SmtpClient("smtp.gmail.com", 587); client.Credentials = new NetworkCredential("*****@*****.**", "anexys1,"); client.EnableSsl = true; //NetworkInformation s = new NetworkCredential(); ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; // Envoi du mail client.Send(msg); Console.WriteLine(""); Console.WriteLine(DateTime.Now + " : Envoi de Mail..OK"); } catch (Exception e) { Console.WriteLine(DateTime.Now + " | *********** Exception EnvoiMail ***********"); Console.WriteLine(DateTime.Now + " | Message : " + e.Message); Console.WriteLine(DateTime.Now + " | StackTrace : " + e.StackTrace); } }