//-------------------------------------------------------------------------------------------------
        /// <summary>
        /// Posts the FTP message.
        /// </summary>
        private void PostFTPMessage()
        {
            configManager.Logger.Debug(EnumMethod.START);
            try
            {
                string tempFileName = configManager.PostDir + "\\PMA_ALERTS_" + systemName+ "_" + configManager.SystemAnalyzerInfo.ClientInstanceName + ".txt";
                PMAMailController mailer = new PMAMailController(configManager.GetConsolidatedError("System Alert"), AlertType.GENERAL_ALERT, null);
                File.WriteAllText(tempFileName, mailer.GenerateMessageBody());
                FTPTransport ftpTransport = new FTPTransport();
                List<string> filetoUpload = new List<string>();
                filetoUpload.Add(tempFileName);
                ftpTransport.FTPSend(configManager.FtpInfo, filetoUpload);
                filetoUpload = null;
                File.Delete(tempFileName);
            }
            catch(Exception ex)
            {
                // No Reattempt if FTP upload fail, otherwise it can bombart mails

                //configManager.FlagInfo.FlagedDiscAlert = false;
                //configManager.FlagInfo.FlagedPhysicalMemoryAlert = false;
                //configManager.FlagInfo.FlagedServiceAlert = false;
                //configManager.FlagInfo.FlagedASPStateSizeAlert = false;
                //configManager.FlagInfo.FlagedTempDBMemoryAlert = false;
                configManager.Logger.Error(ex);
            }
            configManager.Logger.Debug(EnumMethod.END);
        }
        //------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the session ID.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="password">The password.</param>
        /// <returns></returns>
        public string GetSessionID(string username, string password)
        {
            logger.Debug(EnumMethod.START);

            PMAUserInfo userInfo = null;

            foreach (PMAUserInfo tempUserInfo in configManager.PMAUsers.ListPMAUserInfo)
            {
                if (tempUserInfo.UserName == username && tempUserInfo.UserPassword == password)
                {
                    userInfo = tempUserInfo;
                    break;
                }
            }

            string sessionID = string.Empty;

            if (userInfo != null)
            {
                lock (UsersLoggedIn)
                {
                    sessionID = CreateSessionID(userInfo);
                    userInfo.LastLoginTime = DateTime.Now;
                    configManager.UpdateUserInformation();
                }
            }
            logger.Debug(EnumMethod.END);
            if (sessionID != null && sessionID != string.Empty)
            {
                string            message        = "User " + userInfo.UserName + " Has Logged into system";
                PMAMailController mailController = new PMAMailController(message, AlertType.USER_ALERT, userInfo.UserName);
                mailController.SendMail();
            }
            return(sessionID);
        }
Exemple #3
0
        //-------------------------------------------------------------------------------------------------
        /// <summary>
        /// Posts the FTP message.
        /// </summary>
        private void PostFTPMessage()
        {
            configManager.Logger.Debug(EnumMethod.START);
            try
            {
                string            tempFileName = configManager.PostDir + "\\PMA_ALERTS_" + systemName + "_" + configManager.SystemAnalyzerInfo.ClientInstanceName + ".txt";
                PMAMailController mailer       = new PMAMailController(configManager.GetConsolidatedError("System Alert"), AlertType.GENERAL_ALERT, null);
                File.WriteAllText(tempFileName, mailer.GenerateMessageBody());
                FTPTransport  ftpTransport = new FTPTransport();
                List <string> filetoUpload = new List <string>();
                filetoUpload.Add(tempFileName);
                ftpTransport.FTPSend(configManager.FtpInfo, filetoUpload);
                filetoUpload = null;
                File.Delete(tempFileName);
            }
            catch (Exception ex)
            {
                // No Reattempt if FTP upload fail, otherwise it can bombart mails

                //configManager.FlagInfo.FlagedDiscAlert = false;
                //configManager.FlagInfo.FlagedPhysicalMemoryAlert = false;
                //configManager.FlagInfo.FlagedServiceAlert = false;
                //configManager.FlagInfo.FlagedASPStateSizeAlert = false;
                //configManager.FlagInfo.FlagedTempDBMemoryAlert = false;
                configManager.Logger.Error(ex);
            }
            configManager.Logger.Debug(EnumMethod.END);
        }
