partial void DeleteSystemEventLog(SystemEventLog instance);
 partial void InsertSystemEventLog(SystemEventLog instance);
 partial void UpdateSystemEventLog(SystemEventLog instance);
Exemplo n.º 4
0
        //Own methods
        private void BookingLog(string ErrorType, string Message)
        {
            //First we write to the normal windows application log
            writeToLog("Computer: " + System.Environment.MachineName + " " + ErrorType, Message);

            //Then try to sende error message til a gmail account
            sendToGmail("Computer: " + System.Environment.MachineName + " " + ErrorType + " " + Message);

            //And last we try to write to the SQL log tabel if possible
            try
            {
                DataClasses1DataContext db = new DataClasses1DataContext();

                Thread.Sleep(100);

                Random _rn = new Random(DateTime.Today.Millisecond);

                SystemEventLog _log = new SystemEventLog();

                _log.bookingLogID = _rn.Next().ToString();
                _log.bookingLogErrorType = "Computer: " + System.Environment.MachineName + " " + ErrorType;
                _log.bookingLogMessage = Message;
                _log.bookingLogDateTime = DateTime.Now;

                db.SystemEventLogs.InsertOnSubmit(_log);

                db.SubmitChanges();
            }
            catch (Exception E)
            {
            }
        }