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

            var employee = default(EmployeeInfo);

            using (var modelContext = new UniversityModelContext()) {
                employee = modelContext.Get <EmployeeInfo, int> (settings.EmployeeID);
            }

            if (employee != null && 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(DateTime.Now)
                };

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

            var eduProgram = default(EduProgramInfo);

            if (settings.EduProgramId != null)
            {
                using (var modelContext = new UniversityModelContext()) {
                    eduProgram = new EduProgramQuery(modelContext).SingleOrDefault(settings.EduProgramId.Value);
                }
            }

            if (eduProgram != null && eduProgram.LastModifiedOnDate.ToUniversalTime() > beginDateUtc.ToUniversalTime())
            {
                var sd = new SearchDocument {
                    PortalId        = moduleInfo.PortalID,
                    AuthorUserId    = eduProgram.LastModifiedByUserId,
                    Title           = eduProgram.FormatTitle(),
                    Body            = eduProgram.SearchText(),
                    ModifiedTimeUtc = eduProgram.LastModifiedOnDate.ToUniversalTime(),
                    UniqueKey       = string.Format("University_EduProgram_{0}", eduProgram.EduProgramID),
                    Url             = eduProgram.GetSearchUrl(moduleInfo, portalSettings),
                    IsActive        = eduProgram.IsPublished(DateTime.Now)
                };

                searchDocs.Add(sd);
            }

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

            using (var modelContext = new UniversityModelContext()) {
                var division = modelContext.Get <DivisionInfo, int> (settings.DivisionID);
                if (division != null && division.LastModifiedOnDate.ToUniversalTime() > beginDateUtc.ToUniversalTime())
                {
                    var sd = new SearchDocument {
                        PortalId        = moduleInfo.PortalID,
                        AuthorUserId    = division.LastModifiedByUserId,
                        Title           = division.Title,
                        Body            = division.SearchText(),
                        ModifiedTimeUtc = division.LastModifiedOnDate.ToUniversalTime(),
                        UniqueKey       = string.Format("University_Division_{0}", division.DivisionID),
                        Url             = division.GetSearchUrl(moduleInfo, portalSettings),
                        IsActive        = division.IsPublished(DateTime.Now)
                    };

                    searchDocs.Add(sd);
                }

                return(searchDocs);
            }
        }
        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);
        }