Esempio n. 1
0
        public void UpdateData(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
                    {
                        Object o = GetFieldValue(k);
                        if (!doExcludeThis && o == null)
                        {
                            if (ignoreIfEmptyList != null && ignoreIfEmptyList.ContainsProperty(textBox.Name))
                            {
                                doExcludeThis = true;
                            }
                        }
                        if (!doExcludeThis)
                        {
                            dc.SetProperty(k, o);
                        }
                    }catch (Exception exc)
                    {
                        if (textBox is TextBox)
                        {
                            textBox.Text = "";
                            textBox.Focus();
                        }
                        throw exc;
                    }
                }
            }
        }
Esempio n. 2
0
        public void UpdateUI(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.ID))
                {
                    doExcludeThis = true;
                }
                if (!doExcludeThis)
                {
                    try
                    {
                        if (!doExcludeThis)
                        {
                            if (ignoreIfEmptyList != null && ignoreIfEmptyList.ContainsProperty(textBox.ID))
                            {
                                doExcludeThis = true;
                            }
                        }
                        if (!doExcludeThis)
                        {
                            SetFieldValue(k, dc.GetProperty(k));
                        }
                    }
                    catch (Exception exc)
                    {
                        SetControlText(textBox, "");
                        throw exc;
                    }
                }
            }
        }