/// <summary>
        /// Handles Load event for a control
        /// </summary>
        /// <param name="e">Event args.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                var shouldBind = true;
                var now        = HttpContext.Current.Timestamp;

                var viewModel = GetViewModel();
                if (viewModel.IsEmpty())
                {
                    if (IsEditable)
                    {
                        this.Message("NothingToDisplay.Text", MessageType.Info, true);
                    }
                    shouldBind = false;
                }
                else if (!viewModel.EduProgram.IsPublished(now))
                {
                    if (IsEditable)
                    {
                        this.Message("NotPublished.Text", MessageType.Warning, true);
                    }
                    else
                    {
                        shouldBind = false;
                    }
                }

                if (shouldBind)
                {
                    // update module title
                    if (Settings.AutoTitle)
                    {
                        UniversityModuleHelper.UpdateModuleTitle(TabModuleId,
                                                                 UniversityFormatHelper.FormatEduProgramTitle(viewModel.EduProgram.Code, viewModel.EduProgram.Title)
                                                                 );
                    }

                    // bind the data
                    formEduProgram.DataSource = new List <EduProgramViewModel> {
                        viewModel.EduProgram
                    };
                    formEduProgram.DataBind();
                }
                else
                {
                    ContainerControl.Visible = IsEditable;
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
        void BindEduPrograms(int eduLevelId)
        {
            comboEduProgram.DataSource = new EduProgramCommonQuery(ModelContext).ListByEduLevel(eduLevelId)
                                         .Select(ep => new { Value = ep.EduProgramID, Text = UniversityFormatHelper.FormatEduProgramTitle(ep.Code, ep.Title) });

            comboEduProgram.DataBind();

            comboEduLevel.DataSource = ModelContext.Query <EduLevelInfo> ()
                                       .Where(el => el.ParentEduLevelId == eduLevelId || el.EduLevelID == eduLevelId)
                                       .OrderBy(el => el.ParentEduLevelId != null)
                                       .ToList();

            comboEduLevel.DataBind();
        }
Ejemplo n.º 3
0
        public override string Eval(string objectName, string collectionName, int index)
        {
            if (collectionName == nameof(Positions))
            {
                var position = Positions [index];
                if (objectName == "PositionTitle")
                {
                    return(position.FormatTitle());
                }
                if (objectName == "DivisionTitle")
                {
                    return(position.Division.Title);
                }
                if (objectName == NameOf(() => position.IsPrime))
                {
                    return(Positions [index].IsPrime ? GetString("Yes") : string.Empty);
                }
            }

            if (collectionName == nameof(Disciplines))
            {
                var discipline = Disciplines [index];
                var profile    = discipline.EduProgramProfile;
                if (objectName == NameOf(() => profile.EduProgram))
                {
                    return(UniversityFormatHelper.FormatEduProgramTitle(profile.EduProgram.Code, profile.EduProgram.Title));
                }
                if (objectName == NameOf(() => Disciplines [index].EduProgramProfile))
                {
                    return(UniversityFormatHelper.FormatEduProgramProfilePartialTitle(profile.ProfileCode, profile.ProfileTitle));
                }
                if (objectName == NameOf(() => profile.EduLevel))
                {
                    return(profile.EduLevel.Title);
                }
                if (objectName == NameOf(() => discipline.Disciplines))
                {
                    return(discipline.Disciplines);
                }
            }

            if (collectionName == nameof(Education))
            {
                var education = Education [index];
                return(EvalAchievement(education, objectName));
            }

            if (collectionName == nameof(Training))
            {
                var training = Training [index];
                return(EvalAchievement(training, objectName));
            }

            if (collectionName == nameof(Achievements))
            {
                var achievement = Achievements [index];
                return(EvalAchievement(achievement, objectName));
            }

            return(null);
        }
Ejemplo n.º 4
0
 public static string FormatTitle(this IEduProgram ep)
 {
     return(UniversityFormatHelper.FormatEduProgramTitle(ep.Code, ep.Title));
 }
        protected void BindEduPrograms(int eduLevelId)
        {
            comboEduProgram.DataSource = new EduProgramQuery(ModelContext).ListByEduLevel(eduLevelId)
                                         .Select(ep => new { Value = ep.EduProgramID, Text = UniversityFormatHelper.FormatEduProgramTitle(ep.Code, ep.Title) });

            comboEduProgram.DataBind();
            comboEduProgram.InsertDefaultItem(LocalizeString("NotSelected.Text"));
        }