protected void AddKeyValue(KeyValueCollection values, DbObjectSmartUpdate o, string key, int n, object v) { if ((o.m_UpdateColumns != null) && o.m_UpdateColumns.ContainsKey(key)) { values.Add(this.NewKeyValue(n, v)); } }
public override void InitLoadedColumns(DbObjectSmartUpdate model) { _LoadedColumns = new Dictionary <string, object>(); foreach (var m in model.Context.Info.Members) { if (m.Is.AutoSavedValue || m.Is.Key) { continue; } if (m.Is.SimpleField) { _LoadedColumns.Add(m.Name, m.GetValue(model)); } else if (m.Is.LazyLoad) { var ll = (ILazyLoading)m.GetValue(model); if (ll.IsLoaded) { _LoadedColumns.Add(m.Name, ll.Read()); } } else if (m.Is.BelongsTo) { var bt = (IBelongsTo)m.GetValue(model); _LoadedColumns.Add(m.Name, bt.ForeignKey); } } }
protected void AddKeyValue(KeyValueCollection values, DbObjectSmartUpdate o, string key, int n, object v) { // if ((o.m_UpdateColumns == null) || o.m_UpdateColumns.ContainsKey(key)) // { // values.Add(this.NewKeyValue(n, v)); // } }
protected override void OnAfterEdit(RowColEventArgs e) { if (this.Cols[e.Col].UserData != null) { ColumnInfo info = this.Cols[e.Col].UserData as ColumnInfo; if (!info.ViewName.IsNullOrEmpty()) { if (info.ViewName != info.ColumnName) { G.Controls.Input.DropDown control = this.Cols[e.Col].Editor as G.Controls.Input.DropDown; DbObjectSmartUpdate obj = this.GetCurSelect <DbObjectSmartUpdate>(); obj.setValue(info.ColumnName, control.GetValue()); obj.setValue(info.ViewName, control.Text); } else { G.Controls.Input.DropDown control = this.Cols[e.Col].Editor as G.Controls.Input.DropDown; if (control != null) { DbObjectSmartUpdate obj = this.GetCurSelect <DbObjectSmartUpdate>(); obj.setValue(info.ColumnName, control.GetValue()); } } } } base.OnAfterEdit(e); }
public bool FindUpdateColumns(DbObjectSmartUpdate model, UpdateStatementBuilder builder) { var autoList = new List <KeyOpValue> (); foreach (var m in model.Context.Info.Members) { if (m.Is.DbGenerate || m.Is.HasOne || m.Is.HasMany || m.Is.HasAndBelongsToMany || m.Is.CreatedOn || m.Is.Key) { continue; } if (m.Is.Count) { autoList.Add(new KeyOpValue(m.Name, 1, KvOpertation.Add)); continue; } if (m.Is.UpdatedOn || m.Is.SavedOn) { autoList.Add(new KeyOpValue(m.Name, null, KvOpertation.Now)); continue; } if (m.Is.SimpleField) { object n = m.GetValue(model); ProcessSimpleMember(builder, m, n); } else if (m.Is.LazyLoad) { var ll = (ILazyLoading)m.GetValue(model); if (ll.IsLoaded) { var value = ll.Read(); var type = m.MemberType.GetGenericArguments() [0]; ProcessLazyLoad(builder, m, value, type); } } else if (m.Is.BelongsTo) { var bt = (IBelongsTo)m.GetValue(model); var fk = bt.ForeignKey; ProcessBelongsTo(builder, m, fk); } } if (builder.Values.Count > 0) { builder.Values.AddRange(autoList); return(true); } return(false); }
public virtual void InitLoadedColumns(DbObjectSmartUpdate model) { }
protected LazyLoadOneBase(DbObjectSmartUpdate owner, string relationName) { this.Owner = owner; this.RelationName = relationName; }
public virtual void CtorInit(DbObjectSmartUpdate o) { }