public override IList <SearchDocument> GetModifiedSearchDocuments(ModuleInfo moduleInfo, DateTime beginDateUtc)
        {
            var searchDocs     = new List <SearchDocument> ();
            var settings       = new EmployeeListSettingsRepository().GetSettings(moduleInfo);
            var portalSettings = HttpOffContextHelper.GetPortalSettings(moduleInfo.PortalID, moduleInfo.TabID, moduleInfo.CultureCode);

            IEnumerable <EmployeeInfo> employees = null;

            using (var modelContext = new UniversityModelContext()) {
                employees = new EmployeeQuery(modelContext).ListByDivisionId(
                    settings.DivisionID, settings.IncludeSubdivisions, (EmployeeListSortType)settings.SortType);
            }

            var now = DateTime.Now;

            foreach (var employee in employees)
            {
                if (employee.LastModifiedOnDate.ToUniversalTime() > beginDateUtc.ToUniversalTime())
                {
                    var sd = new SearchDocument {
                        PortalId        = moduleInfo.PortalID,
                        AuthorUserId    = employee.LastModifiedByUserId,
                        Title           = employee.FullName(),
                        Body            = employee.SearchText(),
                        ModifiedTimeUtc = employee.LastModifiedOnDate.ToUniversalTime(),
                        UniqueKey       = string.Format("University_Employee_{0}", employee.EmployeeID),
                        Url             = employee.GetSearchUrl(moduleInfo, portalSettings),
                        IsActive        = employee.IsPublished(now)
                    };

                    searchDocs.Add(sd);
                }
            }
            return(searchDocs);
        }
        public override IList<SearchDocument> GetModifiedSearchDocuments (ModuleInfo modInfo, DateTime beginDate)
        {
            var searchDocs = new List<SearchDocument> ();
            var settings = new EmployeeListSettingsRepository ().GetSettings (modInfo);

            IEnumerable<EmployeeInfo> employees = null;

            using (var modelContext = new UniversityModelContext ()) {
                employees = new EmployeeQuery (modelContext).ListByDivisionId (
                    settings.DivisionID, settings.IncludeSubdivisions, settings.SortType);
            }

            var now = DateTime.Now;
            foreach (var employee in employees) {
                if (employee.LastModifiedOnDate.ToUniversalTime () > beginDate.ToUniversalTime ()) {
                    var aboutEmployee = employee.SearchDocumentText;
                    var sd = new SearchDocument ()
                    {
                        PortalId = modInfo.PortalID,
                        AuthorUserId = employee.LastModifiedByUserID,
                        Title = employee.FullName,
                        // Description = HtmlUtils.Shorten (aboutEmployee, 255, "..."),
                        Body = aboutEmployee,
                        ModifiedTimeUtc = employee.LastModifiedOnDate.ToUniversalTime (),
                        UniqueKey = string.Format ("University_Employee_{0}", employee.EmployeeID),
                        Url = string.Format ("/Default.aspx?tabid={0}#{1}", modInfo.TabID, modInfo.ModuleID),
                        IsActive = employee.IsPublished (now)
                    };

                    searchDocs.Add (sd);
                }
            }
            return searchDocs;
        }
예제 #3
0
        public override IList <SearchDocument> GetModifiedSearchDocuments(ModuleInfo modInfo, DateTime beginDate)
        {
            var searchDocs = new List <SearchDocument> ();
            var settings   = new EmployeeListSettingsRepository().GetSettings(modInfo);

            IEnumerable <EmployeeInfo> employees = null;

            using (var modelContext = new UniversityModelContext()) {
                employees = new EmployeeQuery(modelContext).ListByDivisionId(
                    settings.DivisionID, settings.IncludeSubdivisions, settings.SortType);
            }

            var now = DateTime.Now;

            foreach (var employee in employees)
            {
                if (employee.LastModifiedOnDate.ToUniversalTime() > beginDate.ToUniversalTime())
                {
                    var aboutEmployee = employee.SearchDocumentText;
                    var sd            = new SearchDocument()
                    {
                        PortalId        = modInfo.PortalID,
                        AuthorUserId    = employee.LastModifiedByUserID,
                        Title           = employee.FullName,
                        Body            = aboutEmployee,
                        ModifiedTimeUtc = employee.LastModifiedOnDate.ToUniversalTime(),
                        UniqueKey       = string.Format("University_Employee_{0}", employee.EmployeeID),
                        Url             = string.Format("/Default.aspx?tabid={0}#{1}", modInfo.TabID, modInfo.ModuleID),
                        IsActive        = employee.IsPublished(now)
                    };

                    searchDocs.Add(sd);
                }
            }
            return(searchDocs);
        }