static public void WriteDCToEntity(ExtensibleDC dc, ExtensibleEntity entity) { EntityMetadata entityMetadata = ExtensibleEntity.GetEntityMetadata(entity.GetType()); FieldMetadata[] fields = entityMetadata.Fields; for (int i = 0; i < fields.Length; i++) { //if (string.Compare(fields[i].Name, entityMetadata.Key, true) == 0)//skip the key fields // continue; if (!dc.Contains(fields[i].Name)) { continue; } FieldMetadata field = fields[i]; object value = TypeConvert.ChangeType(dc.GetValue(field.Name), DataTypeConvert.ToSysType(field.DataType, field.Nullable)); entity.SetValue(field.Name, value); } }
private void HandleSubmitEvent_Invoked(object sender, ExternalDataEventArgs e) { SubmitEventArgs args = (SubmitEventArgs)e; ExtensibleDC submittedObject = args.SubmittedObject; if (submittedObject == null || string.IsNullOrEmpty(FieldName) || string.IsNullOrEmpty(FieldValue)) { _autoApprove = false; return; } string value = submittedObject.GetValue(FieldName); if (string.Compare(value, FieldValue, true) == 0) { _autoApprove = true; _pass = true; } }
public static void FillValues(Control container, EntityFieldDef[] fields, ExtensibleDC dc) { foreach (EntityFieldDef field in fields) { Control control = container.FindControl(_prefix + field.Name); if (control == null) { continue; } string textValue = dc.GetValue(field.Name); if (control is TextBox) { (control as TextBox).Text = textValue; } else if (control is DropDownList) { (control as DropDownList).SelectedValue = textValue; } else if (control is Label) { (control as Label).Text = textValue; } } }