Пример #1
0
        public override DataTable GetDataTable(PortalModuleBase module, UniversityModelContext modelContext, string search)
        {
            var eduProgramProfiles = new FindEduProgramProfileQuery(modelContext).List(search)
                                     .Select(epp => new EduProgramProfileViewModel(epp));

            return(DataTableConstructor.FromIEnumerable(eduProgramProfiles));
        }
Пример #2
0
        public override IList <SearchDocument> GetModifiedSearchDocuments(ModuleInfo modInfo, DateTime beginDate)
        {
            var searchDocs = new List <SearchDocument> ();
            var settings   = new DivisionSettingsRepository().GetSettings(modInfo);

            using (var modelContext = new UniversityModelContext()) {
                var division = modelContext.Get <DivisionInfo> (settings.DivisionID);
                if (division != null && division.LastModifiedOnDate.ToUniversalTime() > beginDate.ToUniversalTime())
                {
                    var aboutDivision = division.SearchDocumentText;
                    var sd            = new SearchDocument()
                    {
                        PortalId        = modInfo.PortalID,
                        AuthorUserId    = division.LastModifiedByUserId,
                        Title           = division.Title,
                        Body            = aboutDivision,
                        ModifiedTimeUtc = division.LastModifiedOnDate.ToUniversalTime(),
                        UniqueKey       = string.Format("University_Division_{0}", division.DivisionID),
                        Url             = string.Format("/Default.aspx?tabid={0}#{1}", modInfo.TabID, modInfo.ModuleID),
                        IsActive        = division.IsPublished(DateTime.Now)
                    };

                    searchDocs.Add(sd);
                }

                return(searchDocs);
            }
        }
Пример #3
0
 IEnumerable <EduProgramProfileFormYearInfo> GetEduVolumesForEduVolumeDirectory(int?divisionId, IEnumerable <int> eduLevelIds, DivisionLevel divisionLevel)
 {
     using (var modelContext = new UniversityModelContext()) {
         var eduVolumes = new EduVolumeQuery(modelContext).ListByDivisionAndEduLevels(eduLevelIds, divisionId, divisionLevel);
         return(eduVolumes ?? Enumerable.Empty <EduProgramProfileFormYearInfo> ());
     }
 }
        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);
            }
        }
        internal EduProgramModuleViewModel GetViewModel_Internal()
        {
            // TODO: Restore sorting of edu. program profiles
            if (Settings.EduProgramId != null)
            {
                EduProgramInfo eduProgram;
                using (var modelContext = new UniversityModelContext()) {
                    eduProgram = new EduProgramQuery(modelContext).SingleOrDefault(Settings.EduProgramId.Value);
                }

                if (eduProgram == null)
                {
                    // edu. program not found - return empty view model
                    return(new EduProgramModuleViewModel());
                }

                var viewModel = new EduProgramModuleViewModel();
                viewModel.EduProgram = new EduProgramViewModel(eduProgram, viewModel);

                return(viewModel);
            }

            // edu. program not set - return empty view model
            return(new EduProgramModuleViewModel());
        }
Пример #6
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 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);
        }
