private void CreateItemJson(IDataItems items, string dir, JsonExportTree t, Type itemType = null)
        {
            if (items == null)
            {
                return;
            }
            t.location = items.Key;
            string path = Path.Combine(dir, $"{items.Key}.js");;        // 文件:\data\3bd9a209-cdaf-42ab-b232-1aa4636f5a17.js

            using (StreamWriter sw = new StreamWriter(path, false, Encoding.UTF8))
            {
                #region 生成数据json
                sw.Write("var __data = [");
                int r = 0;
                //items.Filter();
                foreach (var c in items.View)
                {
                    if (r != 0)
                    {
                        sw.Write(",");
                    }
                    sw.Write(Serializer.JsonSerilize(c));
                    r++;
                }
                sw.Write("];");
                #endregion

                #region 生成列属性json
                if (itemType == null)            //如果没有传入类型,则根据泛型参数类型来获取
                {
                    if (items.GetType().IsGenericType)
                    {
                        itemType = items.GetType().GetGenericArguments()[0];
                    }
                    else
                    {
                        throw new Exception("暂时先不处理的类型问题");
                    }
                }
                sw.Write("var __columns = ");
                List <JsonExportColumn> cols = new List <JsonExportColumn>();
                foreach (var c in DisplayAttributeHelper.FindDisplayAttributes(itemType))
                {
                    if (c.Visibility != EnumDisplayVisibility.ShowInDatabase)
                    {
                        cols.Add(new JsonExportColumn()
                        {
                            field = c.PropertyName, title = c.Text
                        });
                    }
                }
                sw.Write(Serializer.JsonFastSerilize(cols));
                sw.Write(";");
                #endregion
            }
        }
