public WebGrid(string type, CurrentUser myUser, string myGridName) { this.User = myUser; this.objectType = type; _protoObject = this.User.protoObject(this.objectType); _pkfield = _protoObject.primaryKey; _gridName = myGridName; }
public IntelWebObject protoObject(string objectType) { IntelWebObject tobj = new IntelWebObject(); Type mytype = Type.GetType("IntelWeb." + objectType); if (mytype == null) { throw new ApplicationException("The type '" + objectType + "' could not be found."); } tobj = (IntelWebObject)Activator.CreateInstance(mytype, new object[] { this }); return tobj; }
public void applyTo(IntelWebObject applyToObject, List<String> excludeFields) { var ApplyToType = applyToObject.GetType(); foreach (var fld in this.FieldList) { if (excludeFields == null || !excludeFields.Exists(x => x.Equals(fld.name, StringComparison.InvariantCultureIgnoreCase))) { var destFieldObj = applyToObject.Field(fld.name); if (destFieldObj != null) { var prop = ApplyToType.GetProperty(destFieldObj.name); if (prop != null) { prop.SetValue(applyToObject, fld.fieldValue, null); } } } } }