Exemple #1
0
        public void UpdatePropertiesDic(string name, string value)
        {
            if (name != null)
            {
                if (!PropertiesDic.ContainsKey(name))
                {
                    PropertiesDic.Add(name, "");
                }

                foreach (KeyValuePair <string, string> kvp in PropertiesDic)
                {
                    if (kvp.Key == name)
                    {
                        PropertiesDic.Remove(name);
                        PropertiesDic.Add(name, value);
                        break;
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Remove a property from the Dictionary
        /// </summary>
        /// <example>
        /// grassland: all | yes | no
        /// grassland is name
        /// value is (all | yes | no)
        /// </example>
        /// <param name="name">Name of the property</param>
        /// <param name="value">Value of the property</param>
        public void RemoveFromPropertiesDic(string name, string value, SearchCriteria sc)
        {
            if (name != null)
            {
                if (sc.GetProperty(name) != null)
                {
                    string datasourceKey = sc.GetProperty(name).DataSourceKey;

                    if (PropertiesDic.ContainsKey(datasourceKey))
                    {
                        foreach (KeyValuePair <string, string> kvp in PropertiesDic)
                        {
                            if (kvp.Value == value && kvp.Key == datasourceKey)
                            {
                                PropertiesDic.Remove(datasourceKey);
                                break;
                            }
                        }
                    }
                }
            }
        }
Exemple #3
0
        public ActionResult UpdateProperties()
        {
            ISearchProvider provider   = IoCFactory.Container.ResolveForSession <ISearchProvider>();
            var             properties = provider.UpdateProperties(provider.WorkingSearchModel.CriteriaComponent).SearchComponent.Properties;

            foreach (Property p in properties)
            {
                if (PropertiesDic.ContainsKey(p.DataSourceKey))
                {
                    p.SelectedValue = PropertiesDic[p.DataSourceKey];
                }
                else
                {
                    if (!string.IsNullOrEmpty(p.SelectedValue))
                    {
                        p.SelectedValue = string.Empty;
                    }
                }
            }

            return(PartialView("_searchProperties", properties));
        }
Exemple #4
0
        //+++++++++++++++++++++BreadCrumb Update Data +++++++++++++++++++++++++++

        /// <summary>
        /// Is called when the user click on the labels in the breadcrumb view
        ///
        /// </summary>
        /// <param name="value">selected value</param>
        /// <param name="parent">patrent of selected value</param>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult OnClickBreadCrumbItem(string value, string parent)
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Search", this.Session.GetTenant());

            ISearchProvider provider = IoCFactory.Container.ResolveForSession <ISearchProvider>();

            RemoveFromPropertiesDic(parent, value, provider.WorkingSearchModel.CriteriaComponent);

            // if value exist / user clicked value
            if (value != null && parent != null)
            {
                provider.WorkingSearchModel.CriteriaComponent.RemoveValueOfSearchCriteria(parent, value);
            }

            provider.SearchAndUpdate(provider.WorkingSearchModel.CriteriaComponent);


            //reset properties selected values
            var properties = provider.WorkingSearchModel.SearchComponent.Properties;

            foreach (Property p in properties)
            {
                if (PropertiesDic.ContainsKey(p.DataSourceKey))
                {
                    p.SelectedValue = PropertiesDic[p.DataSourceKey];
                }
                else
                {
                    if (!string.IsNullOrEmpty(p.SelectedValue))
                    {
                        p.SelectedValue = string.Empty;
                    }
                }
            }


            return(View(Session["SubmissionAction"].ToString(), provider)); //View("Index", provider);
        }