示例#2
0
        private void CreateItemJson(IDataItems items, string dir, ExportTree t, Type itemType = null)
        {
            if (items == null)
            {
                return;
            }
            t.location = items.Key;
            string path = $"{dir}{items.Key}.js";

            using (StreamWriter sw = new StreamWriter(path, false, Encoding.UTF8))
            {
                sw.Write("var __data = [");
                int r = 0;
                items.Filter();
                foreach (var c in items.View)
                {
                    if (r != 0)
                    {
                        sw.Write(",");
                    }
                    sw.Write(Serializer.JsonSerilize(c));
                    r++;
                }
                sw.Write("];");

                sw.Write("var __columns = ");
                List <ExportColumn> cols = new List <ExportColumn>();
                foreach (var c in DisplayAttributeHelper.FindDisplayAttributes(itemType))
                {
                    if (c.Visibility != EnumDisplayVisibility.ShowInDatabase)
                    {
                        cols.Add(new ExportColumn()
                        {
                            field = c.Key, title = c.Text
                        });
                    }
                }
                sw.Write(Serializer.JsonFastSerilize(cols));
                sw.Write(";");
            }
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            IDataItems item = null;
            Type       type = typeof(IDataItems);
            Dictionary <string, object> dicProp = new Dictionary <string, object>();

            if (reader.TokenType == JsonToken.StartObject)       //如果是object对象
            {
                JObject jo = JObject.Load(reader);
                foreach (var j in jo.Properties())    //读取所有的json属性
                {
                    dicProp[j.Name] = j.Value.ToObject <string>();
                }
            }

            if (dicProp.ContainsKey("$type"))   //如果包含了$type,则创建实际的数据类型实例,并反射设置值
            {
                type = Type.GetType(dicProp["$type"].ToString());
                if (type.IsGenericType)
                {
                    item = Activator.CreateInstance(type, dicProp["DbFilePath"], false, dicProp["DbTableName"], dicProp["Key"]) as IDataItems;
                }
                else
                {
                    item = Activator.CreateInstance(type, dicProp["DbFilePath"], dicProp["DataColunms"], false) as IDataItems;
                }

                foreach (var p in dicProp)
                {
                    if (p.Key != "$type")
                    {
                        type.GetProperty(p.Key).SetValue(item, p.Value);
                    }
                }
            }

            return(item);
        }
        protected void ExtendModel(JObject model, bool onlyData, bool onlyMainData)
        {
            if (_portalSettings == null)
            {
                onlyData = true;
            }

            if (_templateFiles != null)
            {
                // include additional data in the Model
                if (_templateFiles.AdditionalDataInTemplate && _manifest.AdditionalDataDefined())
                {
                    model["AdditionalData"] = GetAdditionalData();
                }
                // include collections
                if (_templateFiles.Model != null)
                {
                    var additionalCollections = _templateFiles.Model.Where(c => c.Key != _collection);
                    if (additionalCollections.Any())
                    {
                        var collections  = model["Collections"] = new JObject();
                        var dsColContext = OpenContentUtils.CreateDataContext(_module);
                        foreach (var item in additionalCollections)
                        {
                            var colManifest = item.Value;
                            dsColContext.Collection = item.Key;
                            Select select = null;
                            if (item.Value.Query != null)
                            {
                                var          indexConfig  = OpenContentUtils.GetIndexConfig(_module.Settings.TemplateDir, item.Key);
                                QueryBuilder queryBuilder = new QueryBuilder(indexConfig);
                                var          u            = PortalSettings.Current.UserInfo;
                                queryBuilder.Build(item.Value.Query, true, u.UserID, DnnLanguageUtils.GetCurrentCultureCode(), u.Social.Roles);
                                select = queryBuilder.Select;
                            }
                            IDataItems dataItems   = _ds.GetAll(dsColContext, select);
                            var        colDataJson = new JArray();
                            foreach (var dataItem in dataItems.Items)
                            {
                                var json = dataItem.Data;
                                if (json is JObject)
                                {
                                    JObject context = new JObject();
                                    json["Context"] = context;
                                    context["Id"]   = dataItem.Id;
                                    EnhanceSelect2(json as JObject, onlyData);
                                    JsonUtils.SimplifyJson(json, GetCurrentCultureCode());
                                }
                                colDataJson.Add(json);
                            }
                            collections[item.Key]          = new JObject();
                            collections[item.Key]["Items"] = colDataJson;
                        }
                    }
                }
            }
            // include settings in the Model
            if (!onlyMainData && _templateManifest.SettingsNeeded() && !string.IsNullOrEmpty(_settingsJson))
            {
                try
                {
                    var jsonSettings = JToken.Parse(_settingsJson);
                    JsonUtils.SimplifyJson(jsonSettings, GetCurrentCultureCode());
                    model["Settings"] = jsonSettings;
                }
                catch (Exception ex)
                {
                    throw new Exception("Error parsing Json of Settings", ex);
                }
            }

            // include static localization in the Model
            if (!onlyMainData)
            {
                JToken localizationJson     = null;
                string localizationFilename = _physicalTemplateFolder + GetCurrentCultureCode() + ".json";
                if (File.Exists(localizationFilename))
                {
                    string fileContent = File.ReadAllText(localizationFilename);
                    if (!string.IsNullOrWhiteSpace(fileContent))
                    {
                        localizationJson = fileContent.ToJObject("Localization: " + localizationFilename);
                    }
                }
                if (localizationJson != null)
                {
                    model["Localization"] = localizationJson;
                }
            }
            if (!onlyData)
            {
                // include CONTEXT in the Model
                JObject context = new JObject();
                model["Context"]        = context;
                context["ModuleId"]     = _module.ViewModule.ModuleID;
                context["TabId"]        = _module.ViewModule.TabID;
                context["GoogleApiKey"] = OpenContentControllerFactory.Instance.OpenContentGlobalSettingsController(_portalId).GetGoogleApiKey();
                context["ModuleTitle"]  = _module.ViewModule.ModuleTitle;
                var editIsAllowed = !_manifest.DisableEdit && IsEditAllowed(-1);
                context["IsEditable"]    = editIsAllowed; //allowed to edit the item or list (meaning allow Add)
                context["IsEditMode"]    = IsEditMode;
                context["PortalId"]      = _portalId;
                context["MainUrl"]       = Globals.NavigateURL(_detailTabId, false, _portalSettings, "", GetCurrentCultureCode());
                context["HomeDirectory"] = _portalSettings.HomeDirectory;
                context["HTTPAlias"]     = _portalSettings.PortalAlias.HTTPAlias;
            }
        }
        public override IList <SearchDocument> GetModifiedSearchDocuments(ModuleInfo modInfo, DateTime beginDateUtc)
        {
            App.Services.Logger.Trace($"Indexing content Module {modInfo.ModuleID} - Tab {modInfo.TabID} - Culture {modInfo.CultureCode}- indexing from {beginDateUtc}");
            var searchDocuments = new List <SearchDocument>();

            //If module is marked as "don't index" then return no results
            if (modInfo.ModuleSettings.GetValue("AllowIndex", "True") == "False")
            {
                App.Services.Logger.Trace($"Indexing content {modInfo.ModuleID}|{modInfo.CultureCode} - NOT - MODULE Indexing disabled");
                return(searchDocuments);
            }

            //If tab of the module is marked as "don't index" then return no results
            if (modInfo.ParentTab.TabSettings.GetValue("AllowIndex", "True") == "False")
            {
                App.Services.Logger.Trace($"Indexing content {modInfo.ModuleID}|{modInfo.CultureCode} - NOT - TAB Indexing disabled");
                return(searchDocuments);
            }

            //If tab is marked as "inactive" then return no results
            if (modInfo.ParentTab.DisableLink)
            {
                App.Services.Logger.Trace($"Indexing content {modInfo.ModuleID}|{modInfo.CultureCode} - NOT - TAB is inactive");
                return(searchDocuments);
            }

            var module = OpenContentModuleConfig.Create(modInfo, PortalSettings.Current);

            if (module.Settings.Template?.Main == null || !module.Settings.Template.Main.DnnSearch)
            {
                return(searchDocuments);
            }
            if (module.Settings.IsOtherModule)
            {
                return(searchDocuments);
            }

            IDataSource ds        = DataSourceManager.GetDataSource(module.Settings.Manifest.DataSource);
            var         dsContext = OpenContentUtils.CreateDataContext(module);

            IDataItems contentList = ds.GetAll(dsContext, null);

            if (!contentList.Items.Any())
            {
                App.Services.Logger.Trace($"Indexing content {modInfo.ModuleID}|{modInfo.CultureCode} - NOT - No content found");
            }
            foreach (IDataItem content in contentList.Items)
            {
                if (content == null)
                {
                    App.Services.Logger.Trace($"Indexing content {modInfo.ModuleID}|{modInfo.CultureCode} - NOT - Content is Null");
                }
                else if (content.LastModifiedOnDate.ToUniversalTime() > beginDateUtc &&
                         content.LastModifiedOnDate.ToUniversalTime() < DateTime.UtcNow)
                {
                    SearchDocument searchDoc;
                    if (DnnLanguageUtils.IsMultiLingualPortal(modInfo.PortalID))
                    {
                        // first process the default language module
                        var culture       = modInfo.CultureCode;
                        var localizedData = GetLocalizedContent(content.Data, culture);
                        searchDoc = CreateSearchDocument(modInfo, module.Settings, localizedData, content.Id, culture, content.Title, content.LastModifiedOnDate.ToUniversalTime());
                        searchDocuments.Add(searchDoc);
                        App.Services.Logger.Trace($"Indexing content {modInfo.ModuleID}|{culture} -  OK!  {searchDoc.Title} ({modInfo.TabID}) of {content.LastModifiedOnDate.ToUniversalTime()}");

                        // now do the same with any linked localized instances of this module
                        if (modInfo.LocalizedModules != null)
                        {
                            foreach (var localizedModule in modInfo.LocalizedModules)
                            {
                                culture       = localizedModule.Value.CultureCode;
                                localizedData = GetLocalizedContent(content.Data, culture);
                                searchDoc     = CreateSearchDocument(modInfo, module.Settings, localizedData, content.Id, culture, content.Title, content.LastModifiedOnDate.ToUniversalTime());
                                searchDocuments.Add(searchDoc);
                                App.Services.Logger.Trace($"Indexing content {modInfo.ModuleID}|{culture} -  OK!  {searchDoc.Title} ({modInfo.TabID}) of {content.LastModifiedOnDate.ToUniversalTime()}");
                            }
                        }
                    }
                    else
                    {
                        searchDoc = CreateSearchDocument(modInfo, module.Settings, content.Data, content.Id, "", content.Title, content.LastModifiedOnDate.ToUniversalTime());
                        searchDocuments.Add(searchDoc);
                        App.Services.Logger.Trace($"Indexing content {modInfo.ModuleID}|{modInfo.CultureCode} -  OK!  {searchDoc.Title} ({modInfo.TabID}) of {content.LastModifiedOnDate.ToUniversalTime()}");
                    }
                }
                else
                {
                    App.Services.Logger.Trace($"Indexing content {modInfo.ModuleID}|{modInfo.CultureCode} - NOT - No need to index: lastmod {content.LastModifiedOnDate.ToUniversalTime()} ");
                }
            }
            return(searchDocuments);
        }
        /// <summary>
        /// Example stepping through the structure of the
        /// ResultData object
        /// </summary>
        /// <param name="resultFilepath">Path to a result file</param>
        public static void FirstExample(string resultFilepath)
        {
            // load a result file
            IResultData resultData = new ResultData();

            resultData.Connection = Connection.Create(resultFilepath);
            Diagnostics resultDiagnostics = new Diagnostics("Example");

            resultData.Load(resultDiagnostics);

            if (resultDiagnostics.ErrorCountRecursive > 0)
            {
                // Do some error reporting
                throw new Exception("File could not be loaded");
            }

            // Time definition of the time step stored
            int      numtimesteps = resultData.NumberOfTimeSteps;
            DateTime startTime    = resultData.StartTime;
            DateTime endTime      = resultData.EndTime;
            // times for all timesteps
            IListDateTimes times = resultData.TimesList;

            // Results are stored in DataItem’s, where one DataItem contains e.g. water level.
            // Nodes, Reaches, Catchments and GlobalData of the resultData object will have a
            // number of data items.
            // A data item will store data for a number of elements and for a number
            // of time steps.
            // In reaches there will be more than one "element", since a reach will store
            // data for several grid points. Nodes and catchments will always only have
            // one element per data item

            IRes1DNodes      nodes      = resultData.Nodes;
            IRes1DReaches    reaches    = resultData.Reaches;
            IRes1DCatchments catchments = resultData.Catchments;
            IRes1DGlobalData globals    = resultData.GlobalData;

            // Generic loop over catchments/nodes/reaches (just replace catchments with nodes)
            foreach (IRes1DDataSet dataSet in catchments)
            {
                // Each dataset has a number of data items
                IDataItems dataItems = dataSet.DataItems;

                // Loop over all data items
                foreach (IDataItem dataItem in dataItems)
                {
                    // A dataitem contains data for one quantity
                    IQuantity quantity = dataItem.Quantity;

                    // You can check the type of quantity in the data item
                    if (quantity.Equals(Quantity.Create(PredefinedQuantity.WaterLevel)))
                    {
                    }
                }
            }

            // The example will now show how to extract data from a reach.

            // Get the first reach in the list of reaches
            IRes1DReach reach = reaches[0];

            // Extract first data item for reach (there will be more than one)
            // For a HD result file, this will be a water level.
            IDataItem wlDataItem = reach.DataItems[0];

            // Take data for all elements (subset of grid points) for the initial time step
            // For water level quantity: One value for each H-grid point
            float[] wlValues = wlDataItem.TimeData.GetValues(0);

            // For a reach, if the IndexList is defined (not null), this
            // gives the relation to the grid point where the values in
            // a data item belongs to.
            // For each value in the data item, it indicates the index of the grid point
            // it belongs to, i.e. the size matches the number of elements in the data item.
            // i.g. for water level: 0, 2, 4, 6, 8,...
            // and  for discharge  : 1, 3, 5, 7,...
            // The IndexList can be null, in which case information on the geometry of the
            // data in the data item exist in the element set
            int[] indexList = wlDataItem.IndexList;

            // Loop over all elements (subset of grid points) in the data item
            for (int i = 0; i < wlDataItem.NumberOfElements; i++)
            {
                // Time series values for this element (grid point)
                float[] wlDataForElement = wlDataItem.CreateTimeSeriesData(i);

                // Check if there is a grid-point relation
                if (indexList != null)
                {
                    // Index of grid point in list of grid opints
                    int gridPointIndex = wlDataItem.IndexList[i];

                    // Grid point where values belong to.
                    IRes1DGridPoint gridPoint = reach.GridPoints[gridPointIndex];

                    // More detailed information exist in the derived grid point classes
                    if (gridPoint is IRes1DHGridPoint)
                    {
                        IRes1DHGridPoint hGridPoint = gridPoint as IRes1DHGridPoint;

                        // An H-grid point also has a cross section.
                        IRes1DCrossSection crossSection = hGridPoint.CrossSection;

                        // More detailed information on the cross section exist in the derived types
                        if (crossSection is IRes1DOpenCrossSection)
                        {
                            // The open cross section has all the raw points and cross section markers
                            IRes1DOpenCrossSection  openXs        = crossSection as IRes1DOpenCrossSection;
                            IRes1DCrossSectionPoint lowestXsPoint = openXs.Points[openXs.LowestPoint];
                        }
                    }
                }
            }
        }
