Пример #1
0
        public virtual void AddField(RecordField field, int index, bool clearMeta)
        {
            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().Serialize(field), index >=0 ? ", " + index : ", ");

            this.Call("addField", new JRawValue(new ClientConfig().Serialize(field)), index, clearMeta);
        }
Пример #2
0
 public virtual void AddField(RecordField field)
 {
     this.AddField(field, true);
 }
Пример #3
0
 public virtual void AddField(RecordField field, bool clearMeta)
 {
     this.AddField(field, -1, clearMeta);
 }
Пример #4
0
 public virtual void RemoveField(RecordField field)
 {
     this.Call("removeField", new JRawValue(new ClientConfig().Serialize(field)));
 }
Пример #5
0
 /// <summary>
 ///
 /// </summary>
 public RecordField.Builder RecordField(RecordField component)
 {
     return(new RecordField.Builder(component));
 }
Пример #6
0
 public virtual void AddField(RecordField field, int index)
 {
     this.AddField(field, index, true);
 }
Пример #7
0
 /// <summary>
 ///
 /// </summary>
 public virtual TBuilder AddField(RecordField field, int index, bool clearMeta)
 {
     this.ToComponent().AddField(field, index, clearMeta);
     return(this as TBuilder);
 }
Пример #8
0
 /// <summary>
 ///
 /// </summary>
 public virtual TBuilder RemoveField(RecordField field)
 {
     this.ToComponent().RemoveField(field);
     return(this as TBuilder);
 }
Пример #9
0
        private object GetFieldValue(AutoGeneratedFieldProperties property, object obj, RecordField field, System.Data.DataRow dataRow)
        {
            if (field != null && field.ServerMapping.IsNotEmpty())
            {
                string[] mapping = field.ServerMapping.Split('.');

                if (mapping.Length > 1)
                {
                    for (int i = 0; i < mapping.Length; i++)
                    {
                        if (dataRow != null && dataRow.IsNull(mapping[i]))
                        {
                            return null;
                        }
                        
                        PropertyInfo p = obj.GetType().GetProperty(mapping[i]);
                        try
                        {
                            obj = p.GetValue(obj, null);
                        }
                        catch (NullReferenceException e)
                        {
                            throw new NullReferenceException(String.Format("Mapped property '{0}' doesn't exist", mapping[i]));
                        }
                        
                        if (obj == null)
                        {
                            return null;
                        }
                    }

                    return obj;
                }
            }

            return (dataRow != null && dataRow.IsNull(property.DataField)) ? null : DataBinder.GetPropertyValue(obj, property.DataField);
        }
Пример #10
0
        private object GetFieldValue(AutoGeneratedFieldProperties property, object obj, RecordField field, System.Data.DataRow dataRow)
        {
            if (field != null && field.ServerMapping.IsNotEmpty())
            {
                string[] mapping = field.ServerMapping.Split('.');

                if (mapping.Length > 1)
                {
                    for (int i = 0; i < mapping.Length; i++)
                    {
                        if (dataRow != null && dataRow.IsNull(mapping[i]))
                        {
                            return(null);
                        }

                        PropertyInfo p = obj.GetType().GetProperty(mapping[i]);
                        try
                        {
                            obj = p.GetValue(obj, null);
                        }
                        catch (NullReferenceException e)
                        {
                            throw new NullReferenceException(String.Format("Mapped property '{0}' doesn't exist", mapping[i]));
                        }

                        if (obj == null)
                        {
                            return(null);
                        }
                    }

                    return(obj);
                }
            }

            return((dataRow != null && dataRow.IsNull(property.DataField)) ? null : DataBinder.GetPropertyValue(obj, property.DataField));
        }
Пример #11
0
 public virtual void AddField(RecordField field)
 {
     this.AddField(field, true);
 }
Пример #12
0
 public virtual void AddField(RecordField field, bool clearMeta)
 {
     this.AddField(field, -1, clearMeta);
 }
Пример #13
0
 public virtual void RemoveField(RecordField field)
 {
     this.Call("removeField", new JRawValue(new ClientConfig().Serialize(field)));
 }
Пример #14
0
        public virtual void AddField(RecordField field, int index, bool clearMeta)
        {
            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().Serialize(field), index >=0 ? ", " + index : ", ");

            this.Call("addField", new JRawValue(new ClientConfig().Serialize(field)), index, clearMeta);
        }
Пример #15
0
 public virtual void AddField(RecordField field, int index)
 {
     this.AddField(field, index, true);
 }