Пример #8
0
        public override IList <SearchDocument> GetModifiedSearchDocuments(ModuleInfo modInfo, DateTime beginDate)
        {
            var searchDocs = new List <SearchDocument> ();
            var settings   = new EmployeeSettingsRepository().GetSettings(modInfo);

            var employee = default(EmployeeInfo);

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

            if (employee != null && 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(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);
        }
Пример #10
0
 IEnumerable <EduProgramInfo> GetEduProgramsForScienceDirectory(int?divisionId, IEnumerable <int> eduLevelIds)
 {
     using (var modelContext = new UniversityModelContext()) {
         var eduPrograms = new ScienceDirectoryQuery(modelContext).ListByDivisionAndEduLevels(divisionId, eduLevelIds);
         return(eduPrograms ?? Enumerable.Empty <EduProgramInfo> ());
     }
 }
Пример #11
0
 protected void ddlEduProgram_SelectedIndexChanged(object sender, EventArgs e)
 {
     using (var modelContext = new UniversityModelContext()) {
         var eduProgramId = int.Parse(ddlEduProgram.SelectedValue);
         BindEduProfiles(eduProgramId, modelContext);
     }
 }
Пример #12
0
 IEnumerable <EduProgramViewModel> GetEduPrograms(UniversityModelContext modelContext)
 {
     return(new EduProgramQuery(modelContext).ListWithEduLevels()
            .Select(ep => new EduProgramViewModel(ep))
            .OrderBy(ep => ep.EduLevel.SortIndex)
            .ThenBy(ep => ep.Code)
            .ThenBy(ep => ep.Title));
 }
Пример #13
0
        public override DataTable GetDataTable(PortalModuleBase module, UniversityModelContext modelContext, string search)
        {
            // FIXME: Cannot set comparison options
            var scienceRecordTypes = (search == null)
                ? new FlatQuery <ScienceRecordTypeInfo> (modelContext).List()
                : new FlatQuery <ScienceRecordTypeInfo> (modelContext)
                                     .ListWhere(srt => srt.Type.Contains(search));

            return(DataTableConstructor.FromIEnumerable(scienceRecordTypes));
        }
Пример #14
0
        public override DataTable GetDataTable(PortalModuleBase module, UniversityModelContext modelContext, string search)
        {
            // FIXME: Cannot set comparison options
            var years = (search == null)
                ? new FlatQuery <YearInfo> (modelContext).List()
                : new FlatQuery <YearInfo> (modelContext)
                        .ListWhere(y => y.Year.ToString() == search);

            return(DataTableConstructor.FromIEnumerable(years));
        }
Пример #15
0
        public override DataTable GetDataTable(PortalModuleBase module, UniversityModelContext modelContext, string search)
        {
            // FIXME: Cannot set comparison options
            var achievements = (search == null)
                ? new FlatQuery <AchievementInfo> (modelContext).List()
                : new FlatQuery <AchievementInfo> (modelContext)
                               .ListWhere(a => a.Title.Contains(search) || a.ShortTitle.Contains(search));

            return(DataTableConstructor.FromIEnumerable(achievements));
        }
Пример #16
0
        public override DataTable GetDataTable(PortalModuleBase module, UniversityModelContext modelContext, string search)
        {
            // FIXME: Cannot set comparison options
            var documentTypes = (search == null)
                ? new FlatQuery <DocumentTypeInfo> (modelContext).List()
                : new FlatQuery <DocumentTypeInfo> (modelContext)
                                .ListWhere(dt => dt.Type.Contains(search) || dt.Description.Contains(search));

            return(DataTableConstructor.FromIEnumerable(documentTypes));
        }
Пример #17
0
        public override DataTable GetDataTable(PortalModuleBase module, UniversityModelContext modelContext, string search)
        {
            // FIXME: Cannot set comparison options
            var eduForms = (search == null)
                ? new FlatQuery <EduFormInfo> (modelContext).List()
                : new FlatQuery <EduFormInfo> (modelContext)
                           .ListWhere(ef => ef.Title.Contains(search) || ef.ShortTitle.Contains(search));

            return(DataTableConstructor.FromIEnumerable(eduForms));
        }
Пример #18
0
        public override DataTable GetDataTable(PortalModuleBase module, UniversityModelContext modelContext, string search)
        {
            // FIXME: Cannot set comparison options
            var divisions = (search == null)
                ? new FlatQuery <EduProgramDivisionInfo> (modelContext).List()
                : new FlatQuery <EduProgramDivisionInfo> (modelContext)
                            .ListWhere(d => d.DivisionRole.Contains(search));

            return(DataTableConstructor.FromIEnumerable(divisions));
        }
Пример #19
0
 IEnumerable <EduProgramProfileViewModel> GetEduProfiles(int eduProgramId, UniversityModelContext modelContext)
 {
     return(new EduProgramProfileQuery(modelContext).ListByEduProgram(eduProgramId)
            .Select(epp => new EduProgramProfileViewModel(epp, ViewModelContext))
            .OrderBy(epp => epp.EduProgram.Code)
            .ThenBy(epp => epp.EduProgram.Title)
            .ThenBy(epp => epp.ProfileCode)
            .ThenBy(epp => epp.ProfileTitle)
            .ThenBy(epp => epp.EduLevel.SortIndex));
 }
Пример #20
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            // bind employees to the combobox
            using (var modelContext = new UniversityModelContext()) {
                comboEmployees.DataSource = new FlatQuery <EmployeeInfo> (modelContext).ListOrderBy(empl => empl.LastName);
                comboEmployees.DataBind();
            }

            comboEmployees.InsertDefaultItem(LocalizeString("NotSelected.Text"));
        }
