Beispiel #1
0
        internal static SearchCriteriaXmlSettings ToXml(SearchCriteriaSettings setting)
        {
            ArrayList criteria = new ArrayList();

            foreach (var child in setting.Items.OfType <SearchSubrecord>().Where(x => x.Checked))
            {
                criteria.Add(new SearchSubrecordXml {
                    SubRecord = child.Record.name, Type = child.Type
                });
            }
            foreach (var elem in setting.Items.OfType <SearchElement>().Where(x => x.Checked))
            {
                var par = elem.Parent;
                criteria.Add(new SearchElementXml
                {
                    SubRecord = par.Record.name,
                    Element   = elem.Record.name,
                    Type      = elem.Type,
                    Value     = elem.Value != null ? elem.Value.ToString() : null
                });
            }
            return(new SearchCriteriaXmlSettings {
                Name = setting.ToString(), Type = setting.Type, Items = criteria.ToArray()
            });
        }
Beispiel #2
0
 internal static SearchCriteriaXmlSettings ToXml(SearchCriteriaSettings setting)
 {
     ArrayList criteria = new ArrayList();
     foreach (var child in setting.Items.OfType<SearchSubrecord>().Where(x=>x.Checked))
     {
         criteria.Add(new SearchSubrecordXml { SubRecord = child.Record.name, Type = child.Type });
     }
     foreach (var elem in setting.Items.OfType<SearchElement>().Where(x=>x.Checked))
     {
         var par = elem.Parent;
         criteria.Add(new SearchElementXml
         {
             SubRecord = par.Record.name,
             Element = elem.Record.name,
             Type = elem.Type,
             Value = elem.Value != null ? elem.Value.ToString() : null
         });
     }
     return new SearchCriteriaXmlSettings { Name = setting.ToString(), Type = setting.Type, Items = criteria.ToArray() };
 }