public override IList Elements()
        {
            PropertyList propertyList = dataPrototype.Info().CreatePropertyList();

            DataField[] keyFields = dataPrototype.Info().GetKeyFields();
            if (keyFields.Length > 1)
            {
                throw new UnsupportedOperationException();
            }
            for (int i = 0; i < keyFields.Length; i++)
            {
                propertyList.AddProperty(keyFields[i].GetFieldName());
            }
            propertyList.AddProperty(dataPrototype.Info().GetTitleField().GetFieldName());
            ICollection collection = GetAllDataCollection(propertyList);
            ArrayList   list       = new ArrayList(collection == null ? 0 : collection.Count);

            if (collection != null)
            {
                for (IEnumerator i = collection.GetEnumerator(); i.MoveNext();)
                {
                    DataContent data = (DataContent)i.Current;
                    list.Add(
                        new Element(
                            data.GetDataKey().KeyPartAt(0),
                            data.GetProperty(dataPrototype.Info().GetTitleField().GetFieldName()).ToString()
                            )
                        );
                }
            }
            return(list);
        }
 public override String GetKeyRenderer(Object key)
 {
     try
     {
         PropertyList propertyList = dataPrototype.Info().CreatePropertyList();
         propertyList.AddProperty(dataPrototype.Info().GetTitleField().GetFieldName());
         DataContent data = GetData(propertyList, key);
         return(data == null ? "" : data.GetProperty(dataPrototype.Info().GetTitleField().GetFieldName()).ToString());
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
     return(null);
 }
Exemple #3
0
        public void UpdateGUI(DataContent dc, PropertyList includeList, PropertyList excludeList, PropertyList ignoreIfEmptyList)
        {
            ArrayList theList = includeList == null?new ArrayList(comps.Keys) : new ArrayList(includeList.KeySet());

            foreach (String k in  theList)
            {
                Control textBox       = (Control)comps[k];
                bool    doExcludeThis = false;
                if (excludeList != null && excludeList.ContainsProperty(textBox.Name))
                {
                    doExcludeThis = true;
                }
                if (!doExcludeThis)
                {
                    try
                    {
                        if (!doExcludeThis)
                        {
                            if (ignoreIfEmptyList != null && ignoreIfEmptyList.ContainsProperty(textBox.Name))
                            {
                                doExcludeThis = true;
                            }
                        }
                        if (!doExcludeThis)
                        {
                            SetFieldValue(k, dc.GetProperty(k));
                        }
                    }
                    catch (Exception exc)
                    {
                        if (textBox is TextBox)
                        {
                            textBox.Text = "";
                            textBox.Focus();
                        }
                        throw exc;
                    }
                }
            }
        }