Ejemplo n.º 1
0
        public static IDictionary <string, object> GetControlValueWithFieldName(this LayoutControlItem item)
        {
            if (item.Control == null)
            {
                return(null);
            }
            var fieldName = item.GetFieldNameByControl().ToUpperUnderscoreByPattern();

            IDictionary <string, object> dic = new Dictionary <string, object>();

            if (item.Control.GetType() == typeof(TextEdit))
            {
                dic.Add(fieldName, ((TextEdit)item.Control).EditValue);
            }
            else if (item.Control.GetType() == typeof(XLookup))
            {
                dic.Add(fieldName, ((XLookup)item.Control).EditValue);
            }
            else if (item.Control.GetType() == typeof(SpinEdit))
            {
                dic.Add(fieldName, ((SpinEdit)item.Control).EditValue);
            }
            else if (item.Control.GetType() == typeof(MemoEdit))
            {
                dic.Add(fieldName, ((MemoEdit)item.Control).EditValue);
            }
            else if (item.Control.GetType() == typeof(DateEdit))
            {
                dic.Add(fieldName, ((DateEdit)item.Control).GetDateChar8());
            }
            else if (item.Control.GetType() == typeof(CheckEdit))
            {
                dic.Add(fieldName, ((CheckEdit)item.Control).EditValue);
            }
            else if (item.Control.GetType() == typeof(ButtonEdit))
            {
                dic.Add(fieldName, ((ButtonEdit)item.Control).EditValue);
            }
            else if (item.Control.GetType() == typeof(XSearch))
            {
                dic.Add(fieldName, ((XSearch)item.Control).EditValue);
            }
            else if (item.Control.GetType() == typeof(XPeriod))
            {
                dic.Add("ST_" + fieldName, ((XPeriod)item.Control).DateFrEdit.GetDateChar8());
                dic.Add("ED_" + fieldName, ((XPeriod)item.Control).DateToEdit.GetDateChar8());
            }
            return(dic);
        }