Пример #1
0
        public virtual void AddField(RecordField field, int index)
        {
            if (this.Reader.Reader != null)
            {
                if (index >= 0 && index < this.Reader.Reader.Fields.Count)
                {
                    this.Reader.Reader.Fields.Insert(index, field);
                }
                else
                {
                    this.Reader.Reader.Fields.Add(field);
                }
            }
            this.AddScript("{0}.addField({1}{2});", this.ClientID, new ClientConfig(true).Serialize(field), index >= 0 ? ", " + index : "");

            if (this.Reader.Reader != null && this.Reader.Reader is JsonReader)
            {
                this.ClearMeta();
            }
        }
Пример #2
0
 public virtual void RemoveField(RecordField field)
 {
     this.AddScript("{0}.removeField({1});", this.ClientID, new ClientConfig(true).Serialize(field));
 }
Пример #3
0
 public virtual void AddField(RecordField field)
 {
     this.AddField(field, -1);
 }
Пример #4
0
        private object GetFieldValue(AutoGeneratedFieldProperties property, object obj, RecordField field)
        {
            if (field != null && !string.IsNullOrEmpty(field.ServerMapping))
            {
                string[] mapping = field.ServerMapping.Split('.');
                if (mapping.Length > 1)
                {
                    for (int i = 0; i < mapping.Length; i++)
                    {
                        PropertyInfo p = obj.GetType().GetProperty(mapping[i]);
                        obj = p.GetValue(obj, null);
                        if (obj == null)
                        {
                            return(null);
                        }
                    }

                    return(obj);
                }
            }

            return(DataBinder.GetPropertyValue(obj, property.DataField));
        }