예제 #1
0
        /// <summary>
        /// Get only the records with SendNewsletter enabled from the "Users" database table.
        /// </summary>
        /// <param name="portalID">The portal ID.</param>
        /// <returns></returns>
        public IList<dynamic> GetUsersNewsletter(int portalID)
        {
            var model = new DynamicModel(connectionStringName: "ConnectionString");
            var users = model.Fetch(@"
                SELECT mem.UserId, prof.Name, mem.Email
                FROM aspnet_Membership mem INNER JOIN
                     aspnet_CustomProfile prof ON mem.UserId = prof.UserId INNER JOIN
                     aspnet_Applications app ON mem.ApplicationId = app.ApplicationId INNER JOIN
                     rb_Portals por ON LOWER(por.PortalAlias) = app.LoweredApplicationName
                WHERE
                     por.PortalID = @0 AND prof.SendNewsletter = 1
                     AND (NOT (mem.Email IN (SELECT Email FROM rb_BlackList WHERE PortalID = @0)))", portalID);

            // Return the list
            return users;
        }
예제 #2
0
 private static dynamic GetFaultyModule(Exception exception, int pageId)
 {
     var trace = new System.Diagnostics.StackTrace(exception);
     var model = new DynamicModel(connectionStringName: "ConnectionString");
     var query = string.Concat(@"
             SELECT m.ModuleDefID
             FROM rb_GeneralModuleDefinitions gmd INNER JOIN
                     rb_ModuleDefinitions md ON gmd.GeneralModDefID = md.GeneralModDefID INNER JOIN
                     rb_Modules m ON md.ModuleDefID = m.ModuleDefID INNER JOIN
                     rb_Pages p ON p.PageID = m.TabID AND md.PortalID = p.PortalID
             WHERE m.TabID = ", pageId.ToString(), @"
               AND gmd.ClassName = @0 ");
     var lastTypeWithError_FullName = string.Empty;
     foreach (var frame in trace.GetFrames())
     {
         var typeWithError = frame.GetMethod().ReflectedType;
         if (lastTypeWithError_FullName == typeWithError.FullName)
         {
             continue;
         }
         lastTypeWithError_FullName = typeWithError.FullName;
         var mids = model.Fetch(query, lastTypeWithError_FullName);
         if (mids.Count > 0)
         {
             dynamic firstResult = mids[0];
             dynamic result = new ExpandoObject();
             result.Message = string.Concat(exception.Message, " \r\n", exception.StackTrace);
             result.ModuleDefID = firstResult.ModuleDefID;
             return result;
         }
     }
     if (exception.InnerException != null)
     {
         return GetFaultyModule(exception.InnerException, pageId);
     }
     return null;
 }