Exemplo n.º 1
0
        internal ISearchParameterable AddParameter(String parameterName, Object value)
        {
            LocalSearchParameter parameter = new LocalSearchParameter();

            parameter.Parameter = parameterName;
            parameter.Value     = value;

            this.Parameters.Add(parameter);
            return(this);
        }
        public ISearchesRunnable Deserialize(IDictionary <string, object> dictionary)
        {
            LocalSearchModel result = new LocalSearchModel(this.Provider);

            foreach (string key in dictionary.Keys)
            {
                switch (key)
                {
                case "Type":
                    SearchTypes st;
                    if (Enum.TryParse <SearchTypes>(dictionary[key].ToString(), out st))
                    {
                        result.Type = st;
                    }
                    break;

                case "Parameters":
                    if (dictionary[key] is System.Collections.ArrayList)
                    {
                        foreach (object parameter in dictionary[key] as System.Collections.ArrayList)
                        {
                            if (parameter is IDictionary <string, object> )
                            {
                                IDictionary <string, object> dparam = parameter as IDictionary <string, object>;
                                LocalSearchParameter         iparam = new LocalSearchParameter();
                                result.Parameters.Add(iparam);
                                foreach (string pkey in dparam.Keys)
                                {
                                    switch (pkey)
                                    {
                                    case "Parameter":
                                        iparam.Parameter = dparam[pkey].ToString();
                                        break;

                                    case "Value":
                                        iparam.Value = dparam[pkey];
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    break;
                }
            }

            return(result);
        }