示例#7
0
        protected void ExtendModel(JObject model, bool onlyData, bool onlyMainData, string id = null)
        {
            if (_module.CanvasUnavailable)
            {
                onlyData = true;
            }

            if (_templateFiles != null)
            {
                // include additional data in the Model
                if (_templateFiles.AdditionalDataInTemplate && _manifest.AdditionalDataDefined())
                {
                    model["AdditionalData"] = GetAdditionalData(onlyData);
                }
                // include collections
                if (_templateFiles.Model != null)
                {
                    var additionalCollections = _templateFiles.Model.Where(c => c.Key != _collection);
                    if (additionalCollections.Any())
                    {
                        var collections  = model["Collections"] = new JObject();
                        var dsColContext = OpenContentUtils.CreateDataContext(_module);
                        foreach (var item in additionalCollections)
                        {
                            var colManifest = item.Value;
                            dsColContext.Collection = item.Key;
                            Select select = null;
                            if (item.Value.Query != null)
                            {
                                var                 indexConfig  = OpenContentUtils.GetIndexConfig(_module.Settings.TemplateDir, item.Key);
                                QueryBuilder        queryBuilder = new QueryBuilder(indexConfig);
                                var                 u            = PortalSettings.Current.UserInfo;
                                NameValueCollection queryString  = null;
                                if (item.Value.Query["RelatedField"] != null)
                                {
                                    queryString = new NameValueCollection();
                                    queryString.Add(item.Value.Query["RelatedField"].ToString(), id);
                                }
                                queryBuilder.Build(item.Value.Query, true, u.UserID, DnnLanguageUtils.GetCurrentCultureCode(), u.Social.Roles.FromDnnRoles(), queryString);
                                select = queryBuilder.Select;
                            }
                            IDataItems dataItems   = _ds.GetAll(dsColContext, select);
                            var        colDataJson = new JArray();
                            foreach (var dataItem in dataItems.Items)
                            {
                                var json = dataItem.Data;
                                if (json != null)
                                {
                                    JsonUtils.SimplifyJson(json, GetCurrentCultureCode());
                                }
                                if (json is JObject)
                                {
                                    JObject context = new JObject();
                                    json["Context"] = context;
                                    context["Id"]   = dataItem.Id;
                                    EnhanceSelect2(json as JObject, onlyData);
                                    JsonUtils.SimplifyJson(json, GetCurrentCultureCode());
                                }
                                colDataJson.Add(json);
                            }
                            collections[item.Key]          = new JObject();
                            collections[item.Key]["Items"] = colDataJson;
                        }
                    }
                }
            }
            // include settings in the Model
            if (!onlyMainData && _templateManifest != null && _templateManifest.SettingsNeeded() && !string.IsNullOrEmpty(_settingsJson))
            {
                try
                {
                    var jsonSettings = JToken.Parse(_settingsJson);
                    //if (DnnLanguageUtils.GetPortalLocales(_portalId).Count > 1)
                    //{
                    //    JsonUtils.SimplifyJson(jsonSettings, GetCurrentCultureCode());
                    //}
                    JsonUtils.SimplifyJson(jsonSettings, GetCurrentCultureCode());
                    model["Settings"] = jsonSettings;
                }
                catch (Exception ex)
                {
                    throw new Exception("Error parsing Json of Settings", ex);
                }
            }

            // include static localization in the Model
            if (!onlyMainData)
            {
                var localizationJson = LocalizationUtils.LoadLocalizationJson(_module.Settings.TemplateDir, GetCurrentCultureCode());
                if (localizationJson != null)
                {
                    model["Localization"] = localizationJson;
                }
            }
            if (!onlyData)
            {
                // include CONTEXT in the Model
                JObject context = new JObject();
                model["Context"]        = context;
                context["TabId"]        = _module.ViewModule.TabId;
                context["ModuleId"]     = _module.ViewModule.ModuleId;
                context["GoogleApiKey"] = App.Services.CreateGlobalSettingsRepository(_portalId).GetGoogleApiKey();
                context["ModuleTitle"]  = _module.ViewModule.ModuleTitle;
                var editIsAllowed = !_manifest.DisableEdit && !_templateManifest.DisableEdit && IsEditAllowed(-1);
                context["IsEditable"]    = editIsAllowed; //allowed to edit the item or list (meaning allow Add)
                context["IsEditMode"]    = IsEditMode;
                context["PortalId"]      = _portalId;
                context["MainUrl"]       = _module.GetUrl(_detailTabId, GetCurrentCultureCode());
                context["HomeDirectory"] = _module.HomeDirectory;
                context["HTTPAlias"]     = _module.HostName;
                context["PortalName"]    = _module.PortalName;
                context["TemplatePath"]  = _module.Settings.TemplateDir.UrlFolder;
                context["TemplateName"]  = (String.IsNullOrEmpty(_manifest.Title) ? Path.GetFileName(_templateManifest.MainTemplateUri().FolderPath) : _manifest.Title) + " - " + (string.IsNullOrEmpty(_templateManifest.Title) ? _templateManifest.Key.ShortKey : _templateManifest.Title);
                //context["TemplateName"] = _templateManifest.MainTemplateUri().UrlFilePath ;
            }
        }
