示例#1
0
        private void LoadSavedSearches()
        {
            this.SavedSearchesRepeater.Controls.Clear();
            if (Null.IsNull(this.UserId) || Utility.GetSearchResultsTabId(this.JobGroupId, this.PortalSettings) == null)
            {
                return;
            }

            var queries = JobSearchQuery.LoadSearches(this.UserId, this.JobGroupId);

            if (!queries.Any())
            {
                return;
            }

            this.SavedSearchesRepeater.DataSource = queries;
            this.SavedSearchesRepeater.DataBind();
        }
        private JobSearchQuery GetQueryObject()
        {
            var query = new JobSearchQuery {
                Description = this.txtSearchName.Text, JobGroupId = this.JobGroupId
            };

            int result;

            if (int.TryParse(this.JobTitleDropDownList.SelectedValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out result))
            {
                query.JobPositionId = result;
            }

            if (int.TryParse(this.CategoryDropDownList.SelectedValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out result))
            {
                query.CategoryId = result;
            }

            if (string.Equals(this.LocationRadioButtonList.SelectedValue, LocationType.City.ToString(), StringComparison.OrdinalIgnoreCase))
            {
                if (int.TryParse(this.LocationDropDownList.SelectedValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out result))
                {
                    query.LocationId = result;
                }
            }
            else
            {
                if (int.TryParse(this.LocationDropDownList.SelectedValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out result))
                {
                    query.StateId = result;
                }
            }

            if (Engage.Utility.HasValue(this.txtKeywords.Text))
            {
                query.Keywords = this.txtKeywords.Text;
            }

            return(query);
        }
        private JobSearchQuery GetQueryObject()
        {
            var query = new JobSearchQuery { Description = this.txtSearchName.Text, JobGroupId = this.JobGroupId };

            int result;
            if (int.TryParse(this.JobTitleDropDownList.SelectedValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out result))
            {
                query.JobPositionId = result;
            }

            if (int.TryParse(this.CategoryDropDownList.SelectedValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out result))
            {
                query.CategoryId = result;
            }

            if (string.Equals(this.LocationRadioButtonList.SelectedValue, LocationType.City.ToString(), StringComparison.OrdinalIgnoreCase))
            {
                if (int.TryParse(this.LocationDropDownList.SelectedValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out result))
                {
                    query.LocationId = result;
                }
            }
            else
            {
                if (int.TryParse(this.LocationDropDownList.SelectedValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out result))
                {
                    query.StateId = result;
                }
            }

            if (Engage.Utility.HasValue(this.txtKeywords.Text))
            {
                query.Keywords = this.txtKeywords.Text;
            }

            return query;
        }
        private void UpdateSearchFields(JobSearchQuery q)
        {
            this.txtKeywords.Text = q.Keywords;
            if (q.JobPositionId.HasValue)
            {
                this.JobTitleDropDownList.SelectedValue = q.JobPositionId.Value.ToString(CultureInfo.InvariantCulture);
            }

            if (q.CategoryId.HasValue)
            {
                this.CategoryDropDownList.SelectedValue = q.CategoryId.Value.ToString(CultureInfo.InvariantCulture);
            }

            string value = string.Empty;
            if (!q.LocationId.HasValue)
            {
                this.LocationRadioButtonList.SelectedValue = LocationType.State.ToString();
                this.LoadLocations();
                if (q.StateId.HasValue)
                {
                    value = q.StateId.Value.ToString(CultureInfo.InvariantCulture);
                }
            }
            else
            {
                this.LocationRadioButtonList.SelectedValue = LocationType.City.ToString();
                this.LoadLocations();
                value = q.LocationId.Value.ToString(CultureInfo.InvariantCulture);
            }

            this.LocationDropDownList.SelectedValue = value;
        }