예제 #1
0
        public CatalogTemplate GetCatalogTemplate(bool isAdvanceSearch)
        {
            var options = new Dictionary <string, string>();

            catalogOptionName.ForEach(x => options.Add(isAdvanceSearch
                                                           ? PrefixOptions.Advance + x + PrefixOptions.Width
                                                           : x + PrefixOptions.Width, x));
            var template = new CatalogTemplate();

            template.IsAdvanceSearch = isAdvanceSearch;
            Dictionary <string, double> columnsWidth = optionService.GetDoubleOptions(options.Keys);

            template.GridColumnsWidth = new Dictionary <string, double>();

            foreach (KeyValuePair <string, double> item in columnsWidth)
            {
                string columnName;

                if (options.TryGetValue(item.Key, out columnName))
                {
                    template.GridColumnsWidth.Add(columnName, item.Value);
                }
            }

            return(template);
        }
예제 #2
0
        public void SetCatalogTemplate(CatalogTemplate template)
        {
            Dictionary <string, string> options = new Dictionary <string, string>();

            catalogOptionName.ForEach(x => options.Add(x, template.IsAdvanceSearch
                                                              ? PrefixOptions.Advance + x + PrefixOptions.Width
                                                              : x + PrefixOptions.Width));
            var columnsWidth = new Dictionary <string, double>();

            foreach (KeyValuePair <string, double> item in template.GridColumnsWidth)
            {
                string optionName;

                if (options.TryGetValue(item.Key, out optionName))
                {
                    columnsWidth.Add(optionName, item.Value);
                }
            }

            optionService.SetDoubleOptions(columnsWidth);
        }