示例#8
0
        public override IList <SearchDocument> GetModifiedSearchDocuments(ModuleInfo modInfo, DateTime beginDateUtc)
        {
            Log.Logger.TraceFormat("Indexing content Module {0} - Tab {1} - indexing from {3}", modInfo.ModuleID, modInfo.TabID, modInfo.CultureCode, beginDateUtc);
            var searchDocuments = new List <SearchDocument>();

            //If module is marked as "don't index" then return no results
            if (modInfo.ModuleSettings.GetValue("AllowIndex", "True") == "False")
            {
                Log.Logger.TraceFormat("Indexing content {0}|{1} - NOT - MODULE Indexing disabled", modInfo.ModuleID, modInfo.CultureCode);
                return(searchDocuments);
            }

            //If tab of the module is marked as "don't index" then return no results
            if (modInfo.ParentTab.TabSettings.GetValue("AllowIndex", "True") == "False")
            {
                Log.Logger.TraceFormat("Indexing content {0}|{1} - NOT - TAB Indexing disabled", modInfo.ModuleID, modInfo.CultureCode);
                return(searchDocuments);
            }

            //If tab is marked as "inactive" then return no results
            if (modInfo.ParentTab.DisableLink)
            {
                Log.Logger.TraceFormat("Indexing content {0}|{1} - NOT - TAB is inactive", modInfo.ModuleID, modInfo.CultureCode);
                return(searchDocuments);
            }

            var module = new OpenContentModuleInfo(modInfo);
            OpenContentSettings settings = modInfo.OpenContentSettings();

            //if (settings.Template?.Main == null || !settings.Template.Main.DnnSearch)
            //{
            //    Log.Logger.TraceFormat("Indexing content Module {0} - Tab {1} - settings.Template?.Main == null || !settings.Template.Main.DnnSearch", modInfo.ModuleID, modInfo.TabID, modInfo.CultureCode);
            //    return searchDocuments;
            //}
            if (settings.IsOtherModule)
            {
                return(searchDocuments);
            }

            IDataSource ds        = DataSourceManager.GetDataSource(module.Settings.Manifest.DataSource);
            var         dsContext = OpenContentUtils.CreateDataContext(module);

            IDataItems contentList = ds.GetAll(dsContext, null);

            if (!contentList.Items.Any())
            {
                Log.Logger.TraceFormat("Indexing content {0}|{1} - NOT - No content found", modInfo.ModuleID, modInfo.CultureCode);
            }
            foreach (IDataItem content in contentList.Items)
            {
                if (content == null)
                {
                    Log.Logger.TraceFormat("Indexing content {0}|{1} - NOT - Content is Null", modInfo.ModuleID, modInfo.CultureCode);
                }
                else if (content.LastModifiedOnDate.ToUniversalTime() > beginDateUtc &&
                         content.LastModifiedOnDate.ToUniversalTime() < DateTime.UtcNow)
                {
                    SearchDocument searchDoc;
                    if (DnnLanguageUtils.IsMultiLingualPortal(modInfo.PortalID))
                    {
                        searchDoc = GetLocalizedItem(modInfo, settings, content);
                        searchDocuments.Add(searchDoc);
                        if (modInfo.LocalizedModules != null)
                        {
                            foreach (var localizedModule in modInfo.LocalizedModules)
                            {
                                SearchDocument localizedSearchDoc = GetLocalizedItem(localizedModule.Value, settings, content);
                                searchDocuments.Add(localizedSearchDoc);
                            }
                        }
                    }
                    else
                    {
                        searchDoc = CreateSearchDocument(modInfo, settings, content.Data, content.Id, "", content.Title, JsonToSearchableString(content.Data), content.LastModifiedOnDate.ToUniversalTime());
                        searchDocuments.Add(searchDoc);
                        Log.Logger.TraceFormat("Indexing content {0}|{5} -  OK!  {1} ({2}) of {3}", modInfo.ModuleID, searchDoc.Title, modInfo.TabID, content.LastModifiedOnDate.ToUniversalTime(), modInfo.CultureCode);
                    }
                }
                else
                {
                    Log.Logger.TraceFormat("Indexing content {0}|{1} - NOT - No need to index: lastmod {2} ", modInfo.ModuleID, modInfo.CultureCode, content.LastModifiedOnDate.ToUniversalTime());
                }
            }
            return(searchDocuments);
        }