/// <summary>
        /// Gets the resume field.
        /// </summary>
        protected List<ResumeField> GetResumeField()
        {
            var result = new List<ResumeField>();
            foreach (RepeaterItem filed in fieldRepeater.Items)
            {
                var lbl = (Label)filed.FindControl("field");
                var listView = (ListView)filed.FindControl("themeListView");
                var item = new ResumeField
                {
                    FieldName = lbl.Text,
                    Theme = new List<ResumeTheme>()
                };

                foreach (var theme in listView.Items)
                {
                    var skill = (DropDownList)theme.FindControl("themeSkils");
                    if (skill.SelectedIndex == 0) continue;

                    var themeId = (Label)theme.FindControl("themeId");
                    var themeName = (Label)theme.FindControl("theme");

                    item.Theme.Add(new ResumeTheme
                                       {
                                           SkillId = Convert.ToInt32(skill.SelectedValue),
                                           SkillName = skill.SelectedItem.Text,
                                           ThemeId = Convert.ToInt32(themeId.Text),
                                           ThemeName = themeName.Text
                                       });
                }
                result.Add(item);
            }
            foreach (var item in result.Where(item => item.Theme.Count == 0))
            {
                result.Remove(item);
            }
            return result;
        }
コード例 #2
0
        /// <summary>
        /// Gets the resume fields.
        /// </summary>
        /// <param name="resumeId">The resume id.</param>
        public static List<ResumeField> GetResumeFields(int resumeId)
        {
            if (resumeId < 1)
                return null;

            var themes = ResumeTheme.GetAll(resumeId).OrderBy(x => x.FieldName);

            var result = new List<ResumeField>();
            ResumeField field = null;

            foreach (var theme in themes)
            {
                if (field == null || field.FieldName != theme.FieldName)
                {
                    field = new ResumeField
                                {
                                    FieldName = theme.FieldName,
                                    Theme = new List<ResumeTheme>()
                                };
                    result.Add(field);
                }
                field.Theme.Add(theme);
            }
            return result;
        }