Пример #21
0
        protected override void OnUpdateItem(EduProgramDivisionEditModel item)
        {
            item.DivisionId   = (int)divisionSelector.DivisionId;
            item.DivisionRole = textDivisionRole.Text.Trim();

            using (var modelContext = new UniversityModelContext()) {
                var division = modelContext.Get <DivisionInfo> (item.DivisionId);
                item.StartDate     = division.StartDate;
                item.EndDate       = division.EndDate;
                item.DivisionTitle = division.Title;
            }
        }
Пример #22
0
        protected override void OnResetForm()
        {
            if (ddlEduProgram.Items.Count > 0)
            {
                ddlEduProgram.SelectedIndex = 0;
                var eduProgramId = int.Parse(ddlEduProgram.SelectedValue);
                using (var modelContext = new UniversityModelContext()) {
                    BindEduProfiles(eduProgramId, modelContext);
                }
            }

            textDisciplines.Text = string.Empty;
        }
Пример #23
0
        void BindEduProgramProfiles(int eduLevelId)
        {
            using (var modelContext = new UniversityModelContext()) {
                var epps = new EduProgramProfileQuery(modelContext).ListByEduLevel(eduLevelId)
                           .Select(epp => new EduProgramProfileViewModel(epp))
                           .OrderBy(epp => epp.EduProgram.Code)
                           .ThenBy(epp => epp.EduProgram.Title)
                           .ThenBy(epp => epp.ProfileCode)
                           .ThenBy(epp => epp.ProfileTitle);

                comboEduProgramProfile.DataSource = epps;
                comboEduProgramProfile.DataBind();
            }
        }
        protected override void OnUpdateItem(OccupiedPositionEditModel item)
        {
            item.PositionID    = int.Parse(comboPositions.SelectedValue);
            item.DivisionID    = (int)divisionSelector.DivisionId;
            item.PositionTitle = comboPositions.SelectedItem.Text;
            item.IsPrime       = checkIsPrime.Checked;
            item.TitleSuffix   = textPositionTitleSuffix.Text.Trim();

            using (var modelContext = new UniversityModelContext()) {
                var division = modelContext.Get <DivisionInfo> (item.DivisionID);
                item.DivisionTitle     = division.Title;
                item.DivisionStartDate = division.StartDate;
                item.DivisionEndDate   = division.EndDate;
            }
        }
Пример #25
0
        ContingentDirectoryViewModel GetContingentViewModel()
        {
            var settings         = new ContingentDirectorySettingsRepository().GetSettings(ActiveModule);
            var viewModelContext = new ViewModelContext <ContingentDirectorySettings> (ModuleContext, LocalResourceFile, settings);

            using (var modelContext = new UniversityModelContext()) {
                var viewModel = new ContingentDirectoryViewModel();
                viewModel.Settings             = settings;
                viewModel.LastYear             = new FlatQuery <YearInfo> (modelContext).List().LastYear();
                viewModel.ContingentViewModels =
                    GetContingentsForContingentDirectory(modelContext, settings)
                    .Select(ev => new ContingentViewModel(ev, viewModelContext, viewModel));
                return(viewModel);
            }
        }
