private static List<Technology> SelectedTechnologies(FormCollection form, string prefix)
        {
            var technologies = new List<Technology>();
            foreach (var key in form.Keys)
            {
                if (key.ToString().StartsWith(prefix))
                {
                    var value = form[key.ToString()];
                    bool selected = false;

                    if (value.ToLowerInvariant() == "true")
                        selected = true;
                    if (HasChanged(value) && GetNewBooleanValue(value))
                        selected = true;

                    if (selected)
                    {
                        var id = ExtractId(key.ToString());
                        var repo = new LookupRepository();
                        technologies.Add(repo.GetTechnology(id));
                    }
                }
            }
            return technologies;
        }
Пример #2
0
        private void Construct(Volunteer volunteer)
        {
            if (volunteer == null)
                Volunteer = new Volunteer();
            else
                Volunteer = volunteer;

            var lookupRepository = new LookupRepository();

            IQueryable<JobRole> roles = lookupRepository.GetAllJobRoles();
            JobRoles = new SelectList(roles, "JobRoleID", "Description");

            var levels = lookupRepository.GetAllExperienceLevels();
            Experience = new SelectList(levels, "ExperienceLevelID", "Description");

            var technologies = lookupRepository.GetAllTechnologies();
            Technologies = new SelectList(technologies, "TechnologyID", "Description");
        }
Пример #3
0
        private static List<JobRole> SelectedJobRoles(FormCollection form)
        {
            var jobRoles = new List<JobRole>();
            foreach (var key in form.Keys)
            {
                if (key.ToString().StartsWith("JobType."))
                {
                    var value = form[key.ToString()];
                    bool selected = false;
                    if (value.ToLowerInvariant() == "true")
                        selected = true;
                    if (HasChanged(value) && GetNewBooleanValue(value))
                        selected = true;

                    if (selected)
                    {
                        var id = ExtractId(key.ToString());
                        var repo = new LookupRepository();
                        jobRoles.Add(repo.GetJobRole(id));
                    }
                }
            }
            return jobRoles;
        }