Esempio n. 1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {

#if(!DEBUG)   
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[] 
			{ 
				new InformationService()
			};
            ServiceBase.Run(ServicesToRun);
#else
            Information test = new Information();
            test.Execute();
#endif  
        }
Esempio n. 2
0
        private void LogReport(Information information)
        {
            //StringBuilder result = new StringBuilder();
            //string dateTimeFormatString = "yyyy/MM/dd HH:mm:ss";

            //if (sendEmailSession.FinishSendEmailTime == DateTime.MaxValue)
            //{
            //    result.AppendFormat("SENDING EMAIL FAIL");
            //    for (int i = 0; i < sendEmailSession.ListError.Count; i++)
            //    {
            //        result.Append("\r\n");
            //        result.Append("Error: " + sendEmailSession.ListError[i].Message);
            //    }
            //    Logger.Error(result);
            //}
            //else
            //{
            //    if (sendEmailSession.ListError.Count == 0)
            //    {
            //        result.AppendFormat("SENDING EMAIL SUCCESS");
            //    }
            //    else
            //    {
            //        result.AppendFormat("SENDING EMAIL SUCCESS WITH {0} ERROR(S)", sendEmailSession.ListError.Count);

            //        SendEmailException sendEmailException = new SendEmailException();
            //        string errorMessage = "";
            //        for (int i = 0; i < sendEmailSession.ListError.Count; i++)
            //        {
            //            sendEmailException = (SendEmailException)sendEmailSession.ListError[i];
            //            errorMessage = string.Format("Error when sending email from: {0}; to: {1}; title: {2}", sendEmailException.EmailException.SenderEmail, sendEmailException.EmailException.ReceiverEmail, sendEmailException.EmailException.Subject);
            //            result.Append("\r\n");
            //            result.Append(errorMessage);
            //        }
            //    }

            //    result.Append("\r\n")
            //        .AppendFormat("    Start at: {0}", sendEmailSession.StartSendEmailTime.ToString(dateTimeFormatString))
            //        .AppendFormat("    Finish at: {0}", sendEmailSession.FinishSendEmailTime.ToString(dateTimeFormatString))
            //        .AppendFormat("    Number of emails: {0}", sendEmailSession.NumberOfEmails);
            //    Logger.Info(result);
            //}
        }