Пример #26
0
        protected override void OnUpdateItem(EmployeeDisciplineEditModel item)
        {
            item.EduProgramProfileID = int.Parse(comboEduProgramProfile.SelectedValue);
            item.Disciplines         = textDisciplines.Text.Trim();

            using (var modelContext = new UniversityModelContext()) {
                var profile = new EduProgramProfileQuery(modelContext).SingleOrDefault(item.EduProgramProfileID);
                item.Code             = profile.EduProgram.Code;
                item.Title            = profile.EduProgram.Title;
                item.ProfileCode      = profile.ProfileCode;
                item.ProfileTitle     = profile.ProfileTitle;
                item.ProfileStartDate = profile.StartDate;
                item.ProfileEndDate   = profile.EndDate;
                item.EduLevelString   = FormatHelper.FormatShortTitle(profile.EduLevel.ShortTitle, profile.EduLevel.Title);
            }
        }
Пример #27
0
        void BindEduProfiles(int eduProgramId, UniversityModelContext modelContext)
        {
            var eduProfiles = GetEduProfiles(eduProgramId, modelContext);

            if (eduProfiles.IsNullOrEmpty())
            {
                ddlEduProfile.Items.Clear();
                ddlEduProfile.InsertDefaultItem(LocalizeString("NotSelected.Text"));
            }
            else
            {
                ddlEduProfile.DataSource = eduProfiles;
                ddlEduProfile.DataBind();
            }

            ddlEduProfile.SelectedIndex = 0;
        }
        protected override void OnUpdateItem(OccupiedPositionEditModel item)
        {
            item.PositionID  = int.Parse(comboPositions.SelectedValue);
            item.DivisionID  = divisionSelector.DivisionId.Value;
            item.IsPrime     = checkIsPrime.Checked;
            item.TitleSuffix = textPositionTitleSuffix.Text.Trim();

            // TODO: Don't call database here
            using (var modelContext = new UniversityModelContext()) {
                var division = modelContext.Get <DivisionInfo, int> (item.DivisionID);
                item.DivisionTitle     = division.Title;
                item.DivisionStartDate = division.StartDate;
                item.DivisionEndDate   = division.EndDate;

                var position = modelContext.Get <PositionInfo, int> (item.PositionID);
                item.PositionTitle = position.Title;
            }
        }
Пример #29
0
        protected override void OnLoadItem(EmployeeDisciplineEditModel item)
        {
            using (var modelContext = new UniversityModelContext()) {
                var profile = new EduProgramProfileQuery(modelContext).SingleOrDefault(item.EduProgramProfileID);

                var eduLevelId    = int.Parse(comboEduLevel.SelectedValue);
                var newEduLevelId = profile.EduLevelId;
                if (eduLevelId != newEduLevelId)
                {
                    comboEduLevel.SelectByValue(newEduLevelId);
                    BindEduProgramProfiles(newEduLevelId);
                }

                comboEduProgramProfile.SelectByValue(item.EduProgramProfileID);
                textDisciplines.Text = item.Disciplines;

                hiddenEduProgramProfileID.Value = item.EduProgramProfileID.ToString();
            }
        }
Пример #30
0
        public override DataTable GetDataTable(PortalModuleBase module, UniversityModelContext modelContext, string search)
        {
            // FIXME: Cannot set comparison options
            var employees = (search == null)
                ? new FlatQuery <EmployeeInfo> (modelContext).List()
                : new FlatQuery <EmployeeInfo> (modelContext)
                            .ListWhere(e => e.LastName.Contains(search) ||
                                       e.FirstName.Contains(search) ||
                                       e.OtherName.Contains(search) ||
                                       (e.FirstName + " " + e.LastName).Contains(search) ||
                                       (e.FirstName + " " + e.OtherName + " " + e.LastName).Contains(search) ||
                                       (e.LastName + " " + e.FirstName + " " + e.OtherName).Contains(search) ||
                                       e.CellPhone.Contains(search) ||
                                       e.Phone.Contains(search) ||
                                       e.Email.Contains(search) ||
                                       e.SecondaryEmail.Contains(search) ||
                                       e.WorkingPlace.Contains(search)
                                       );

            return(DataTableConstructor.FromIEnumerable(employees.Select(e => new EmployeeViewModel(e))));
        }