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(); }
private void loadConfiguration() { Alert_Mail.Classes.ConfigurationSaveLoad settings = new Alert_Mail.Classes.ConfigurationSaveLoad(); if (settings.isSettings()) { settings.Load(); /////////////////////////////////////////////////////////////////////////////////////////////// /// AlertMail Activation /// checkBox1.Checked = settings.configurationEmail.active; /////////////////////////////////////////////////////////////////////////////////////////////// /// Connexion configuration /// textBox_smtp.Text = Helpers.Utils.Decrypt(settings.configurationEmail.connexion.smtp); textBox_port.Text = Helpers.Utils.Decrypt(settings.configurationEmail.connexion.port); textBox_login.Text = Helpers.Utils.Decrypt(settings.configurationEmail.connexion.login); textBox_pwd.Text = Helpers.Utils.Decrypt(settings.configurationEmail.connexion.password); /////////////////////////////////////////////////////////////////////////////////////////////// /// Email lists configuration /// checkBox_activate_send_client_emails.Checked = settings.configurationEmail.emailLists.activeClient; this.clientEmails = settings.configurationEmail.emailLists.emailClientList; string msg = ""; if (clientEmails.Count < 1) { msg = clientEmails[0]; } else { msg += clientEmails[0]; for (int x = 1; x < clientEmails.Count; x++) { msg += "\n" + clientEmails[x]; } } label_client_email_list.Text = msg; checkBox_activate_send_team_emails.Checked = settings.configurationEmail.emailLists.activeTeam; this.teamEmails = settings.configurationEmail.emailLists.emailTeamList; msg = ""; if (teamEmails.Count < 1) { msg = teamEmails[0]; } else { msg += teamEmails[0]; for (int x = 1; x < teamEmails.Count; x++) { msg += "\n" + teamEmails[x]; } } label_team_email_list.Text = msg; /////////////////////////////////////////////////////////////////////////////////////////////// /// Error mail configuration /// checkBox12.Checked = settings.configurationEmail.emailError.active; checkBox11.Checked = settings.configurationEmail.emailError.informClient; checkBox10.Checked = settings.configurationEmail.emailError.informTeam; /////////////////////////////////////////////////////////////////////////////////////////////// /// Summary mail configuration /// checkBox15.Checked = settings.configurationEmail.emailSummary.active; numericUpDown1.Value = settings.configurationEmail.emailSummary.hours; /////////////////////////////////////////////////////////////////////////////////////////////// /// Inport configuration /// checkBox13.Checked = settings.configurationEmail.emailPendingFiles.active; numericUpDown2.Value = settings.configurationEmail.emailPendingFiles.hours; } }