Ejemplo n.º 1
0
        public void SaveGenericWebError(GenericWebError error)
        {
            System.Diagnostics.EventLog.WriteEntry("DEBUG", "STO PER CREARE LA CONNESSIONE AL DB");
            System.Diagnostics.EventLog.WriteEntry("DEBUG", DataHelpers.ConnectionString());
            Database oDatabase = DatabaseFactory.CreateDatabase(DataHelpers.ConnectionString());

            System.Diagnostics.EventLog.WriteEntry("DEBUG", "STO PER CREARE LA CONNESSIONE AL DB");
            using (DbConnection connection = oDatabase.CreateConnection())
            {
                try
                {
                    connection.Open();
                    System.Diagnostics.EventLog.WriteEntry("DEBUG", "HO APERTO LA CONNESSIONE AL DB");
                }
                catch (Exception ex)
                {
                    System.Diagnostics.EventLog.WriteEntry("DEBUG", ex.Message);
                }

                try
                {
                    DbCommand oCommand = oDatabase.GetStoredProcCommand("sp_GenericWebError_Add");
                    if (error.UniqueID == System.Guid.Empty)
                    {
                        error.UniqueID = System.Guid.NewGuid();
                    }
                    oDatabase.AddInParameter(oCommand, "@Message", System.Data.DbType.String, error.Message);
                    oDatabase.AddInParameter(oCommand, "@InnerExceptionMessage", System.Data.DbType.String, error.InnerExceptionMessage);
                    oDatabase.AddInParameter(oCommand, "@ComolUniqueID", System.Data.DbType.String, error.ComolUniqueID);
                    oDatabase.AddInParameter(oCommand, "@SentDate", System.Data.DbType.DateTime, error.SentDate);
                    oDatabase.AddInParameter(oCommand, "@Day", System.Data.DbType.Date, error.Day);
                    oDatabase.AddInParameter(oCommand, "@UniqueID", System.Data.DbType.Guid, error.UniqueID);
                    oDatabase.AddInParameter(oCommand, "@ModuleCode", System.Data.DbType.String, error.ModuleCode);
                    oDatabase.AddInParameter(oCommand, "@CommunityID", System.Data.DbType.Int32, error.CommunityID);
                    oDatabase.AddInParameter(oCommand, "@ModuleID", System.Data.DbType.Int32, error.ModuleID);
                    oDatabase.AddInParameter(oCommand, "@UserID", System.Data.DbType.Int32, error.UserID);
                    oDatabase.AddInParameter(oCommand, "@ServerName", System.Data.DbType.String, error.ServerName);
                    oDatabase.AddInParameter(oCommand, "@Url", System.Data.DbType.String, error.Url);
                    oDatabase.AddInParameter(oCommand, "@QueryString", System.Data.DbType.String, error.QueryString);
                    oDatabase.AddInParameter(oCommand, "@ExceptionSource", System.Data.DbType.String, error.ExceptionSource);
                    oDatabase.AddInParameter(oCommand, "@BaseExceptionStackTrace", System.Data.DbType.String, error.BaseExceptionStackTrace);

                    oCommand.Connection = connection;
                    System.Diagnostics.EventLog.WriteEntry("DEBUG", "ASTO PER INSERIRE UN ERRORE");
                    if (oCommand.ExecuteNonQuery() == 0)
                    {
                        throw new Exception("no insert: sp_GenericWebError_Add");
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.EventLog.WriteEntry("ManagerDatabase - GenericWebError", ex.Message);
                    throw new Exception("no insert: sp_GenericWebError_Add");
                }
            }
        }
 void iErrorsNotificationService.sendGenericWebError(GenericWebError error)
 {
     try
     {
         IManagerErrors manager = GetManager(error.Persist, error.ComolUniqueID, error.Type);
         manager.SaveGenericWebError(error);
     }
     catch (Exception ex)
     {
         ErrorHandler pError = new ErrorHandler();
         pError.addMessageToPoisonQueue(error, ex);
     }
 }
Ejemplo n.º 3
0
 public void SaveGenericWebError(GenericWebError error)
 {
     try
     {
         String subject = string.Format(_template.Subject, error.ComolUniqueID);
         String body    = string.Format(_template.Body, error.SentDate.ToLongDateString(), error.ServerName, error.UserID, error.ModuleCode, error.ModuleID,
                                        error.CommunityID, error.Url, error.QueryString, error.Message, error.InnerExceptionMessage, error.ExceptionSource, error.BaseExceptionStackTrace);
         System.Diagnostics.EventLog.WriteEntry("DEBUG", "STO PER INVIARE LA MAIL");
         DataHelpers.SendMessage(_setting, subject, body);
     }
     catch (Exception ex)
     {
         System.Diagnostics.EventLog.WriteEntry("Mail - GenericWebError ", ex.Message);
         throw ex;
     }
 }
Ejemplo n.º 4
0
 public void SaveGenericWebError(GenericWebError error)
 {
     throw new NotImplementedException();
 }