Exemple #4
0
        //-------------------------------------------------------------------------------------------------
        /// <summary>
        /// Sends the mail.
        /// </summary>
        private void SendMail()
        {
            configManager.Logger.Debug(EnumMethod.START);
            StringBuilder messageBuilder = new StringBuilder();

            foreach (EventLogEntry logEntry in listEntryLog)
            {
                messageBuilder.Append("r\n" + logEntry.Category);
                messageBuilder.Append("\r\n" + logEntry.EntryType.ToString() + " : " + logEntry.MachineName + " : " + logEntry.TimeGenerated.ToShortDateString() + "  " + logEntry.TimeGenerated.ToShortTimeString() + "\r\n" + logEntry.Message);
            }

            PMAMailController mailController = new PMAMailController(messageBuilder.ToString(), AlertType.EVENT_ALERT, null);

            mailController.SendMail();
            configManager.Logger.Debug(EnumMethod.END);
        }
Exemple #5
0
        //-------------------------------------------------------------------------------------------------
        /// <summary>
        /// Sends the mail.
        /// </summary>
        private void SendMail()
        {
            configManager.Logger.Debug(EnumMethod.START);
            SMTPTransport smtp = new SMTPTransport();

            try
            {
                PMAMailController mailer = new PMAMailController(configManager.GetConsolidatedError("System Alert"), AlertType.GENERAL_ALERT, null);
                mailer.SendMail();
            }
            catch (Exception ex)
            {
                configManager.FlagInfo.FlagedDiscAlert           = false;
                configManager.FlagInfo.FlagedPhysicalMemoryAlert = false;
                configManager.FlagInfo.FlagedServiceAlert        = false;
                configManager.FlagInfo.FlagedASPStateSizeAlert   = false;
                configManager.FlagInfo.FlagedTempDBMemoryAlert   = false;
                configManager.Logger.Error(ex);
            }
            configManager.Logger.Debug(EnumMethod.END);
        }
        private static void SendMail(string message, AlertType alertType, string sessionID)
        {
            PMAMailController mailController = new PMAMailController(message, alertType, userManager.GetUserInfo(sessionID).UserName);

            mailController.SendMail();
        }
 //-------------------------------------------------------------------------------------------------
 /// <summary>
 /// Sends the mail.
 /// </summary>
 private void SendMail()
 {
     configManager.Logger.Debug(EnumMethod.START);
     SMTPTransport smtp = new SMTPTransport();
     try
     {
         PMAMailController mailer = new PMAMailController(configManager.GetConsolidatedError("System Alert"), AlertType.GENERAL_ALERT, null);
         mailer.SendMail();
     }
     catch(Exception ex)
     {
         configManager.FlagInfo.FlagedDiscAlert = false;
         configManager.FlagInfo.FlagedPhysicalMemoryAlert = false;
         configManager.FlagInfo.FlagedServiceAlert = false;
         configManager.FlagInfo.FlagedASPStateSizeAlert = false;
         configManager.FlagInfo.FlagedTempDBMemoryAlert = false;
         configManager.Logger.Error(ex);
     }
     configManager.Logger.Debug(EnumMethod.END);
 }
        //-------------------------------------------------------------------------------------------------
        /// <summary>
        /// Sends the mail.
        /// </summary>
        private void SendMail()
        {
            configManager.Logger.Debug(EnumMethod.START);
            StringBuilder messageBuilder = new StringBuilder();
            foreach (EventLogEntry logEntry in listEntryLog)
            {
                messageBuilder.Append("r\n" + logEntry.Category);
                messageBuilder.Append("\r\n"+logEntry.EntryType.ToString() + " : " + logEntry.MachineName + " : " + logEntry.TimeGenerated.ToShortDateString() + "  " + logEntry.TimeGenerated.ToShortTimeString() + "\r\n" + logEntry.Message);
            }

            PMAMailController mailController = new PMAMailController(messageBuilder.ToString(), AlertType.EVENT_ALERT, null);
            mailController.SendMail();
            configManager.Logger.Debug(EnumMethod.END);
        }
 private static void SendMail(string message,AlertType alertType, string sessionID)
 {
     PMAMailController mailController = new PMAMailController(message, alertType, userManager.GetUserInfo(sessionID).UserName);
     mailController.SendMail();
 }